谁能帮我注释下这段单片机C语言程序

来源:百度知道 编辑:UC知道 时间:2024/06/01 07:57:29
#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int

sbit DS_595 = P2^1;
sbit SH_595 = P2^0;
sbit ST_595 = P2^2;

uchar i;
uchar LedBuf[16][2]={
0x02,0x40,0x0F,0x40,0x70,0x40,0x29,
0x40,0x2A,0x40,0x7F,0x40,0x02,0x40,
0x0C,0x40,0x08,0x40,0x0B,0x40,0x0C,
0x40,0x38,0x42,0xC8,0x42,0x08,0x42,
0x28,0x3E,0x10,0x00};

uchar ledbitselect;
void InitSerialPort(void)
{
DS_595 = 0;
SH_595 = 0;
ST_595 = 0;
}
void InitSFR(void)
{
TMOD = 0x11;
TH0 = 0xd8;
ET0 = 1;
EA =1;
TR0 = 1;
}
void SerialSendData(uchar dat)
{
uchar i;
uchar sdata=dat;
for(i=0;i<8;i++)
{
if(sdata&0x80)
DS_595=1;
else
DS_595 = 0;
sdata<<=1;
SH_595 = 0;
_nop_();
_nop_();
SH_595 = 1;
_n

这个蕊片没用过,试试看吧
谁能帮我注释下这段单片机C语言程序
悬赏分:0 - 离问题结束还有 14 天 19 小时
#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int

sbit DS_595 = P2^1;
sbit SH_595 = P2^0;
sbit ST_595 = P2^2;

uchar i;
uchar LedBuf[16][2]={
0x02,0x40,0x0F,0x40,0x70,0x40,0x29,
0x40,0x2A,0x40,0x7F,0x40,0x02,0x40,
0x0C,0x40,0x08,0x40,0x0B,0x40,0x0C,
0x40,0x38,0x42,0xC8,0x42,0x08,0x42,
0x28,0x3E,0x10,0x00}; // 要发送的数据组成的数组

uchar ledbitselect;
void InitSerialPort(void)
{
DS_595 = 0; // 这个应该是数据线
SH_595 = 0; // 这个应该是时钟线
ST_595 = 0; // 这个不懂干嘛用的
}
void InitSFR(void)
{
TMOD = 0x11; // 设置T0,T1为工作方试1
TH0 = 0xd8; // 给T0高8位装初值,但奇怪没见给低8位 TL0 装初值
ET0 = 1; // 开定时器0中断
EA =1; // 开总中断
TR0 = 1; // 启动定时器0
}
void SerialSendData(uchar dat)
{
uchar i;
uchar sdata=dat;