📄 main.c
字号:
#include <iom128.h>
#include <ina90.h>
#include "TypeDef.h"
#include "lcd.h"
#include "keypad.h"
#define xtal 18
#define bLED_BL1 PORTG_Bit4
#define bLED_BL2 PORTG_Bit3
byte myTitle0[] = "It's a fine day today";
byte myTitle1[] = "Today is Friday and ";
byte myTitle2[] = "tomorrow is Saturday.";
byte myTitle3[] = "The LCD has been test";
byte myTitle4[] = "The next step is for ";
byte myTitle5[] = "testing the keypad,ha";
byte myTitle6[] = " RH-60 VER0.0";
byte myTitle7[] = " DSC 2006/7/7";
void delay_1ms(void)
{
unsigned int i;
for(i=1;i<(unsigned int)(xtal*143-2);i++)
;
}
void delay_ms(unsigned int n)
{
unsigned int i=0;
while(i<n)
{
delay_1ms();
i++;
}
}
void LcdBackLight(byte step)
{
bLED_BL1 = (step & 0x02) ? 1 : 0;
bLED_BL2 = (step & 0x01) ? 1 : 0;
}
void main(void)
{
byte brightness;
byte key;
brightness = 0;
_CLI();
DDRA = 0x00;
DDRB = 0xff; // 0xb0
DDRC = 0xff; // LCD Data
DDRD = 0xff;
DDRE = 0xff;
DDRF = 0xff;
DDRG = 0xff;
PORTB = 0xff;
PORTC = 0xff;
PORTD = 0xff;
PORTE = 0xff;
PORTF = 0xff;
PORTG = 0xff;
MCUCR = 0x00;
TIMSK = 0x00;
_SEI();
LcdBackLight(3);
InitLcd();
LcdClear();
//PutcR_xy(2,3,'x');
Puts(0,0,myTitle0,0);
Puts(0,1,myTitle1,0);
Puts(0,2,myTitle2,0);
Puts(0,3,myTitle3,0);
Puts(0,4,myTitle4,0);
Puts(0,5,myTitle5,0);
Puts(0,6,myTitle6,0);
Puts(0,7,myTitle7,0);
//PutcR_xy(10,4,'8');
while(1)
{
key = KeyCheck();
if (key != 19)
{
Putc_xy(0,0,0x30+key/10);
Putc_xy(1,0,0x30+key%10);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -