Problems with ELabs EDE1188 keypad encoder

westaust55

Moderator
I have assembled as small circuit board using a E-Labs EDE-1188 keypad encoder.
Hardware wise, the circuit is working but it seems that the EDE1188 chip is not providing values as per the datasheet. :confused:

I first tried a small program as follows:

init: b0=0
b1=0
setint %00000000, %00000010 ; check for pin 1 going to low state
serout 7, N2400, (254,1) ; clear screen
pause 1000
serout 7, N2400, ("@") ; just so we do not have a blank screen
main: pause 10
if b1=0 then main
serout 7, N2400, (#b1) ; display the variable value as an ascii string
pause 10
serout 7, N2400, ("-") ; a spacer between each number displayed
b1=0
goto main
interrupt: serin 0, N2400,b1 ; here on interrupt when Valid Data signal at pin 1. Actual value from pin 0
setint %00000000, %00000010 ; restore the polled interupt
return

The results were that only about half the values (those in the range 3 to 63) were displayed. See attached spreadsheet. :mad:

I then modified the program to allow a value of zero to be displayed. To prevent a continual stream of zeros to the LCD module I moved the lines to display the variable value into the interrupt routine. The revised program code was:

init: b0=0
setint %00000000, %00000010
serout 7, N2400, (254,1) ; clear screen
pause 1000
serout 7, N2400, ("@")
main: b1=0
pause 10
goto main

interrupt: serin 0, N2400,b1
serout 7, N2400, (#b1)
pause 10
serout 7, N2400, ("-")
setint %00000000, %00000010
return

The revised code displayed a total of the 64 values but instead of having swequential values 1 to 64 as per the datasheet, I have 64 values in the range 0 to 127. :mad: See second table in the attached file.

I emailed E-Labs in the US directly who came back with the response:
Yes, I see the problem. First, I must point out that there is an error in the EDE1188 datasheet. It states that outputs are from 1 to 64. This is incorrect; they are actually from 0 to 63. This error will be corrected shortly.

However, your table appears to be exactly correct, witht he one exception that your bits are inverted. If you toggle your 1's for 0's you will notice that your third table does indeed count from 0 to 63.​

Is was a disappointment that the output codes are intended to be 0 to 63 and not 1 to 64 as per the current datasheet, as I was hoping to:

(a) use 0 to skip any further processing, and

(b) to use the value 64 (since it is unique as only key having bit 6 set) as a latching “sticky” SHIFT flag by XOR’ing each time the value 64 was received. Then all I would have needed to do was to OR the other keypress values with the sticky SHIFT value to very quickly get the range of values from 1 to 127 to cover almost a complete set of alphanumeric values plus most punctuation/symbols on a standard keyboard using a very compact 48 button keypad configuration with 94 discrete values.

Nor are the values received at the PICAXE sequential as the datasheet suggests (See first table in the attached file). :mad:

Now maybe my aging PC (brain) is failing, because for the life of me I cannot see how to toggle bits consistently across all words as suggested by the chip manufacturer so all values are in the range 0 to 63.

I have gone back to the Australian supplier of the EDE-1188 chip and direct to E-Labs in the US but no further response overnight.

So my questions are:

1. Can anyone see/explain why the first program I wrote will not show values higher than 63 whereas the second program does. Both programs were consistent in their output to the LCD module. Note that after about 8 keypresses I reset the PICAXE each time to clear the screen?

2. Can anyone explain how I can toggle a consistent number of bits in every value to get 64 all values in the range 0 to 63?

I will be away from my PICAXE system over the weekend (but with forum access) so unable to try new code till next week but all thoughts are gratefully accepted.
 

Attachments

hippy

Ex-Staff (retired)
My first suggestion would be to trim the code to the bare minimum. Forget about the LCD, concentrate on the keyboard and use the Programming Editor Terminal for debugging display. This is much more flexible than trying to format things up for LCD's with their awkward timings etc. And don't use interrupts unless you have to, it's just another level of complication, and delays in responding to interrupts can cause all sorts of problems.

I came up with this ...

Code:
Do
  SerIn 0, N2400, b0
  SerTxd( #Bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0," ",#b0,CR,LF)
Loop
Once that's working, I'd move on to this ...

Code:
Do
  Do : Loop Until Pin1 = 1
  Do : Loop Until Pin1 = 0
  SerIn 0, N2400, b0
  SerTxd( #Bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0," ",#b0,CR,LF)
Loop
Only after that would I move to interruputs ...

Code:
SetInt %00000000, %00000010
Do : Loop 

Interrupt:
  SerIn 0, N2400, b0
  SerTxd( #Bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0," ",#b0,CR,LF)
  SetInt %00000000,%00000010
  Return
I then went and found the manual ...

http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=321701

According to that, the serial output can be connected directly to a microcontroller UART and via a MAX232-type interface to a PC. That implies the serial output is idle high, active low, and thus it needs a T2400 baud rate not an N2400 baud rate.

Try the code examples above, then using T2400 and see what happens.
 
Last edited:

westaust55

Moderator
I then went and found the manual ...

According to that, the serial output can be connected directly to a microcontroller UART and via a MAX232-type interface to a PC. That implies the serial output is idle high, active low, and thus it needs a T2400 baud rate not an N2400 baud rate.

Try the code examples above, then using T2400 and see what happens.
Thanks Hippy,
I had tried the non inverted serial data input with T2400 very early in my problems when only half the data was displayed. At that time I got no input as a result.
Having re-built the circuit (on a breadboard) in case of wiring error I started getting 64 discrete values but had not tried the T2400 option in place of the inverted input.

Will give your suggestions a trial as soon as possible.


As the mentioned MAX232 type devices incorporate inverting buffers I presume PC's externally require inverted signals but microcontrollers do not.
 
Last edited:

westaust55

Moderator
Keypad Encoder now working

Yahoo . . . :)

Thanks to Hippy's comment about not inverting the data signal, I managed to squeeze in a few seconds to test out using the code:

Code:
init: b0=0 
setint %00000000, %00000010
serout 7, N2400, (254,1) ; clear screen
pause 1000 
serout 7, N2400, ("@")
main: b1=0
pause 10
goto main

interrupt: serin 0, [B]T[/B]2400,b1  ' <----- changed [B]N[/B]2400 to [B]T[/B]2400
serout 7, N2400, (#b1)    
pause 10
serout 7, N2400, ("-")
setint %00000000, %00000010
return
This is working perfectly so I now get the right values read in with a consecutive range from zero (0) to 63.

Have assembled a small circuit board based on a piece of commercial proto-board ready to interface to my PICAXE board. Have attached a photo of complete board.
 

Attachments

Last edited:
Top