Code: Select all
Device = 18F2520
Clock = 32
Config OSC = INTIO67
Dim KeyVal, Counter As Byte
#option KEYPAD_PORT = PORTB
#option LCD_DATA = PORTC.4
#option LCD_RS = PORTC.2
#option LCD_EN = PORTC.3
Include "IntOSC8PLL.bas"
Include "Keypad.bas"
Include "LCD.bas"
Include "Convert.bas"
OSCTUNE.6 = 1
DelayMS(200)
LCD.Cls
LCD.WriteAt(1,1,"Test Begin")
Counter = 0
While True
Repeat
KeyVal = Keypad.Value
until KeyVal = 16
inc(Counter)
LCD.WriteAt(2,1,"Key: ",DecToStr(KeyVal,2), " Cnt: ",DecToStr(Counter,2))
DelayMS(10)
Repeat
Until Keypad.Value = 0
Wend
I can confirm this behaviour with both Proteus and with a real life circuit.
A counter (as shown above) was added to help confirm that the problem does in fact exist. As it turns out, the error occurs on every 2-3rd key press. Here's a video of the simulation with the circuit and code; note that key 16 is button "+" on that particular model in ISIS.
Am I missing something simple here, or is there a bug with the library?