大家好,小问来为大家解答以上问题。数码管动态显示程序框图,数码管动态显示程序这个很多人还不知道,现在让我们一起来看看吧!
1、记得给分哦!我这个程序是在ICCVC FOR AVR 那个编译器里编译成功的//ICC-AVR application builder : 2010-3-15 11:14:29// Target : M8// Crystal: 0000Mhz#include #include unsigned char const seg_table[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};void port_init(void){ PORTB = 0xFF; DDRB = 0xFF; PORTC = 0x00; //m103 output only DDRC = 0x00; PORTD = 0x00; DDRD = 0x00;}//call this routine to initialize all peripheralsvoid init_devices(void){ //stop errant interrupts until set up CLI(); //disable all interrupts port_init(); MCUCR = 0x00; GICR = 0x00; TIMSK = 0x00; //timer interrupt sources SEI(); //re-enable interrupts //all peripherals are now initialized}/* 微秒级延时程序 */void delay_us(int time){ do { time--; } while (time>1);} /* 毫秒级延时程序 */ void delay_ms(unsigned int time){ while(time!=0) { delay_us(1000); time--; }}void main(){ unsigned char i; init_devices(); while (1) { for (i=0;i<10;i++) { PORTB=seg_table[i]; delay_ms(100); } } }
以上就是【数码管动态显示程序框图,数码管动态显示程序】相关内容。