📄 main._c
字号:
//ICC-AVR application builder : 2008-4-19 16:50:18
// Target : M16
// Crystal: 8.0000Mhz
#include <iom16v.h>
#include <macros.h>
#include "delay.h"
#include "lcd.h"
#include "KeyScay.h"
void port_init(void)
{
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00; //m103 output only
DDRC = 0x0F;
PORTD = 0x0F;
DDRD = 0xF0;
}
#pragma interrupt_handler int0_isr:2
void int0_isr(void)
{
//external interupt on INT0
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
MCUCR = 0x00;
GICR = 0x40;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
void main(void)
{
unsigned char key_vale;
init_devices();
LCD16xx_init();
LCD16xx_clr(); //显示清屏
delay_nms(100);
LCD16xx_write_string(3,0,"Welcome to");
LCD16xx_write_string(1,1,"SEE MY work");
LCD16xx_write_string(4,2,"By kang");
LCD16xx_write_string(3,3,"2006.04.11");
delay_nms(1000);
LCD16xx_clr(); //显示清屏
delay_nms(500);
while(1)
{
key_vale=key_scay();
LCD16xx_display_onechar(3,0,key_vale);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -