|
|||||||||||
|
Technical Support On-Line Manuals C251 User's Guide |
C251 User's GuidebitThe bit type defines a single-bit variable. It is used as follows: bit name <[>= value<]>; Where
The bit type may be used for variable declarations, argument lists, and function-return values. A bit variable is declared like other C data types. For example:
static bit done_flag = 0; /* bit variable */
bit testfunc ( /* bit function */
bit flag1, /* bit arguments */
bit flag2)
{
.
.
.
return (0); /* bit return value */
}
All bit variables are stored in a bit segment located in the 8051-compatible internal memory area of the 251. Because this area is only 16 bytes long, a maximum of 128 bit variables may be declared within any one scope. Note
The 251 supports an extended bit-addressable area that is located in the data memory address range 0x20-0x7F. This extended bit area supports a maximum of 768 bit variables. To locate a bit in the extended bit area, specify bit ebdata as shown in the example below.
bit ebdata state1; /* bit in 251 extended space */
bit function (bit flag) { /* parameters are only in 8051 space */
bit ebdata local_bit; /* local bit in 251 space */
local_bit = flag;
return (local_bit); /* return 251 extended bit */
}
Note
The following restrictions apply to bit variables and bit declarations:
| ||||||||||
|
|||||||||||