Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC and keyboard problem

Status
Not open for further replies.

Joyhtidas

Member level 4
Joined
Nov 30, 2009
Messages
72
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Bangalore, India
Activity points
1,709
Hi...
I am trying to interface one keyboard with PIC24F...
I sm using one key encoder IC... .. It returns the ASCII value...
So If i press "1" i will get value 0x31.. for "2" it is 0x32...like that..
My requirement is that, if i press "1" and then "8" i need to get integer '18'... not hex value
Please share your ideas.... :idea:
Thanks in Advance.....
 

Simple.
First you have to create a table for conversion (ASCII)
0x31-> 1
0x32-> 2
etc.

For two digit nums.
First_number * 10 + Second_number * 1
Eg
First num = 8
second num = 2
8*10 + 2*1 = 82


For 3 digit num
n1*100+n2*10+n3*1
and so on.


Good luck.
 

Hi...
Thank you for the idea......
Here in my program i will be storing the keypress in one array..
I am saving numbers.. between two variables say 'X' and 'Y'....so there will be n number of key press (maximum is 8 )...
so the count ranges from 1 to 8..then how (Forexample:- 1, 152, 26,360 )
we can calculate the result easily ....
 

Joyhtidas said:
Hi...
Thank you for the idea......
Here in my program i will be storing the keypress in one array..
I am saving numbers.. between two variables say 'X' and 'Y'....so there will be n number of key press (maximum is 8 )...
so the count ranges from 1 to 8..then how (Forexample:- 1, 152, 26,360 )
we can calculate the result easily ....

Use the following technique.
If u pressed any key, say 1
then
1
" pressed another key, say 5
then
last result, 1*10+5*1 = 15
'' pressed another key say 7
last result, 15*10+7*1=157

and son on.

Last u have to press an enter key or Ok key in the keyboard,


Good luck,
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top