📄 main._c
字号:
//ICC-AVR application builder : 2007-8-13 15:05:41
// Target : M128
// Crystal: 7.3728Mhz
#include <iom128v.h>
#include <macros.h>
#include "port.h"
#include "led.h"
#include "stdtypes.h"
UNS8 counter;
UNS8 num;
/*call this routine to initialize all peripherals */
void main(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
XDIV = 0x00; //xtal divider
XMCRA = 0x00; //external memory
port_init();
led_init(); //7段数码管显示
MCUCR = 0x00;
EICRA = 0x00; //extended ext ints
EICRB = 0x00; //extended ext ints
EIMSK = 0x01;
TIMSK = 0x00; //timer interrupt sources
ETIMSK = 0x00; //extended timer interrupt sources
counter=0;
num=0;
SEI(); //re-enable interrupts
//all peripherals are now initialized
for(;;)
{
display(num,0); //普通模式,显示countdata的值,countdata将在timer3定时一秒溢出时改变
//display(num,1); //补零模式,显示countdata的值,countdata将在timer3定时一秒溢出时改变
}
}
#pragma interrupt_handler int0_isr:2
void int0_isr(void)
{
//external interupt on INT0
counter++;
if(counter==0xFF)
{
counter=0;
num++;
if(num==0xFF)
num=0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -