43 #define RS_HIGH() _LATB9 = 1
44 #define RS_LOW() _LATB9 = 0
45 #define CONFIG_RS() CONFIG_RB9_AS_DIG_OUTPUT()
47 #define RW_HIGH() _LATB13 = 1
48 #define RW_LOW() _LATB13 = 0
49 #define CONFIG_RW() CONFIG_RB13_AS_DIG_OUTPUT()
51 #define E_HIGH() _LATB14 = 1
52 #define E_LOW() _LATB14 = 0
53 #define CONFIG_E() CONFIG_RB14_AS_DIG_OUTPUT()
61 #define CONFIG_LCD4_AS_INPUT() CONFIG_RB5_AS_DIG_INPUT()
62 #define CONFIG_LCD5_AS_INPUT() CONFIG_RB6_AS_DIG_INPUT()
63 #define CONFIG_LCD6_AS_INPUT() CONFIG_RB7_AS_DIG_INPUT()
64 #define CONFIG_LCD7_AS_INPUT() CONFIG_RB8_AS_DIG_INPUT()
66 #define CONFIG_LCD4_AS_OUTPUT() CONFIG_RB5_AS_DIG_OUTPUT()
67 #define CONFIG_LCD5_AS_OUTPUT() CONFIG_RB6_AS_DIG_OUTPUT()
68 #define CONFIG_LCD6_AS_OUTPUT() CONFIG_RB7_AS_DIG_OUTPUT()
69 #define CONFIG_LCD7_AS_OUTPUT() CONFIG_RB8_AS_DIG_OUTPUT()
71 #define GET_BUSY_FLAG() LCD7I
83 CONFIG_LCD4_AS_OUTPUT();
84 CONFIG_LCD5_AS_OUTPUT();
85 CONFIG_LCD6_AS_OUTPUT();
86 CONFIG_LCD7_AS_OUTPUT();
90 void configBusAsInLCD(
void) {
91 CONFIG_LCD4_AS_INPUT();
92 CONFIG_LCD5_AS_INPUT();
93 CONFIG_LCD6_AS_INPUT();
94 CONFIG_LCD7_AS_INPUT();
99 void outputToBusLCD(
uint8_t u8_c) {
101 LCD5O = (u8_c >> 1)& 0x01;
102 LCD6O = (u8_c >> 2)& 0x01;
103 LCD7O = (u8_c >> 3)& 0x01;
107 void configControlLCD(
void) {
140 u8_wdtState = _SWDTEN;
146 u8_BusyFlag = GET_BUSY_FLAG();
150 }
while (u8_BusyFlag);
151 _SWDTEN = u8_wdtState;
156 if (u8_DataFlag) RS_HIGH();
158 outputToBusLCD(u8_Cmd >> 4);
161 outputToBusLCD(u8_Cmd);
167 #define GOTO_LINE1() writeLCD(0x80,0,1,1)
168 #define GOTO_LINE2() writeLCD(0xC0,0,1,1)
169 #define GOTO_LINE3() writeLCD(0x94,0,1,1)
170 #define GOTO_LINE4() writeLCD(0xD4,0,1,1)
175 writeLCD(0x20,0,0,0);
176 writeLCD(0x28,0,0,1);
177 writeLCD(0x28,0,0,1);
178 writeLCD(0x06,0,0,1);
179 writeLCD(0x0C,0,0,1);
180 writeLCD(0x01,0,0,1);
185 void outStringLCD(
char *psz_s) {
187 writeLCD(*psz_s, 1, 1,1);
200 outStringLCD(
"Line 1");
202 outStringLCD(
"Line 2");
204 outStringLCD(
"Line 3");
206 outStringLCD(
"Line 4");