GLK12232-25 WBL I2C Keypad

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
Shredder
LCD?
Posts: 8
Joined: Thu Aug 17, 2006 12:37 pm

GLK12232-25 WBL I2C Keypad

Post 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 :)
Shredder
LCD?
Posts: 8
Joined: Thu Aug 17, 2006 12:37 pm

Post 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
Post Reply