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 support@ccsinfo.com

SFR/BIT List

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



Joined: 27 Jul 2021
Posts: 14

View user's profile Send private message

SFR/BIT List
PostPosted: Fri Sep 17, 2021 2:37 pm     Reply with quote

Hey all,

For the getenv function, one is able to check if certain SFRs/BITs are valid before using the #bit or #byte macros. I was wondering where I can find a list of the available SFRs/bit names?

Thank you for your help!

jychua
temtronic



Joined: 01 Jul 2010
Posts: 9097
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Sep 17, 2021 4:17 pm     Reply with quote

partial list is in the CCS C manual....
..contents.... getenv()..
this is for 'devices'
not too sure where individual bits for a device would be
don't know if CCS uses Uchip datasheet names for those bits.

Just remember not all PICs have all SFR !!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 17, 2021 4:19 pm     Reply with quote

You can make one. See this thread:

Register definitions, SFR -
http://www.ccsinfo.com/forum/viewtopic.php?t=58927
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sat Sep 18, 2021 12:40 am     Reply with quote

You have to use a bit of 'sense' when using these lists.

For instance, if your chip has two UARTs, It'll give two lines for each
TXSTA register. The first gives the 'generic' bit names (for the peripheral),
and the second gives the 'specific' ones for that particular peripheral.
You need to use the names given in that second line (or possibly third!).
So (for example), on a PIC18, with two UART's, the first line for UART2
shows:

CSRC TX9 TXEN SYNC SENDB NRGH TRMT TX9D

While the second has

CSRC2 TX8 TXEN2 SYNC2 SENDB2 BRGH2 TRMT2 TX9D2

But it then has a third line, just listing

TX92

Why (on this chip 87J50), it doesn't just have the TX92 definition in the
second line, and incorrectly shown TX8 there, I don't know.

So you have to be somewhat 'selective' using these lists, and look through
to find the actual name....

So TXEN2 as the bit name for this UART's enable bit etc..

However, they are normally there... Very Happy
jeremiah



Joined: 20 Jul 2010
Posts: 1315

View user's profile Send private message

PostPosted: Sat Sep 18, 2021 11:14 am     Reply with quote

There is also an alternate syntax, though I don't know what compiler version added it:

Code:

#bit  U1_TRMT = getenv("BIT:U1STA.TRMT")
#bit  U2_TRMT = getenv("BIT:U2STA.TRMT")


Names are supposed to match those of the data sheet
jychua



Joined: 27 Jul 2021
Posts: 14

View user's profile Send private message

PostPosted: Mon Sep 20, 2021 12:55 pm     Reply with quote

Thank you all for your help! Really appreciate it.
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