Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What is a sbit and what is its function?

Status
Not open for further replies.

Elimathew

Member level 5
Joined
Jun 21, 2011
Messages
88
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
India
Activity points
1,894
guys i wanted to know what is a sbit and its function?.can you provide a good tutorial related to it
 

Re: what is a sbit?????

sbit? stop bit? could you explain what problem you encountered?
 

Re: what is a sbit?????

Dear Elimathew

sbit name = sfr-name ^ bit-position;
sbit name = sfr-address ^ bit-position;
sbit name = sbit-address;
Where

name is the name of the SFR bit.
sfr-name is the name of a previously-defined SFR.
bit-position is the position of the bit within the SFR.
sfr-address is the address of an SFR.
sbit-address is the address of the SFR bit.

With typical 8051 applications, it is often necessary to access individual bits within an SFR. The sbit type provides access to bit-addressable SFRs and other bit-addressable objects. For example:

sbit TestLed = P1^6;

TestLed = name;
P1 = SFR port1
6 = bit position means Port1 6th bit

regards
Sreekanth
 
Re: what is a sbit?????

instead of P1^6 cant we write P1_6
 
Last edited:

Re: what is a sbit?????

Depends on the compiler, what compiler are you using?
 

Re: what is a sbit?????

im using keil muvision4
 

Re: what is a sbit?????

keil does not support it. You have to write P1^6 for sbit it is the syntax

check out this link:

Cx51 User's Guide: sbit
 

guys i wanted to know what is a sbit and its function?.can you provide a good tutorial related to it

u can use it as a variable name to access any of the sfrs bitwise.

eg
sbit a=P1^0;

here usind a we can access the valeu on to the Port1.0

a=1; // Port1.0 becomes logic 1
a=0; // Port1.0 becomes logic 0
 

Sbit is used to get the bit control for set or get for the information present of the bit in the special function registor(SFR)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top