View previous topic :: View next topic |
Author |
Message |
Torello
Joined: 29 Sep 2006 Posts: 120
|
#bit/byte/Word register definitions include file |
Posted: Sun Jul 06, 2014 12:42 pm |
|
|
Hi,
OK made my own registers include file in the past. But now migration to a bigger processor, I tried to find an existing file for the PIC24FJ128GC010 family.
I Searched for like an hour but can't find anything.
Does one really make it's own CCS register definitions?
It's so cumbersome to do.... _________________ Regards, Edwin. PCWHD v5.114 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 06, 2014 1:14 pm |
|
|
If you have the full CCS IDE version of the compiler, then go to the
Registers tab in the Device Table Editor window. There is a menu
selection to the right of the PIC name for "Make Include File". Click on it.
See this screenshot of the Device Table Editor:
http://www.datadynamics.co.jp/ccscc/images/device_table_editor.gif |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Mon Jul 07, 2014 12:36 am |
|
|
As a comment though, use of address defines should be almost non-existent with CCS.
99.9% of code doesn't need them.
For the 0.1% that does, it is usually only a single register or bit that is needed. Using such defines 'routinely', suggests you are not really making use of the compiler's abilities....
For the odd bit/byte that is needed, the 'getenv' ability is the most powerful tool since it is device independant.
So:
Code: |
#bit TXIF=getenv("bit:TXIF")
|
Automatically finds the bit called 'TXIF' by Microchip, and creates a reference to it. Works on any chip that has a bit called 'TXIF'. For registers, use "SFR:xxxx".
More flexible, and safer. |
|
|
Torello
Joined: 29 Sep 2006 Posts: 120
|
|
Posted: Mon Jul 07, 2014 6:09 am |
|
|
I do agree, I don't need all of them. But some are very obvious. I don't recall a function that can check a TMRxIF bit.
And besides that, the CCS compiler and the Pic have their flaws and bugs one needs to address.
For my new Pic24LF128GC006 it looks like I have to recode a proper functioning #use delay(internal..) and/or setup_oscillator() replacement.
My previous Pic18LF4685 has a CAN bus that was not proper initialized "off" for low power sleep of the MCU...
At startup of my code, I need to know if it was due to firmware reprogramming, power-reboot, Mclr or softReset. This involves also a bunch of registers to peek/poke.
and so on... _________________ Regards, Edwin. PCWHD v5.114 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Mon Jul 07, 2014 8:23 am |
|
|
interrupt_active(INT_TMRx);
For whatever 'x' you want.... |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Mon Jul 07, 2014 10:09 am |
|
|
Quote: | At startup of my code, I need to know if it was due to firmware reprogramming, power-reboot, Mclr or softReset. This involves also a bunch of registers to peek/poke. |
Try restart_cause() _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|