keypad

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Ganr
Posts: 2
Joined: Mon Feb 05, 2007 12:12 pm
Contact:

keypad

Post by Ganr »

Im trying a simple setup to make my keypad work.

I've got the following datasheet for my keypad:
http://www.farnell.com/datasheets/73830.pdf

And with my 16f88 PIC I've created the following (europe symbols as far as i know :)). I've got my output LED's on port A and my input from my keypad on port B.

Image


My programming sounds like:
While 1
{
Keypad0.GetkeypadNumber --> number (result stored in number)
output "number" --> PORT A
}

Where my Keypad0 is set to PORT B with the following:
Collum 1: Bit 0
Collum 2: Bit 1
Collum 3: Bit 2
Row 1: Bit 4
Row 2: Bit 5
Row 3: Bit 6
Row 4: Bit 7

As far as i know im doing everything correct, but I have the problem that no key returns the correct value and keys "1,2,6,9,*,0" isnt doing anything. I've tried to replace the PIC and the keypad none of that worked, and i've tried to switch the pins arround to see what that did, it changed the output from the working keys but the rest still wont work.

Im quite lost here

Any know what i should do to make this work?

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Post by Mark »

Ganr,

I suggest you look at the wiring diagram of the keyboard you have. There is a fairly standard keyboard out there having a 3 by 4 array, i.e. 7 wire input but actually the internal wiring of the keyboard is very strange and which wire to connect were is not obvious. This may account for your results (i.e. are you sure the keyboard corresponds to the data sheet?).

Hope this helps
Go with the Flow.

Richard_Barham
Posts: 3
Joined: Thu May 24, 2007 2:05 am
Contact:

Similar issue

Post by Richard_Barham »

We are having a similar problem except it's almost the opposite of what you were seeing using the 16F877A, I was wondering if you ever solved the problem and how you did it. Everything in our project is working well except the keypad. we have quadruple checked the datasheet for the keypad and have tested it to ensure that we have the right pins. are using the same configuration as the E-blocks keypad. we have used two of the same type keypad, the simulation on flowcode works fine.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

There is a minor problem with the keypad code within Flowcode that could account for your problem. The code scans the keypad too fast and if the wires to the keypad are long, then the keypad returns bad values.

I have modified the keypad code and an updated component will be available in the next release of Flowcode (hopefully on Friday).

Richard_Barham
Posts: 3
Joined: Thu May 24, 2007 2:05 am
Contact:

Keypad problem

Post by Richard_Barham »

Great, thanks that gives me something to work with. I was thinking maybe if I add a loop like while keypad=255 to keep it looking for an input that might do it. then maybe store the keypad value in EEPROM and read it once I exit the loop, I'll try it and check back, see how the update is coming and let you know how it worked.

Richard_Barham
Posts: 3
Joined: Thu May 24, 2007 2:05 am
Contact:

Post by Richard_Barham »

Well I guess if it's a problem getting the number that may not help.

ZARCOV
Posts: 5
Joined: Tue Dec 18, 2007 2:28 am
Contact:

Question: Keypad

Post by ZARCOV »

Upon trying to get my keypad working, it seems that it scans the assigned port too quickly, not waiting for a key to be pressed.
Any sugestions?

Thanks

Marcus Brunetta

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: keypad

Post by Benj »

Hello Marcus

The keypad component performs the scan and then returns a value almost instantly. If this value is 255 then no key has been pressed. If you want to halt the program until a key has been pressed then use a loop icon to poll the keypad until the value returns is less then 255.

eg.

keypress = Keypad_Read_Ascii
loop while keypress = 255
{
keypress = Keypad_Read_Ascii
}

ZARCOV
Posts: 5
Joined: Tue Dec 18, 2007 2:28 am
Contact:

Re: keypad

Post by ZARCOV »

Hi Benj:

It worked fine :P

Regards

Marcus

Post Reply