- This topic has 2 replies, 3 voices, and was last updated 13 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › sbit????
guyz i wanted to ask what is sbit?.whatt does this mean sbit rd= port^4;
sbit is a type of datatype similar to char, integer etc. It is used when we want to use a single bit. In the statement you have given above, it means you have created a bit type variable with name “rd” and whose value will be equal to 5th pin as referenced by the variable port. If port =P0 it means 5th pin of P0.
The sbit type defines a bit within a special function register (SFR). It is used in one of the following ways:
sbit name = sfr-name ^ bit-position;
sbit name = sfr-address ^ bit-position;
sbit name = sbit-address;
sbit LED2=P3^3; //……meanspin 3 of port 3 is named as LED2 (USED IN PROGRAM LATER)
sbit EN=P3^7; //…….meanspin 7 of port 3 is named as EN (USED IN PROGRAM LATER)
sbit RW=P3^6; //……………….
sbit RS=P3^5; //……………….