LCD display not working properly
I am trying to write a simple code to enable password entry. I am using 16F877a and two line LCD module for display. I have written following code which gets compiled successfully however when I key in four digits they are not displayed on the LCD module.
OPTION_REG.7 = 0 ' PORTB Pullups.
TrisA = 0 ' PORTA, all outputs
PortA = 16 ' Turn off Buzer
TrisB = %11110000 ' PORTB.0-3 outputs, 4-7 inputs
PortB = 0
Define LCD_DREG PORTC
Define LCD_DBIT 0
Define LCD_RSREG PORTC
Define LCD_RSBIT 4
Define LCD_EREG PORTC
Define LCD_EBIT 5
LD1 var PortA.2
RL1 var PortA.3
BUZ var portA.4
cnt var byte
cnt2 var word
key var byte
col var byte
row var byte
keycnt var byte
pwOK var bit
keybuf var byte[15]
pwbuf var byte[4]
Pause 100 ' Wait for LCD to start
Lcdout $fe, 1, " HELLO " ' Display sign on message
Lcdout $fe, 1, " WORLD " ' Display sign on message
Pause 500 ' Wait for LCD to start
Lcdout $fe, 1, "Enter pasaward " ' Display sign on message
loop: Gosub Chk_KEYPAD: ' Get a key from the keypad
Lcdout $fe, $c0+1,1,$0f, #key ' Display ASCII key number
Gosub Chk_KEYPAD: ' Get a key from the keypad
Lcdout $fe, $c0+2,1,$0f, #key ' Display ASCII key number
Gosub Chk_KEYPAD: ' Get a key from the keypad
Lcdout $fe, $c0+3,1,$0f, #key ' Display ASCII key number
Gosub Chk_KEYPAD: ' Get a key from the keypad
Lcdout $fe, $c0+4,1,$0f, #key ' Display ASCII key number
Goto loop ' Do it forever
keypad.bas does not compile in pbp
Quote:
Originally Posted by
mister_e
NOPE,
if you use 1 without $FE before, it will try to print ASCII decimal character 1, same for $0F. If you want to mask you data with asterix, just use "*" in your lcdout and forget the #key.
MAybe you could find some tips in the following
http://www.picbasic.co.uk/forum/show...mbination+gate
1)I tried to include Keypad.bas and tried to compile however it throws an error for the first line i.e. keypad routine as syntax error. If I remove it throws too many errors! in assembler. Is it not necessary to compile. If I don't compile and compile only gate code it says unable to open keypad.bas
@ if HIGH_SECURITY == 1
LCDOUT $FE, $C4 + ComboPtr, "*" ; print a Mask character
if Key = "*" then Reset
if Key = "#" then Finish
@ endif
The compiler also shows errors for
if Key = "*" then Reset
if Key = "#" then Finish
I tried using diff. combination but to no better effect. Can some one help?
Thank you in advance,
Regards
dilpkan