PIC16 toolchain for FC9

For general Flowcode discussion that does not belong in the other sections.
Xbiotec
Posts: 200
http://meble-kuchenne.info.pl
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: PIC16 toolchain for FC9

Post 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
Seb

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: PIC16 toolchain for FC9

Post by Xbiotec »

hi Steve,
I tried but not working .
please check the file attached
Pro Compiler install problem .docx
(145.99 KiB) Downloaded 250 times
thx for your help
Seb

Steve-Matrix
Matrix Staff
Posts: 1384
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 184 times
Been thanked: 322 times

Re: PIC16 toolchain for FC9

Post 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)
Attachments
batchfiles.zip
(2.02 KiB) Downloaded 190 times

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: PIC16 toolchain for FC9

Post 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
option.jpg (45.49 KiB) Viewed 4043 times



how to be sure that XC16 compiler from microchip will be used or is used?
thx
Seb

Steve-Matrix
Matrix Staff
Posts: 1384
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 184 times
Been thanked: 322 times

Re: PIC16 toolchain for FC9

Post 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.

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: PIC16 toolchain for FC9

Post by Xbiotec »

Okay
done, how to be sure that Xc16 compiler from microchip is used during compilation ?
Seb

Steve-Matrix
Matrix Staff
Posts: 1384
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 184 times
Been thanked: 322 times

Re: PIC16 toolchain for FC9

Post 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).

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: PIC16 toolchain for FC9

Post by Xbiotec »

it work's , :D

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
Seb

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: PIC16 toolchain for FC9

Post 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
Seb

BenR
Matrix Staff
Posts: 1895
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 491 times
Been thanked: 664 times

Re: PIC16 toolchain for FC9

Post 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.

Post Reply