*/
// If you use I2C-Type ACM1602, You should define, otherwise #undef.
#undef _USE_I2C_1602
-/*
- * Default values, You should re-define in iodef.h if you need.
- */
-#ifndef _LCDPORT_DATA
-#define _LCDPORT_DATA PORTD
-#define _LCDPORT_TRIS_DATA TRISD
-#define _LCDPORT_LATCH_DATA LATD
-#endif
-
-#ifndef _LCDPORT_CONT
-#define _LCDPORT_CONT PORTE
-#define _LCDPORT_TRIS_CONT TRISE
-#define _LCDPORT_CONT_RS _PORTE_RE0
-#define _LCDPORT_CONT_RW _PORTE_RE1
-#define _LCDPORT_CONT_EN _PORTE_RE2
-#define _LCDPORT_CONT_LATCH LATE
-#endif
/*
* MAP OF IOPORT
* RC5 : SLOT C
* RC3-RC4 : SCL/SDA
* RC6-RC7 : USART
+ * In addition, usage of PARALLEL-LCD,You should use 40Pin(or greater) PIC.
+ * PORTD: RD0-RD7 : LCD DATA(DB0-DB7)
+ * PORTE: RE0: LCD RS
+ * RE1: LCD RW
+ * RE2: LCD EN
+ * RE3: VPP (ICSP Programing Voltage) / MCLR
*/
#define TRIS_A_VAL 0b11111101
#define TRIS_C_VAL_I 0b11011000 /* FOR I2C-WRITE */
#define AN_C_VAL 0b00000000
+#define TRIS_D_VAL 0b00000000 /* FOR OUTPUT, LCD(Optional) */
+#define TRIS_E_VAL 0b00000000 /* FOR OUTPUT, LCD(Optional), PSP=OFF */
+
+
typedef union {
struct {
unsigned BIT0A:1;
charcode_s3, // Reserve
};
+/*
+ * LCD Control: Default register values, You should re-define in iodef.h if you need.
+ */
+#ifndef _LCDPORT_DATA
+#define _LCDPORT_DATA PORTD
+#define _LCDPORT_TRIS_DATA TRISD
+#define _LCDPORT_LATCH_DATA LATD
+#endif
+
+#ifndef _LCDPORT_CONT
+#define _LCDPORT_CONT PORTE
+#define _LCDPORT_TRIS_CONT TRISE
+#define _LCDPORT_CONT_RS _PORTE_RE0
+#define _LCDPORT_CONT_RW _PORTE_RE1
+#define _LCDPORT_CONT_EN _PORTE_RE2
+#define _LCDPORT_CONT_LATCH LATE
+#endif
#ifdef __cplusplus
}
}
#if defined(__18F23K22) || defined(__18F24K22) || defined(__18F25K22) || defined(__18F26K22)
+/*
+ * For 28Pin PIC(18F2xK22), I2C lcd using.
+ */
void keyin_ioinit(void)
{
ANSELC = AN_C_VAL;
TRISC = TRIS_C_VAL_O;
}
-#elif defined(__18F43K20) || defined(__18F44K20) || defined(__18F45K20) || defined(__18F46K20)
+#elif defined(__18F23K20) || defined(__18F24K20) || defined(__18F25K20) || defined(__18F26K20)
+/*
+ * For 28Pin PIC(18F2xK20), I2C lcd using.
+ */
+
+void keyin_ioinit(void)
+{
+ /* Initialize IOPORTS*/
+ PORTA = 0x00;
+ LATA = 0x00;
+ ANSEL = 0x01; // Use RA0 AS ADC, Another is not used.
+ ANSELH = 0x00; //
+ TRISA = TRIS_A_VAL;
+
+ PORTB = 0x00;
+ LATB = 0x00;
+ TRISB = TRIS_B_VAL;
+ PORTC = 0x00;
+ LATC = 0x00;
+ TRISC = TRIS_C_VAL_O;
+}
+
+
+#elif defined(__18F43K20) || defined(__18F44K20) || defined(__18F45K20) || defined(__18F46K20)
+/*
+ * For 40Pin PIC(18F4xK20), paralell or I2C lcd using.
+ */
void keyin_ioinit(void)
{
/* Initialize IOPORTS*/
PORTC = 0x00;
LATC = 0x00;
TRISC = TRIS_C_VAL_O;
+
+ /*
+ * You can use PORTD,RE0-RE2 extention, when using I2C lcd.
+ */
+ PORTD = 0x00;
+ LATD = 0x00;
+ TRISD = TRIS_D_VAL;
+
+ PORTE = 0x00;
+ TRISE = TRIS_E_VAL;
}
#else
void keyin_ioinit(void)
} while(p < 255);
}
+
+/*
+ * Set signal tune status led assigned to RC0.
+ * You should modify if you modify circuit.
+ */
void setsignal_tune(unsigned char flag)
{
if(flag != 0){
}
}
+/*
+ * Set power of lcd backlight assigned to RB0.
+ * You should modify if you modify circuit.
+ */
void set_backlight(unsigned char flag, unsigned int val)
{
if(flag != 0){
/*
- * Read IOPORTS for KEY.
+ * Read IOPORTS for KEY. You should modify if you modify circuit.
*/
void readkey_io(void)
{