main.c
来自「单片机中的ADC模块」· C语言 代码 · 共 49 行
C
49 行
//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 "adc.h"
#include "led.h"
/*call this routine to initialize all peripherals */
void main(void)
{
UNS8 i;
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
led_init(); //7段数码管显示
MCUCR = 0x00;//IO
adc_init();
/*
Set_Bit(PORTE,7);
transmit_byte(0xaa);
delay(10000);
Clr_Bit(PORTE,7);
*/
SEI(); //re-enable interrupts
//all peripherals are now initialized
for(;;)
{
system_protect();
display(adc0_value,0); //普通模式,显示countdata的值,countdata将在timer3定时一秒溢出时改变
//display(adc1_value,1); //补零模式,显示countdata的值,countdata将在timer3定时一秒溢出时改变
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?