What is the difference between sbit and bit in C51 programming

Publisher:科技创造者Latest update time:2015-10-08 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
First of all, bit and sbit are both variable types extended by C51.
sbit is generally used to define bit variables of special function registers to facilitate operations on a certain bit of the register.
For example: sbit TXD=P3^0; This defines TXD as a bit variable, and this sbit has a certain address.
Bit is similar to a general variable, except that the variable defined by bit has only two values: 0 or 1.
For example: bit p=0; the compiler will assign an address during the compilation process, and the assigned address is random.
Reference address:What is the difference between sbit and bit in C51 programming

Previous article:Review 51 single chip microcomputer
Next article:51 single chip microcomputer water lamp experiment

Recommended ReadingLatest update time:2024-11-23 02:58

sbit and sfr in single chip c language
1. Both bit and sbit are variable types extended by C51.                 Bit is similar to int char, except that char = 8 bits and bit = 1 bit. They are all variables, and the compiler assigns addresses during the compilation process. Unless you specify, the address is random. This address is the entire addressa
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号