??? 08/02/07 13:01 Modified: 08/02/07 13:05 Read: times Msg Score: +2 +2 Informative |
#142649 - not to me Responding to: ???'s previous message |
when it's so obvious the "variable" is an SFR?
not to me, that is always a problem when 'partial' code is presented. turn on a bit in a register 'ADCF' what does 'register' mean? maybe SFR, maybe variable, maybe even register (you could have #define ADCF R7). I have, in very 'tight' and complex assembler routines renamed R0-R7 to names significant to their uses (e.g. rename R7 'byte_count'). Don't you write SFR's with capitals? I do, and even mark them to make sure that "it IS so obvious" example from my LPC93x SFR file sfr SF_TCON = 0x88; sbit SB_TCON_IT0 = 0x88; #define SM_TCON_IT0 0x01 sbit SB_TCON_IE0 = 0x89; #define SM_TCON_IE0 0x02 sbit SB_TCON_IT1 = 0x8A; #define SM_TCON_IT1 0x04 sbit SB_TCON_IE1 = 0x8B; #define SM_TCON_IE1 0x08 sbit SB_TCON_TR0 = 0x8C; #define SM_TCON_TR0 0x10 sbit SB_TCON_TF0 = 0x8D; sbit SB_TCON_TR1 = 0x8E; #define SM_TCON_TR1 0x40 sbit SB_TCON_TF1 = 0x8F;this method gives the following advantages: a)it is OBVIOUS what we are dealing with b) a global search on e.g. TCON will give each and every place anything related to TCON is done c) the same as b) for e.g. TR0 using the standard SFR names makes you miss one instance in a search if you have these two clr TR0 ORL TCON,#010h but clr SB_TCON_TR0 ORL TCON,#SM_TCON_TR0 will make both show up in a search Erik |
Topic | Author | Date |
A Simpler Way? | 01/01/70 00:00 | |
Logical AND ? | 01/01/70 00:00 | |
Shift? | 01/01/70 00:00 | |
I Agree. | 01/01/70 00:00 | |
Another Option | 01/01/70 00:00 | |
the simplest way | 01/01/70 00:00 | |
capitals | 01/01/70 00:00 | |
I copyued what the OP used | 01/01/70 00:00 | |
The common use of CAPs in C | 01/01/70 00:00 | |
totally agree, however | 01/01/70 00:00 | |
Why are you rambling about variables... | 01/01/70 00:00 | |
not to me | 01/01/70 00:00 | |
Variable capitalisation? | 01/01/70 00:00 | |
'code 'never is | 01/01/70 00:00 | |
Did not think it mattered. | 01/01/70 00:00 | |
Code modifier | 01/01/70 00:00 | |
both | 01/01/70 00:00 | |
Use both | 01/01/70 00:00 | |
C++ ? | 01/01/70 00:00 | |
Mixed | 01/01/70 00:00 | |
Extensions | 01/01/70 00:00 | |
Experience | 01/01/70 00:00 |