sbit is a bit variable that defines a special function register. Both bit and sbit are variable types extended by C51.
Typical application is: sbit P0_0=P0^0;//That is, define P0_0 as the first bit of the P0 port for bit operations. (Recommended learning: PHP video tutorial)
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.
Usage
In C language, if you write P1.0 directly, the C compiler will not recognize it, and P1.0 is not a legal C language variable. name, so we have to give it another name. The name here is P1_0, but is P1_0 the same as P1.0? You think so, but the C compiler doesn't think so, so they must be connected. The Keil C keyword sbit is used here to define it. There are three ways to use sbit:
The first method: sbit bit variable Name = address value
The second method: sbit bit variable name = SFR name ^ variable bit address value
The third method: sbit bit variable name = SFR address value ^ variable bit address Value
For example, the following three methods can be used to define OV in PSW:
sbit OV=0xd2 (1) Description: 0xd2 is the bit address value of OV
sbit OV =PSW^2 (2) Note: PSW must be defined with sfr first
sbit OV=0xD0^2 (3) Note: 0xD0 is the address value of PSW
, so sbit is used here P1_0=P1^0; is defined to use the symbol P1_0 to represent the P1.0 pin. If you want, you can also give it a name like P10, as long as you change it in the following program.
sbit must be defined at the outermost level, which means it must be defined as an external variable. sbit defines the bit of the SFR (Special Function Register)
sbit is the corresponding bit A bit in the addressable space, bit addressable area: 20H~2FH. Once a definition like sbit xxx = REGE^6 is used, this sbit quantity determines the address. sbit is mostly used in registers to facilitate operations on a certain bit of the register.
The sbit bit register is a bit-addressable absolute address target. The compiler will not change the location after definition.
For more PHP related technical articles, please visit the PHP Graphic Tutorial column to learn!
The above is the detailed content of What does sbit mean?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
