数据类型
数据类型 | 长度 | 范围 |
bit | 1 | 0 -- 1 |
unsigned char | 8 | -128 -- +127 |
[signed] char | 8 | 0 – 255 |
enum | 16 | -32768 -- +32767 |
short | 16 | -32768 -- +32767 |
unsigned int | 16 | 0 – 65535 |
[signed] int | 16 | -32768 -- +32767 |
unsigned long | 32 | 0 – 4294967295 |
[signed] long | 32 | -2147483648 -- +2147583647 |
float | 32 | ±1.175494E-38 -- ±3.402823E+38 |
sbit | 1 | 0 – 1 |
sfr | 8 | 0 -- 255 |
sfr16 | 16 | 0 – 65535 |
字符串长度头文件 |
存储器类型
函数
头文件
#include <REG51.h> //通用89C51头文件
#include <REG52.h> //通用89C52头文件
#include <STC11Fxx.H> //STC11Fxx或STC11Lxx系列单片机头文件
#include <STC12C2052AD.H> //STC12Cx052或STC12Cx052AD系列单片机头文件
#include <STC12C5A60S2.H> //STC12C5A60S2系列单片机头文件
#include <assert.h> //设定插入点
#include <ctype.h> //字符处理
#include <errno.h> //定义错误码
#include <float.h> //浮点数处理
#include <fstream.h> //文件输入/输出
#include <iomanip.h> //参数化输入/输出
#include <iostream.h> //数据流输入/输出
#include <limits.h> //定义各种数据类型最值常量
#include <locale.h> //定义本地化函数
#include <math.h> //定义数学函数
#include <stdio.h> //定义输入/输出函数
#include <stdlib.h> //定义杂项函数及内存分配函数
#include <string.h> //字符串处理
#include <strstrea.h> //基于数组的输入/输出
#include <time.h> //定义关于时间的函数
#include <wchar.h> //宽字符处理及输入/输出
#include <wctype.h> //宽字符分类
#include <intrins.h> //51基本运算(包括_nop_空函数)
常/变量定义
sfr [自定义名] = [SFR地址] ; //按字节定义SFR中的存储器名。例:sfr P1 = 0x90;
sbit [自定义名] = [系统位名] ; //按位定义SFR中的存储器名。例:sbit Add_Key = P3 ^ 1;
bit [自定义名] ; //定义一个位(位的值只能是0或1)例:bit LED;
#define [代替名] [原名] //用代替名代替原名。例:#define LED P1 / #define TA 0x25
unsigned char [自定义名] ; //定义一个0~255的无符号字符型变量。例:unsigned char a;
unsigned int [自定义名] ; //定义一个0~65535的无符号整型变量。例:unsigned int a;
中断
interrupt 0 外部中断0(ROM入口地址:0x03)
interrupt 1 定时/计数器中断0(ROM入口地址:0x0B)
interrupt 2 外部中断1(ROM入口地址:0x13)
interrupt 3 定时/计数器中断1(ROM入口地址:0x1B)
interrupt 4 UART串口中断(ROM入口地址:0x23)
(更多的中断依单片机型号而定,ROM中断入口均相差8个字节)
using 0 使用寄存器组0
using 1 使用寄存器组1
using 2 使用寄存器组2
using 3 使用寄存器组3
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论