银行的叫号系统程序c语言,双51单片机银行叫号系统源程序+Proteus仿真

#include

#include

#include "uart.h"

#include

#include "12864.h"

#include "tcs_resource.h"

unsigned char hour = 23;

unsigned char mnt = 59;

unsigned char sec = 50;

sbit KEY1 = P1^0;

sbit KEY2 = P1^1;

void delay(uint ms);

void button();

void Delay10ms(uchar u);

void Timer0Init(void);

void show(void);

void main(void)

{

num=0;

TMOD=0x01;

EA = 1;                        //开总中断

ES = 1;                        //串口中断标志位

Timer0Init();

UartInit();

choose12864(2);                //选择为全屏操作

init12864();                //初始化12864

clear12864();                //清屏

while(1)

{

show();

button();

}

}

void show(void)

{

char j = 0;

play8(0,0,2,letter[13]);

play8(0,1,2,letter[20]);

play8(0,2,2,letter[22]);

play8(0,3,2,fuhao[0]);

play8(0,4,2,Number[Number1/10]);

play8(0,5,2,Number[Number1%10]);

play8(1,0,2,letter[22]);

play8(1,1,2,letter[15]);

play8(1,2,2,fuhao[0]);

play8(1,3,2,Number[num/10]);

play8(1,4,2,Number[num%10]);

//显示时分秒

play8(0,3,1,Number[hour/10]);

play8(0,4,1,Number[hour%10]);

play8(0,5,1,fuhao[1]);

play8(0,6,1,Number[mnt/10]);

play8(0,7,1,Number[mnt%10]);

play8(1,0,1,fuhao[1]);

play8(1,1,1,Number[sec/10]);

play8(1,2,1,Number[sec%10]);

}

void button()

{

if(KEY1==0)

{

delay(5);

if(KEY1==0)

{

Number1++;

num=Number1-1;

choose12864(2);        //选择为全屏显示

init12864();                //初始化12864

clear12864();

Delay10ms(1);

while(KEY1==0);

send();

}

}

}

void delay(uint ms)

{

uint i,j;

for(i=ms;i>0;i--)

for(j=110;j>0;j--);

}

void Delay10ms(uchar u)

{

unsigned char i, j;

i = 108;

j = 145;

while(u--)

{

do

{

while (--j);

} while (--i);}

}

void Timer0Init(void)                //62毫秒@11.0592MHz

{

TMOD |= 0x01;

ET0 = 1;

TR0 = 1;                //定时器0开始计时

}

void T0ISR() interrupt 1

{

static char n = 0;

TH0=(65536-62500)/256;//在65.536ms定时器允许的最大范围内取最大值,1000/n=62.5ms,n=16

TL0=(65536-62500)%256;

n++;

if(n>15)

{

n = 0;

sec++;

if(sec>59)

{

sec = 0;

mnt++;

if(mnt>59)

{

mnt = 0;

hour++;

if(hour>23)

hour = 0;

}

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值