Hi,
Its the first time i have tried to use this chip. (24FJ128GB202), usually i have used the 24HJ128GP502.
I created an empty project and attempted to build to Hex file.
I get a compile error as below
Obviously its connected to the 'AD1PCFG'
//------------------------------------------
int main()
{
AD1PCFG = 0xffff;
mainendloop: goto mainendloop;
return 0;
}
//------------------------------------------
NOT FOR COMMERCIAL USE
https://www.flowcode.co.uk
Launching the compiler...
C:\Program Files (x86)\Flowcode\Compilers\pic16\batchfiles\pic16_C30_comp.bat "no build project" "C:\Users\andos\Documents\Flowcode\" "24FJ128GB202"
C:\Users\andos\Documents\Flowcode>xc16-gcc -c -mcpu="24FJ128GB202" -omf=coff -funsigned-char -fno-short-double -Os -I"C:\PROGRA~2\Flowcode\COMPIL~1\pic16\BATCHF~1\..\support\h" -I"C:\PROGRA~2\Flowcode\COMPIL~1\pic16\BATCHF~1\" -std=gnu99 "no build project".c -o "no build project".o
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
no build project.c: In function 'main':
no build project.c:72:1: error: 'AD1PCFG' undeclared (first use in this function)
no build project.c:72:1: note: each undeclared identifier is reported only once for each function it appears in
Error returned from [xc16-gcc.exe]
C:\Program Files (x86)\Flowcode\Compilers\pic16\batchfiles\pic16_C30_comp.bat reported error code 0x1
Autoclose turned off
FINISHED
Thanks in advance
Andy
Pic 24FJ128GB202 no compile to hex
-
- Posts: 6
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 17, 2020 3:29 pm
- p.erasmus
- Posts: 434
- Joined: Thu Dec 03, 2020 12:01 pm
- Location: Russia / Россия
- Has thanked: 104 times
- Been thanked: 88 times
Re: Pic 24FJ128GB202 no compile to hex
Hi
Did you check the datasheet for this device, it is possible that the register name has changed / or it does not have this register,
you need to check this !
These are the things you need to do if the register exist exactly the same as in the old chip then it is possible that the definition file in FC has an error ,Then you report a bug . 
Did you check the datasheet for this device, it is possible that the register name has changed / or it does not have this register,
you need to check this !


Regards Peter - QME Electronics
-
- Posts: 6
- Joined: Thu Dec 17, 2020 3:29 pm
Re: Pic 24FJ128GB202 no compile to hex
Hi,
i appreciate and respect your comments but this is a licence issue.
Andy
i appreciate and respect your comments but this is a licence issue.
Andy
-
- Valued Contributor
- Posts: 457
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 82 times
- Been thanked: 246 times
Re: Pic 24FJ128GB202 no compile to hex
Hi Andy,
As p.erasmus says, looks like we have a register name issue
please try the attached FCD, to go into directory
C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\PIC16
nb. please first rename the 24FJ128GB202.txt file to 24FJ128GB202.fcdx
As p.erasmus says, looks like we have a register name issue
please try the attached FCD, to go into directory
C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\PIC16
nb. please first rename the 24FJ128GB202.txt file to 24FJ128GB202.fcdx
- Attachments
-
- 24FJ128GB202.txt
- (42.09 KiB) Downloaded 657 times
-
- Posts: 6
- Joined: Thu Dec 17, 2020 3:29 pm
Re: Pic 24FJ128GB202 no compile to hex
Hi,
I tried the new file but the result is the same.
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
no build project 1 .c: In function 'main':
no build project 1 .c:72:1: error: 'AD1PCFGL' undeclared (first use in this function)
no build project 1 .c:72:1: note: each undeclared identifier is reported only once for each function it appears in
Andy
I tried the new file but the result is the same.
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
no build project 1 .c: In function 'main':
no build project 1 .c:72:1: error: 'AD1PCFGL' undeclared (first use in this function)
no build project 1 .c:72:1: note: each undeclared identifier is reported only once for each function it appears in
Andy
-
- Posts: 6
- Joined: Thu Dec 17, 2020 3:29 pm
-
- Matrix Staff
- Posts: 1481
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 209 times
- Been thanked: 350 times
Re: Pic 24FJ128GB202 no compile to hex
The line in question is part of the initialisation and puts the port pins into digital mode as a default.
Looking at the header file in the toolchain, it looks like registers ANSA and ANSB control the a/d nature of the pins, and so the line in the FCDX file near the bottom should be changed from this:
to this:
There may be some other edits required to ensure ADC inputs are configured correctly when used.
Looking at the header file in the toolchain, it looks like registers ANSA and ANSB control the a/d nature of the pins, and so the line in the FCDX file near the bottom should be changed from this:
Code: Select all
<init code='AD1PCFGL = 0xffff;\n' />
Code: Select all
<init code='\tANSA = 0xffff;\n\tANSB = 0xffff;\n' />
-
- Valued Contributor
- Posts: 457
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 82 times
- Been thanked: 246 times
Re: Pic 24FJ128GB202 no compile to hex
Doh! Just beat me to it 
Having read through two datasheets ...
And it looks like ANSA etc needs to be set to 0 for digital mode.
So the edit needs to be
ANSA = 0; ... etc

Having read through two datasheets ...
And it looks like ANSA etc needs to be set to 0 for digital mode.
So the edit needs to be
ANSA = 0; ... etc
-
- Matrix Staff
- Posts: 1481
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 209 times
- Been thanked: 350 times
Re: Pic 24FJ128GB202 no compile to hex
Thanks for the correction, Leigh. In my haste to beat you, I misread the datasheet! 

-
- Valued Contributor
- Posts: 457
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 82 times
- Been thanked: 246 times
Re: Pic 24FJ128GB202 no compile to hex
Updated attached
- Attachments
-
- 24FJ128GB202.fcdx
- (42.15 KiB) Downloaded 577 times