CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#bit/byte/Word register definitions include file

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Torello



Joined: 29 Sep 2006
Posts: 120

View user's profile Send private message

#bit/byte/Word register definitions include file
PostPosted: Sun Jul 06, 2014 12:42 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jul 06, 2014 1:14 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 07, 2014 12:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 07, 2014 6:09 am     Reply with quote

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... Smile
_________________
Regards, Edwin. PCWHD v5.114
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Jul 07, 2014 8:23 am     Reply with quote

interrupt_active(INT_TMRx);

For whatever 'x' you want....
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Jul 07, 2014 10:09 am     Reply with quote

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!!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group