Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

convert ASCII characters to keyboard scan codes

Status
Not open for further replies.

scdoro

Member level 5
Joined
Jan 12, 2005
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,040
Hi everyone,

Is there a way to convert ASCII characters to keyboard scan codes in hardware implementation?

thanks

regards
 

IanP

Advanced Member level 5
Joined
Oct 5, 2004
Messages
7,942
Helped
2,309
Reputation
4,620
Reaction score
531
Trophy points
1,393
Location
West Coast
Activity points
66,459
Translation from one code to the other is not difficult thing at all ..
You will need a microcontroller which will take an ASCII character from serial port and, using a look-up table, will translate it from ASCII to PS/2 keyboard, and will output the new code through the same port or in any different way ..
You will have to create a look-up table by yourself, but don't worry, it is not that difficult ..
For example:

Incomming character '0' (zero) in ASCII --> 30h
Outgoing number (equivalent in PS/2 scan code) -->45h

Incomming '1' ASCII -->31
Outgoing 16h

.. and so on ..

Regards,
IanP
 

scdoro

Member level 5
Joined
Jan 12, 2005
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,040
hi LanP,

actually i have created the lookup table to convert ASCII to keyboard scancode.
Now i just cannot figure out how to send the scancode(which is ASCII) serially and then be interpreted as keystrokes at the destinated PC's application.This will require a HARDWARE circuit.

Qn1. How should i do to build this HARDWARE circuit

thanks

Added after 2 minutes:

hi LanP,

actually i have created the lookup table to convert ASCII to keyboard scancode.
Now i just cannot figure out how to send the scancode(which is ASCII) serially and then be interpreted as keystrokes at the destinated PC's application.This will require a HARDWARE circuit.

Qn1. How should i do to build this HARDWARE circuit

thanks
 

IanP

Advanced Member level 5
Joined
Oct 5, 2004
Messages
7,942
Helped
2,309
Reputation
4,620
Reaction score
531
Trophy points
1,393
Location
West Coast
Activity points
66,459
If you would like to feed these codes through the serial port of the other PC then you don't need additional hardware, but a DLL that will somehow deliver these codes to WORD or other WINDOWS applications ..
Or, am I missing something here ???
Regards,
IanP
 

The Svin

Junior Member level 3
Joined
Mar 5, 2005
Messages
31
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
1,734
1. It depends on page code,'cause in different page code you have different ASCII code for the same charater.
2.Easiest and the fastest way is to create table with relation scancode=byte ptr table[ASCII code]. And use ASCII code as INDEX to scan
mov al,byte ptr [pointer to string]
movzx eax,al
mov al,table[eax]
 

maxer

Member level 5
Joined
May 18, 2001
Messages
86
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
774
it depends on what you are going to do ....


fpga or nicro....

micro is the easiest one....

regards

maxer
 

scdoro

Member level 5
Joined
Jan 12, 2005
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,040
Hi IanP

Below is actually what my intention for building my project.i require a hardware interface.Read further below:

------------------------------------------------------------------------------------------


I have written a C++ application for sending RS232 serial data in single PC and I want the data to be received on another PC and captured as keystrokes. These keystrokes can then be used in any window’s word applications and appeared as though they are typed from the keyboard.

I have also coded the program such that for each ASCII character, it is converted into it’s corresponding set of scancode. For example,’a’ is translated into IC FO IC and sends as string “ICF0IC” over the serial link. This ensures the scancode is correctly interpreted by the keyboard controller on the receiver’s side PC.

However I do not know how to go about implementing a hardware device that can achieve the conversion of RS232 data to keyboard data.

Qn(a): Can anyone help me with the schematic design or give some advice? I have come up with overall diagram. How the device should behave but I am unsure if it’s correct.

Thanks.
 

IanP

Advanced Member level 5
Joined
Oct 5, 2004
Messages
7,942
Helped
2,309
Reputation
4,620
Reaction score
531
Trophy points
1,393
Location
West Coast
Activity points
66,459
I would employ 89C52, 89C420, or similar microcontroller, and set its UART to 9-bit mode ( see: http://www.8052.com/tutser.phtml ) .. The micro should use serial port interrupt and a small serial port receive buffer ..This will take care of receiving data ..
As far as transmitting data to the Keyboard Port (I suspected that earlier but wasn't sure) I would use two general I/Os from PORT1 (open drain), one as DATA the other as CLOCK, and TIMER2 to generate 16.7kHz clock as required, so it will be like creating another UART but in software, or take clock from an external source and just shift data out ..
Regards,
IanP

BTW, why do you have 8-bit+Parity? I don't see any reason for the parity bit, and then the UART can ge configured for standard 8-bit word+1Start+1Stop ..
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top