📄 lcd.c
字号:
//ICC-AVR application builder : 24.03.2009 19:02:54
// Target : M128
// Crystal: 16.000Mhz
#include <iom128v.h>
#include <macros.h>
#include <eeprom.h>
#define Hi(Int) (char) (Int>>8)
#define Low(Int) (char) (Int)
//RX 100% Bat 3.3
//TX 25mw Bat 25.5
//0123456789ABCDEF
#define BIT7 0x80
#define BIT6 0x40
#define BIT5 0x20
#define BIT4 0x10
#define BIT3 0x08
#define BIT2 0x04
#define BIT1 0x02
#define BIT0 0x01
//PORTE45
#define BEEP_ON (PORTE |= BIT4)
#define BEEP_OFF (PORTE &=~BIT4)
#define TU2_ON (PORTE |= BIT5)
#define TU2_OFF (PORTE &=~BIT5)
//2.6.10.12.13.14.15.16
__flash char mw[16] = {' ','2',' ','5','1','0','1','5','2','0','2','5','3','0','4','0'} ;
#if 0
// *** Set port for LCD Data Bus 8 bit mode *** //
#define LCD_OP_PORT PORTA
#define LCD_IP_PORT PINA
#define LCD_DIR_PORT DDRA
// *** Set LCD Register Select Port and Bit values *** //
#define LCD_RS_PORT PORTC
#define RS_BIT BIT5
// *** Set LCD Read/Write Port and Bit values *** //
#define LCD_RW_PORT PORTC
#define RW_BIT BIT6
// *** Set LCD Enable Port and Bit values *** //
#define LCD_EN_PORT PORTC
#define EN_BIT BIT7
#endif
volatile unsigned char *LCD_EN_PORT = &PORTC;
volatile unsigned char *LCD_DIR_PORT = &DDRA;
volatile unsigned char *LCD_IP_PORT = &PINA;
volatile unsigned char *LCD_OP_PORT = &PORTA;
volatile unsigned char *LCD_RS_PORT = &PORTC;
volatile unsigned char *LCD_RW_PORT = &PORTC;
char LCD_RS_BIT = BIT(5);
char LCD_RW_BIT = BIT(6);
char LCD_EN_BIT = BIT(7);
#define SET_LCD_E *LCD_EN_PORT |= LCD_EN_BIT
#define CLEAR_LCD_E *LCD_EN_PORT &= ~LCD_EN_BIT
#define SET_LCD_DATA *LCD_RS_PORT |= LCD_RS_BIT
#define SET_LCD_CMD *LCD_RS_PORT &= ~LCD_RS_BIT
#define SET_LCD_READ *LCD_RW_PORT |= LCD_RW_BIT
#define SET_LCD_WRITE *LCD_RW_PORT &= ~LCD_RW_BIT
#define BUTTON_1 (!(PIND&0x80))
#define BUTTON_2 (!(PIND&0x40))
#define BUTTON_3 (!(PIND&0x20))
#define LCD_ON 0x0C
#define LCD_CURS_ON 0x0D
#define LCD_OFF 0x08
#define LCD_HOME 0x02
#define LCD_CLEAR 0x01
#define LCD_NEW_LINE 0xC0
#define LCD_FUNCTION_SET 0x38
#define LCD_MODE_SET 0x06
//镥疱桁屙钼囗桢 潆
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -