|
各位大神好!小弟刚开始学单片机,什么都不太会,刚处于初级自学阶段,有个程序想请教各位大神~~(很2很无语的问题~不过小弟刚学真心不懂,只有请教神坛的各位大神了),程序如下:
#include <reg52.h>
unsigned char code shiwei_P3[] = {0x17,0x01,0x0e,0x0b,0x19,0x1b,0x1f,0x01,0x1f,0x1b};
unsigned char code shiwei_P2[] = {0x30,0x20,0x30,0x30,0x20,0x10,0x10,0x30,0x30,0x30};
unsigned char code gewei_P1[] = {0xef,0x29,0xdd,0x7d,0x3b,0x77,0xf7,0x2d,0xff,0x7f};
unsigned int i;
unsigned int num = 0;
void Delay_xs();
void main(){
TMOD = 0x01; //定时器工作方式:定时器0工作方式1
TH0 = (65536-20000)/256; //定时60ms初值
TL0 = (65536-20000)%256;
EA = 1; //开总中断
ET0 = 1; //开定时器0中断
TR0 = 1; //启动定时器0
for(i=99;i>0;i--){
P1 = shiwei_P3[i/10];
P2 = shiwei_P2[i/10];
P3 = gewei_P1[i%10];
Delay_xs();
if(i == 1){
i = 99;
}
}
}
/*定时1分钟:num == 1000;*/
void Delay_xs() interrupt 1{
TH0 = (65536-20000)/256; //重装初值
TL0 = (65536-20000)%256;
num++;
if(num == 3500){ //定时3分30秒
num = 0;
}
}
问:我怎样才能把这个定时3分30秒的中断放进那个P1,P2,P3口显示的里面?本人只会用delay();来做延时~~先谢过了! |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|