AVR128的程序——数码管时钟显示
#include
#define uchar unsigned char
#define uint
void timer1_init(void);
void display1(uchar FirstBit,uchar Num);
void display2(uchar FirstBit,uchar Num);
void display3(uchar FirstBit,uchar Num);
void display4(uchar FirstBit,uchar Num);
void Delayms(uint MS);
uchar TempData1[8];
uchar TempData2[8];
uchar TempData3[8];
uchar WeiMa[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar led_discode[11]={0xc0,0xf9,0xa4,0xb0,0x99,
uchar temp=0x01;
uint num=0,fen=19,shi=20;
void main(void)
{
DDRA=0XFF;
PORTA=0XFF;
DDRC=0XFF;
PORTC=0XFF;
DDRF|=0X0E;
PORTF|=0X0E;
PORTF&=0xF7;
DDRB |=0X10;
PORTB|=0X10;
timer1_init();
SEI();
{
display1(6,2);
display2(3,2);
display3(0,2);
display4(2,1);
display4(5,1);
}
}
void timer1_init(void)
{
}
#pragma interrupt_handler timer1_ovf_isr:15
void timer1_ovf_isr(void)
{
TCNT1H = 0xE1;
if(num==60)
{
fen++;
if(fen==60)
{
shi++;
if(shi==24)
{
}
}
}
}
void display1(uchar FirstBit,uchar Num)
{
for(i=0;i
{
PORTC=led_discode[10];
Delayms(2);
}
}
void display2(uchar FirstBit,uchar Num)
{
for(i=0;i
{
PORTC=led_discode[10];
Delayms(2);
}
}
void display3(uchar FirstBit,uchar Num)
{
for(i=0;i
{
PORTC=led_discode[10];
Delayms(2);
}
}
void display4(uchar FirstBit,uchar Num)
{
for(i=0;i
{
PORTC=led_discode[10];
Delayms(2);
}
}
void Delayms(uint MS)
{
}
AVR128数码管时钟显 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)