⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.c

📁 较新的adc+lcd1602代码
💻 C
字号:
//ICC-AVR application builder : 2008-11-4 12:53:50
// Target : M16
// Crystal: 8.0000Mhz

#include <iom16v.h>
#include <macros.h>

#include "delay.h"
#include "lcd1602.h"
#include "adc.h"
//call this routine to initialize all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 LCD_init();
 PORTD|=BIT(PD7);
 DDRD|=BIT(PD7);
 
 MCUCR = 0x00;
 GICR  = 0x00;
 TIMSK = 0x00; //timer interrupt sources
 SEI(); //re-enable interrupts
 //all peripherals are now initialized
}

//
void main(void)
{
 unsigned int adc0,adc1;
 init_devices();
 //insert your functional code here...
 LCD_write_string(0,0,"10_Bit ADC Test!");
 delay_nms(2000);
 LCD_write_string(0,0," ADC0:      V   ");
 LCD_write_string(0,1," ADC1:      V   ");
 while(1)
 {
  adc0=GetAdcValue(0);
  LCD_write_adc(7,0,adc0);
  
  adc1=GetAdcValue(1);
  LCD_write_adc(7,1,adc1);
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -