|
|||||||||||
|
Technical Support On-Line Manuals C251 User's Guide |
sfr16The sfr16 type defines a 16-bit special function register (SFR). It is used as follows: sfr16 name = address; Where
Some 251 derivatives have 16-bit SFRs thare are created using consecutive addresses in SFR memory to specify 16-bit values. For example, the 80C251SB uses addresses 0xCC and 0xCD for the low and high bytes of timer/counter 2 respectively. The C251 Compiler provides the sfr16 data type to access two SFRs as a single 16-bit SFR. Access to 16-bit SFRs using sfr16 is possible only when the low byte immediately precedes the high byte (little endian) and when the low byte is written last. The low byte is used as the address in the sfr16 declaration. For example: sfr16 T2 = 0xCC; /* Timer 2: T2L 0CCh, T2H 0CDh */ sfr16 RCAP2 = 0xCA; /* RCAP2L 0CAh, RCAP2H 0CBh */ In this example, T2 and RCAP2 are declared as 16-bit special function registers. The sfr16 declarations follow the same rules as outlined for sfr declarations. Any symbolic name can be used in an sfr16 declaration. The address specification after the equal sign ('=') must be a numeric constant. Expressions with operators are not allowed. The address must be the low byte of the SFR low-byte, high-byte pair. Note
| ||||||||||
|
|||||||||||