chuckles
- 5th February 2006, 15:50
Hi,
I'm fairly new to PICS and have been working on making my own LCD controller out of a PIC16F84A(I had both the PIC and the 2x16 parallel lcd arleady, and couldn't see spending the $$ on a Serial LCD). I've got my circuit board built, using an 8-bit interface to the LCD. The pic runs at 20MHz.
I am using PBP v2.46, Microcode Studio, and the Melabs USB Programmer
My code for the 16F84A is:
@ DEVICE PIC16F84A, HS_OSC, PWRT_ON, WDT_OFF, PROTECT_OFF
DEFINE OSC 20 ' Set speed to 20MHz
TRISB = %00000000 ' All PORTB pins are outputs
' LCD DEFINES
DEFINE LCD_BITS 8
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4 'PORTB.0 is first data
DEFINE LCD_LINES 2 'Number of lines on LCD to be used
define LCD_RSREG PORTA 'Port used for LCD RS Pin
define LCD_RSBIT 3 'Port Pin used for LCD
define LCD_EREG PORTA 'Port used for LCD E pin
define LCD_EBIT 4 'Port Pin used for LCD E Pin
define LCD_COMMANDUS 2000 'Delay between sending lcd commands
define LCD_DATAUS 50 'Delay time between data sent
SerData VAR word
SerPin VAR PORTA.2
TRISA.2=1
pause 1000
LCDOut $FE, 1 'Clear LCD
pause 20
lcdout $FE, 2 'Return to home position
pause 20
GOTO Start
Start:
SERIN SerPin,6,SerData 'receive data
LCDOut Serdata ' Send to LCD
GOTO Start
END
I have another PIC (16F690) that I have hooked up to my "homemade lcd controller", using serout commands, and I can send data form the 16F690 to the lcd controller without any problems, but one thing that I cannot seem to figure out is how do I send the clear screen command , or any of the other commands that are listed in the PBP manual($FE, ) from the 16F690 to the 16F84A LCD controller?
I'm fairly new to PICS and have been working on making my own LCD controller out of a PIC16F84A(I had both the PIC and the 2x16 parallel lcd arleady, and couldn't see spending the $$ on a Serial LCD). I've got my circuit board built, using an 8-bit interface to the LCD. The pic runs at 20MHz.
I am using PBP v2.46, Microcode Studio, and the Melabs USB Programmer
My code for the 16F84A is:
@ DEVICE PIC16F84A, HS_OSC, PWRT_ON, WDT_OFF, PROTECT_OFF
DEFINE OSC 20 ' Set speed to 20MHz
TRISB = %00000000 ' All PORTB pins are outputs
' LCD DEFINES
DEFINE LCD_BITS 8
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4 'PORTB.0 is first data
DEFINE LCD_LINES 2 'Number of lines on LCD to be used
define LCD_RSREG PORTA 'Port used for LCD RS Pin
define LCD_RSBIT 3 'Port Pin used for LCD
define LCD_EREG PORTA 'Port used for LCD E pin
define LCD_EBIT 4 'Port Pin used for LCD E Pin
define LCD_COMMANDUS 2000 'Delay between sending lcd commands
define LCD_DATAUS 50 'Delay time between data sent
SerData VAR word
SerPin VAR PORTA.2
TRISA.2=1
pause 1000
LCDOut $FE, 1 'Clear LCD
pause 20
lcdout $FE, 2 'Return to home position
pause 20
GOTO Start
Start:
SERIN SerPin,6,SerData 'receive data
LCDOut Serdata ' Send to LCD
GOTO Start
END
I have another PIC (16F690) that I have hooked up to my "homemade lcd controller", using serout commands, and I can send data form the 16F690 to the lcd controller without any problems, but one thing that I cannot seem to figure out is how do I send the clear screen command , or any of the other commands that are listed in the PBP manual($FE, ) from the 16F690 to the 16F84A LCD controller?