📄 main._c
字号:
/************************************************
文件:main.c
用途:
注意:内部8M晶振
创建:2008.4.1
修改:2008.4.1
Copy Right (c) www.avrvi.com AVR与虚拟仪器
************************************************/
#include "config.h"
volatile unsigned int countnum=0;
void timer1_init(void)
{
TCCR1B = 0x00; //stop
TCNT1H = 0x8F; //setup
TCNT1L = 0x81;
OCR1AH = 0x70;
OCR1AL = 0x7F;
OCR1BH = 0x70;
OCR1BL = 0x7F;
OCR1CH = 0x70;
OCR1CL = 0x7F;
ICR1H = 0x70;
ICR1L = 0x7F;
TCCR1A = 0x00;
TCCR1B = 0x04; //start Timer
}
#pragma interrupt_handler timer1_ovf_isr:15
void timer1_ovf_isr(void)
{
TCNT1H = 0x8F; //reload counter high value
TCNT1L = 0x81; //reload counter low value
countnum++;
if(countnum>9999) countnum=0;
}
void init_devices(void)
{
CLI(); //disable all interrupts
timer1_init();
TIMSK = 0x04; //timer interrupt sources
SEI(); //re-enable interrupts
}
void main(void)
{
init_devices();
HC_595_init();
while(1)
{
//Seg7_Led_display(countnum);
Seg7_Led_float(25.13);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -