View previous topic :: View next topic |
Author |
Message |
jychua
Joined: 27 Jul 2021 Posts: 14
|
SFR/BIT List |
Posted: Fri Sep 17, 2021 2:37 pm |
|
|
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: 9228 Location: Greensville,Ontario
|
|
Posted: Fri Sep 17, 2021 4:17 pm |
|
|
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
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19516
|
|
Posted: Sat Sep 18, 2021 12:40 am |
|
|
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... |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1349
|
|
Posted: Sat Sep 18, 2021 11:14 am |
|
|
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
|
|
Posted: Mon Sep 20, 2021 12:55 pm |
|
|
Thank you all for your help! Really appreciate it. |
|
|
|