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

📄 lcd_m8._c

📁 AVR ICC基于AVR MEGA8单片机的LCD程序!
💻 _C
字号:
#include <iom16v.h>
#include <macros.h>
#include <stdlib.h>
#include <eeprom.h>
#include <math.h>
#include "head.h"
#include "lcd.h"





void port_init(void)
{
 PORTA = 0x00;
 DDRA  = 0xFF;
 PORTB = 0x00;
 DDRB  = 0x00;
 PORTC = 0x00; //m103 output only
 DDRC  = 0xFF;
 PORTD = 0x00;
 DDRD  = 0x00;
}

//Watchdog initialize
// prescale: 256K
void watchdog_init(void)
{
 WDR(); //this prevents a timout on enabling
 WDTCR = 0x0C; //WATCHDOG ENABLED - dont forget to issue WDRs
}

//call this routine to initialize all peripherals
void init_devices(void)
{
 //stop errant interrupts until set up
 CLI(); //disable all interrupts
 port_init();
 watchdog_init();
 
 MCUCR = 0x00;
 GICR  = 0x00;
 TIMSK = 0x00; //timer interrupt sources
 SEI(); //re-enable interrupts
 //all peripherals are now initialized
}

void main(void)
{
char i;
unit k;
 uchar flash *p1[]={hz_wo,hz_ai,hz_yan,hz_shan,hz_da,hz_xue,NULL};	
delay(100);
init_devices(); 

initlcd();

delay(1000);

while(1)
{
dis_5(1,0,k++);
i=dis_hz_row(16,1,p1);
disen_row(1,3,"I Love You @>-+");
dis_en_row(1,5," all peripherals are now initialized..");


}
}



⌨️ 快捷键说明

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