Page 2 of 2
Re: PIC16 toolchain for FC9
Posted: Wed Sep 06, 2023 6:32 pm
by Xbiotec
hi Medeled,
Do you know how to change WDTPS (postscaler) in C code?
I tried many differentes syntax but not lucky !
It's for a PIC24JF256A705
_FWDT( OPT1_ON & OPT2_OFF & OPT3_PLL )
**
** Watchdog Timer Postscaler bits:
** WDTPS_PS1 1:1
** WDTPS_PS2 1:2
** WDTPS_PS4 1:4
** WDTPS_PS8 1:8
** WDTPS_PS16 1:16
** WDTPS_PS32 1:32
** WDTPS_PS64 1:64
** WDTPS_PS128 1:128
** WDTPS_PS256 1:256
** WDTPS_PS512 1:512
** WDTPS_PS1024 1:1,024
** WDTPS_PS2048 1:2,048
** WDTPS_PS4096 1:4,096
** WDTPS_PS8192 1:8,192
** WDTPS_PS16384 1:16,384
** WDTPS_PS32768 1:32,768
Thx for you help
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 12:37 pm
by Xbiotec
hi Steve,
I tried but not working .
please check the file attached
thx for your help
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 3:02 pm
by Steve-Matrix
Replace the "pic16_C30_comp.bat" and "pic16_C30_link.bat" files within "%PROGRAMDATA%\MatrixTSL\FlowcodeV9\FCD\PIC16\batchfiles\" with the ones in the ZIP attached to this post.
You should make a backup of the old files first. I've tested and this creates a HEX file for me with the new toolchain.
Note that the same files should work for Flowcode v10 as well (the batch files need to go in the appropriate FlowcodeV10 folder within %PROGRAMDATA%).
Please let us know if this works.
(edit: I have updated the files to allow them to work with spaces in the saved project name)
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 3:28 pm
by Xbiotec
with this, I will able to use XC16 pro compiler from microchip ?
it's strange because according to your previous post, the .bat folder file should be in the new install location !
This might work for the new XC16 compiler:
Install the new compiler in a separate location
Copy the "batchfiles" folder from the old installation to the same place as the new one
-- the "batchfiles" folder should be at the same 'level' as the "bin", "etc", "include", etc.
Point Flowcode to the new installer location within Global Options...Locations
-- this location will be the folder containing the copied "batchfiles" folder
Restart Flowcode
how location should be there ?
with this location , compilation failed

- option.jpg (45.49 KiB) Viewed 6283 times
how to be sure that XC16 compiler from microchip will be used or is used?
thx
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 3:41 pm
by Steve-Matrix
My previous instructions were wrong. Sorry about that. They should be:
- Install the new compiler in a separate location
- Point Flowcode to the new installer location within Global Options...Locations
-- this location will be something like "C:\ProgramFiles\Microchip\xc16\v2.10"
- Restart Flowcode
The batch files in the actual toolchain location are no longer used. The ones used are within %PROGRAMDATA% and need to be replaced with the ones I attached earlier.
Also note that changing the toolchain in this way may not fully work. I'm providing these instructions to help you (and others) set up and use the latest compiler. I have not fully tested this new compiler and using it instead of the one we provide may have compilation and execution issues.
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 4:45 pm
by Xbiotec
Okay
done, how to be sure that Xc16 compiler from microchip is used during compilation ?
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 5:02 pm
by Steve-Matrix
When you click to build, you should get something like the following:
Code: Select all
Launching the compiler...
C:\ProgramData\MatrixTSL\FlowcodeV10\FCD\PIC16\batchfiles\pic16_C30_comp.bat "E:\ProgramFiles\Microchip\xc16\v2.10\" "xc16_test" "E:\DEV\Flowcode\programs\" "24F08KA101"
The first parameter should be the new toolchain location (for me it is
E:\ProgramFiles\Microchip\xc16\v2.10, but yours will be different).
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 5:05 pm
by Xbiotec
it work's ,
Code: Select all
C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\PIC16\batchfiles\pic16_C30_comp.bat "C:\Program Files (x86)\Flowcode\Compilers\xc16\v2.10\" "PIC24FJ256GA705test2" "C:\Users\seb\Documents\AAA Microchip\" "24FJ256GA705"
thx a lot
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 5:06 pm
by Xbiotec
For this pic, I need deepsleep, it seems that deep sleep function is only available in asm could you give me a syntax example to add asm in C ocde .
thx
Re: PIC16 toolchain for FC9
Posted: Tue Sep 12, 2023 5:29 pm
by BenR
Hello,
A bit of Googling has come up with this, no idea if it works or not.
Start deep sleep
Code: Select all
// Enclose all in-line assembly in its own function
asm("MOV #0x8000, w2");
asm("MOV w2, DSCON");
asm("MOV w2, DSCON"); // Must repeat writes for GC family devices.
asm("PWRSAV #0")
End deep sleep
Code: Select all
_RELEASE = 0;
_RELEASE = 0; // Must repeat writes for GC family devices.
Let us know how you get on.