Hello, i wan to ask for help.
now i using PIC18F4550 to control a 16x2 LCD.
the code i use is very simple and it is function.
but now i facing a problem since SK40c use the different ports wif my circuit.
- CODE: SELECT_ALL_CODE
#include <18F4550.h>
#fuses XT,NOWDT,NOLVP,NOPROTECT
#use delay (clock=4M)
#include <lcd.c>
#define BUTTON1 PIN_B0
#define BUTTON2 PIN_B1
#define LCD_E PIN_D0
#define LCD_RS PIN_D1
#define LCD_RW PIN_D2
#define LCD_D4 PIN_D4
#define LCD_D5 PIN_D5
#define LCD_D6 PIN_D6
#define LCD_D7 PIN_D7
void main()
{
set_tris_b(0xFF);
output_b(0xFF);
lcd_init();
while(TRUE)
{
if (!input(BUTTON1))
{
lcd_putc("\fBUTTON 1");
}
else if (!input(BUTTON2))
{
lcd_putc("\f");
lcd_putc("\nBUTTON 2");
}
else
{
}
}
}
The SK40c port for lcd is as below
Here is the coding but it is wrong, how is the way for me to control the RS,and E for the LCD?
- CODE: SELECT_ALL_CODE
#include <18F4550.h>
#fuses HS,NOWDT,NOLVP,NOPROTECT
#use delay (clock=20M)
#include "lcd.c"
#define LED1 PIN_B6
#define LED2 PIN_B7
#define SW1 PIN_B0
#define SW2 PIN_B1
#define LCD_RS PIN_B4
#define LCD_E PIN_B5
#define LCD_D0 PIN_D0
#define LCD_D1 PIN_D1
#define LCD_D2 PIN_D2
#define LCD_D3 PIN_D3
#define LCD_D4 PIN_D4
#define LCD_D5 PIN_D5
#define LCD_D6 PIN_D6
#define LCD_D7 PIN_D7
void main()
{
set_tris_b(0x3F);
set_tris_d(0x00);
output_b(0x3F);
output_b(0x00);
lcd_init();
while(TRUE)
{
lcd_putc("\fHello");
}
}