原创 74HC573扫描显示(电子表项目)

2009-6-28 19:01 2874 6 6 分类: MCU/ 嵌入式

#ifndef __74hc573__h_
#define __74hc573__h_


//锁存74HC573信号为定义 扫描字符段。11脚当为高电平时移位,低电平锁存控制 9脚输出使


能端,低电平有效
sbit D3CS=P2^0;//输出扫描3组3位数码管 分别是cal/incline、speed、pause\distance
sbit D2CS=P1^5;  //输出控制扫描一个4位数码管。显示TIMER窗口


sbit D0CS=P2^1;  //74HC573输出控制8*8点阵窗口左上
sbit D1CS=P2^6;   //74HC573输出控制8**点阵窗口左下
sbit D4CS=P2^3;   //74HC573输出控制8**点阵窗口右上
sbit D5CS=P2^5;   //74HC573输出控制8**点阵窗口左下
//控制数码管位点阵列
sbit Selcs="P2"^7;   选通该74HC573 输出扫描字符位


//并行数据输入端口定义
#define PORT0_DATA  P0
uchar disbuffer[3];
//段码定义(TIMER、cal/incline、speed、pause\distance)
unsigned char code seg[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf};
                          //0   1    2    3    4    5    6    7    8    9    *


//4个8*8点阵代码定义
#define  num  sizeof(table) //代码长度
unsigned char code table[]= {
/*--  宽度x高度=16x16  --*/
0x00,0x00,0x00,0x00,0x00,
0x00,0x42,0x7E,0x42,0x00,0x00,0x00,0x7E,0x40,0x40,0x00,0x7E,0x42,0x7E,0x00,0x3E,
0x40,0x3E,0x00,0x7E,0x52,0x52,0x00,0x00,0x00,0x0E,0x70,0x0E,0x00,0x7E,0x42,0x7E,
0x00,0x7E,0x40,0x7E,0x00,0x00,0x00,0x42,0x7E,0x40,0x00,0x52,0x52,0x7E,0x00,0x42,
0x7E,0x40,0x18,0x14,0x7E,0x10,0x00,0x1C,0x22,0x44,0x22,0x1C,0x00,0x00,0x3C,0x42,
0x4A,0x62,0x4A,0x42,0x3C,0x00,0x00,0x7E,0x10,0x7E,0x00,0x7C,0x12,0x7C,0x00,0x7E,
0x0A,0x0E,0x00,0x7E,0x0A,0x0E,0x00,0x0E,0x70,0x0E,0x00,0x00,0x00,0x7E,0x04,0x18,
0x20,0x7E,0x00,0x7E,0x52,0x52,0x00,0x3E,0x40,0x7E,0x40,0x3E,0x00,0x00,0x00,0x0E,
0x70,0x0E,0x00,0x7E,0x52,0x52,0x00,0x7C,0x12,0x7C,0x00,0x7E,0x1A,0x6E,0x00,0x00,
0x72,0x52,0x5E,0x00,0x7E,0x42,0x7E,0x00,0x7E,0x42,0x7E,0x00,0x5E,0x52,0x7E,0x00,
0x08,0x08,0x08,0x00,0x7E,0x42,0x7E,0x00,0x72,0x52,0x5E,0x00,0x08,0x08,0x08,0x00,
0x7E,0x42,0x7E,0x00,0x42,0x7E,0x40,0x00,0x00,0x00,0x42,0x7E,0x40,0x00,0x52,0x52,
0x7E,0x00,0x24,0x00,0x18,0x14,0x7E,0x10,0x00,0x5E,0x52,0x7E,0x00,0x00,0x00,0x0C,
0x02,0x4C,0x40,0x4C,0x02,0x0C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00};


//扫描显示 (并口入-并口出扫描)循环四次,及把要显示的数据放4位数码管上显示
void send_time(ucar data)
{
     uchar i;
for(i=3;i>0;i--)
{
     disbuffer[0]=data/1000
     *Dptr++;
     port1<<1;
}
}
//扫描显示 (并口入-并口出扫描)循环四次,及把要显示的数据放3位数码管上显示
void send_cal(ucar data)
{
     uchar i;
for(i=2;i>0;i--)
{
     disbuffer[0]=data/1000
     *Dptr++;
     port1<<1;
}
}
#endif

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
6
关闭 站长推荐上一条 /3 下一条