- //==================================================
- const unsigned char seg[]={ 0xC0, // 0
- 0xF9, // 1
- 0xA4, // 2
- 0xB0, // 3
- 0x99, // 4
- 0x92, // 5
- 0x82, // 6
- 0xF8, // 7
- 0x80, // 8
- 0x90 // 9
- };
- //==================================================
- //IO端口初始化
- void PortInit(void)
- {
- DDRA=0XFF;
- PORTA=0XFF;
- DDRB=0XFF;
- PORTB=0XFF;
- DDRC=0XFF;
- PORTC=0XFF;
- DDRD=0x00;
- PORTD=0XFF;
- //set_bit(PORTA,PA0);
-
-
- }
- //Timer0初始化
- void Timer0Init(void)
- {
- TCCR0 = 0x00; //stop
- TCNT0 = 0x06; //set count
- OCR0 = 0xFA; //set compare
- TCCR0 = 0x03; //start timer
- }
- void int_init(void)//配置外部中断
- {
- MCUCR |= 0x05;
- MCUCSR|= 0x00;
- GICR |= 0xC0;
- }
|