Page 1 of 1

GLK12232-25 WBL I2C Keypad

Posted: Mon Aug 21, 2006 4:30 pm
by Shredder
So I have a GLK12232-25 WBL conneted to my Basic Stamp BS2PX with the I2C. I also have a keypad attached to the display. I am having a hard time getting the key presses from the keypad.

This code works fine.. prints "Testing..." on the LCD
Main:
I2COUT 1, 80, [254, 88] 'Command Prefix, clear screen
'I2COUT 1, 80, []
I2COUT 1, 80, ["Testing..."]
PAUSE 5000
I2COUT 1, 80, [254, 88] 'Command Prefix, clear screen
I2COUT 1, 80, [254, 69] 'Command Prefix, clear keypad buffer

The thing that confuses me is in the manual, it reads, "A read is initiated by writing to the module with its base address plus 1". Does that mean i send an I2COUT command to the address 81? or an I2CIN command to it?

I tried this

Keypad VAR Byte

DO
I2COUT 1, 80, [254, 38] 'Command Prefix, poll keypad
I2CIN 1, 81, [Keypad] 'base address +1
DEBUG Keypad
LOOP

plus a couple different combinations of the 80 and 81 address..
any help would be greatly appreciated :)

Posted: Tue Aug 22, 2006 11:38 pm
by Shredder
looks like I got it figured out.. so I figured I would post the code here for someone to see if they are looking to do the same thing..

Here is the code..

Code: Select all

Keypad        VAR          Byte

Main:
I2COUT 1, 80, [254, 88] 'Command Prefix, clear screen
I2COUT 1, 80, ["Testing..."]
PAUSE 2500

DO
I2COUT 1, 81, [254, 88] 'Command Prefix
I2CIN 1, 80, [Keypad]
 IF Keypad = "A" THEN I2COUT 1, 80, ["A pressed"]
PAUSE 500
DEBUG Keypad
LOOP
It seems you have to send out a command prefix to the address +1 , so 81 in this case. Sending text doesnt work.. it has to be a command of some sort.
Then after you send the command you have to do the I2CIN at the normal address of 80