点阵调试(附程序)
#include
#include
#define uchar unsigned char
#define uint unsigned int
//端口定义;
sbit DS = P1^0;
sbit OE = P1^1;
sbit ST_CP = P1^2;
sbit SH_CP
sbit MR = P1^4;
uchar time=0;
uchar flag=0;
void delayS(uchar ms)
{
uchar x,y;
for(x=ms;x--;x>0)
}
static void timer0_initialize(void)
{
}
//函数声明;
void HC595_CD(uint Value); //595驱动函数;
void main()
{
uint i = 0;
//P2=tableLie[0];
//HC595_CD(tableHng[0]);
//uint Value;
//P2=0xfd;
//Value = 0x01;
//HC595_CD(Value);
timer0_initialize();
while(1)
{
{
HC595_CD(tableHng[i]);
}
{
HC595_CD(table1[i]);
}
{
HC595_CD(table2[i]);
}
{
HC595_CD(table3[i]);
}
{
HC595_CD(table4[i]);
}
{
HC595_CD(table5[i]);
}
{
HC595_CD(table6[i]);
}
{
HC595_CD(table7[i]);
}
{
HC595_CD(table8[i]);
}
{
HC595_CD(table9[i]);
}
}
}
static void timer0_isr(void) interrupt 1 //定时器里避免放大的延时函数 以免发生错误
{
time++;
TR0=0;
TL0=(0X78);
TH0=(0X0C);
TR0=1;
if(time==50)
{
}
}
//74HC595驱动函数;
//功能:把输入的数据输出到对应的引脚上;
//输入函数:Value
void HC595_CD(uint Value)
{
uint
OE = 1; //芯片输出关闭;
MR = 0; //IC复位;
MR = 1; //复位结束;
for(i = 0; i < 8; i++) //传送8位数据;
{
DS = Value&0x01; //并行数据转串行;
SH_CP = 0; //移位寄存器时钟为0;
ST_CP = 0; //存储寄存器时钟为0;
_nop_();
_nop_();
_nop_(); //短延时;
_nop_();
Value >>= 1; //数据移位;
SH_CP = 1; //产生移位脉冲;
ST_CP = 1;
}
OE
}
点阵调 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)