Petscii Forums "PETSCII.COM"
« Jornada Micro Keyboard Hack: RS-232 to PS/2 »

Welcome Guest. Please Login or Register.
Sept 2, 2010, 9:36pm




Petscii Forums "PETSCII.COM" :: General :: DTVHacking :: Jornada Micro Keyboard Hack: RS-232 to PS/2
Page 1 of 2 » Jump to page   Go    [Search This Thread][Send Topic To Friend] [Print]
 AuthorTopic: Jornada Micro Keyboard Hack: RS-232 to PS/2 (Read 10,262 times)
jtwinters
Junior Member
**
member is offline

[avatar]


[homepage]

Joined: Dec 2006
Gender: Male
Posts: 87
Location: Florida USA
 Jornada Micro Keyboard Hack: RS-232 to PS/2
« Thread Started on Jan 2, 2007, 7:10pm »

The Micro Folding Keyboard (Model#: TKB420HP) made by Micro Innovations is a small portable keyboard for attaching to a Jornada PDA. It basically has all keys needed for adapting to a DTV but unfortunately outputs RS-232 instead of PS/2. The following information describes how to interface this keyboard to DTV Hummer and possible the rest of the DTV versions.

[image]

Out of the box:
[image]
Disassembling the keyboard, you’ll see 5 labeled connections: VCC, RTS, RXD, DCD, and GND. VCC is +5V for this unit. RXD is the line on which data is actually sent, although the keyboard won’t send anything until RTS is pulled high. I do this right on the board by soldering a 1k resistor between the RTS pad and the onboard microcontroller’s Vcc pad (see picture). By doing this, you only need to run three wires from the keyboard (VCC, RXD and Ground).

[image]

As far as what mechanical modifications… I chose to cut away a lot of extra plastic from the two folding halves and superglue the sides together. This effectively created one solid piece. I also glued the flexi-ribbon flat against itself to take up less space.

[image]

Since this keyboard outputs RS-232 (9600 baud, 8 data bits, 1 stop bit and no-parity), a PIC 16F88 microcontroller is used to convert the data to PS/2 for the DTV. PS/2 keyboards use “make” and “break” codes. One or more “make” codes is sent when a key is pressed and several “break” codes and are sent on key release. The Jornada keyboard kind of works the same way in that it uses make and break codes, unfortunately the codes are not a one for one match and must be re-mapped by the PIC.

On power up, the PIC will check to see if a regular external PS/2 is attached. If so, it will just go into “repeater” mode and pass along any signals from the PS/2 keyboard to the DTV. The PIC adds a one second delay to get rid of the pesky “V”.

Here’s the circuit (thanks to Joe Rey for redrawing it):
[image]

The 100k resistor on pin 11 is needed even if you decide not to mess with the external PS/2 connector, so don’t leave it out. The rest is fairly straight forward. The 100uF cap may need to be larger depending on your setup. 100uF worked initially for me until I added an LCD screen to my design. The power surge on start up was too much and the keyboard would not initialize properly until I increased it to 470uF.

For timing, the internal 8 MHz oscillator is used. It seems to work just fine.

Here’s the HEX file: http://www.picobay.com/picodore64/JornadaKB_16F88.hex

And the source code: http://www.picobay.com/picodore64/JornadaKB_16F88.txt

Again, this is for a 16F88 and any $15 JDM PIC programmer will work just fine. The source code is written in PicBasic Pro. The code could probably be reduced to half the size by constructing the send codes on the fly instead of hard coding them. The start, stop parity bit could be added automatically and each make/break code would only take up a byte instead of a word. But the 16F88 has 4K of space and I wasn’t tight on space. Maybe as I add more features, I’ll recode that section. And while I’m at it, I’ll switch to using interrupts to get the data from the Jornada keyboard instead of just waiting for data.

Obviously this is an adapted keyboard and I had to switch some of the key assignments:

Today = ESC (RUNSTOP)
Space = INSERT
Windows key = Commodore Key
FN + Right Arrow = HOME
FN + CRTL + Right Arrow = CLR SCN

The 4 keys in the top left are the F1 thru F4 keys, F5 thru F8 with the FN pressed.

I didn't bother to implement the Numlock keypad, there didn't seem to be much point to doing so.

Just for the heck of it I’m posting the PS/2 waveform of a make code for the “A” key. Channel 1 is the clock and Channel 2 is data.

This is from a real PS/2 keyboard.
[image]

And here is the PIC’s emulated PS/2 protocol of the same data.
[image]

Good luck!
« Last Edit: May 1, 2008, 11:56pm by jtwinters »Link to Post - Back to Top  IP: Logged

Jason Winters

Check out my interactive fishcam!
http://www.picobay.com/fishcam

My other projects:
http://www.picobay.com/projects/index.html
huckle
Full Member
***
member is offline




[homepage]

Joined: Dec 2005
Posts: 103
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #1 on Jan 2, 2007, 8:49pm »

Very good job!
Is the keyboard giving out real rs-232 voltage levels? ie, 12+ volts. I'm guessing the 1k resistor on the rxd line is to protect the pic?
« Last Edit: Jan 2, 2007, 8:56pm by huckle »Link to Post - Back to Top  IP: Logged
jtwinters
Junior Member
**
member is offline

[avatar]


[homepage]

Joined: Dec 2006
Gender: Male
Posts: 87
Location: Florida USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #2 on Jan 2, 2007, 9:00pm »

The output voltage levels of the keyboard are 0 and +5V. And yes the 1k resistor is to limit current between the keyboard and PIC. It probably isn't even needed but since I had absolutely no documentation to work with and only one keyboard to reverse engineer, I wasn't taking any chances.
Link to Post - Back to Top  IP: Logged

Jason Winters

Check out my interactive fishcam!
http://www.picobay.com/fishcam

My other projects:
http://www.picobay.com/projects/index.html
jsaily
Full Member
***
member is offline





Joined: Feb 2006
Gender: Male
Posts: 229
Location: Finland
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #3 on Jan 9, 2007, 1:34pm »

I happen to have a suprlus GoType! keyboard for Handera Palm device. I think this uses also RS232 connection to transfer data, and would make an excellent portable keyboard for DTV.

Any idea if the protocol is much different from the Jornada protocol? I should probably take my scope from the closet and start probing ;)
Link to Post - Back to Top  IP: Logged
jtwinters
Junior Member
**
member is offline

[avatar]


[homepage]

Joined: Dec 2006
Gender: Male
Posts: 87
Location: Florida USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #4 on Jan 9, 2007, 3:47pm »

Your guess is as good as mine. I'm no expert on PDA keyboards. If it uses make and break codes, like the jornada, then you can easily modify my code to fit your keyboards output.

I don't think there is a stardard scheme for RS232 output on these since the Jornada needed a special driver to use the external keyboard.
Link to Post - Back to Top  IP: Logged

Jason Winters

Check out my interactive fishcam!
http://www.picobay.com/fishcam

My other projects:
http://www.picobay.com/projects/index.html
copperhorse3
New Member
*
member is offline





Joined: Apr 2005
Posts: 3
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #5 on Jan 20, 2007, 11:20am »

Hi slightly off topic but...

The medium sized keyboard you originaly planned to use, I don't suppose you know if it was/is compatable with the DTV?

Thank you.
Link to Post - Back to Top  IP: Logged
jtwinters
Junior Member
**
member is offline

[avatar]


[homepage]

Joined: Dec 2006
Gender: Male
Posts: 87
Location: Florida USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #6 on Jan 20, 2007, 11:29am »

On the contrary, this mini-keyboard worked flawlessly. It was a standard computer keyboard with a USB output. By using a PS/2 to USB adapter, the Hummer was happy with it.
« Last Edit: Jan 20, 2007, 11:31am by jtwinters »Link to Post - Back to Top  IP: Logged

Jason Winters

Check out my interactive fishcam!
http://www.picobay.com/fishcam

My other projects:
http://www.picobay.com/projects/index.html
expertsetup
Senior Member
****
member is offline

[avatar]


[homepage]

Joined: Apr 2005
Gender: Male
Posts: 468
Location: California USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #7 on Jan 20, 2007, 12:52pm »

Good to know the PS2/USB adapter is working with DTV. Open the selection up a bit.
Link to Post - Back to Top  IP: Logged

jtwinters
Junior Member
**
member is offline

[avatar]


[homepage]

Joined: Dec 2006
Gender: Male
Posts: 87
Location: Florida USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #8 on Jan 20, 2007, 1:18pm »

Not every USB keyboard will work with an adapter. It all depends on whether the microcontroller in the keyboard is smart enough to sense that it's connected to a PS/2 interface and use that protocol instead of USB. It's really hit or miss.

The middle keyboard in this pic works for sure though...

Link to Post - Back to Top  IP: Logged

Jason Winters

Check out my interactive fishcam!
http://www.picobay.com/fishcam

My other projects:
http://www.picobay.com/projects/index.html
xxameht
New Member
*
member is offline





Joined: Feb 2007
Posts: 3
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #9 on Feb 23, 2007, 10:23pm »

how hard do you suppose it would be to port that idea to a 12c508?
Link to Post - Back to Top  IP: Logged
expertsetup
Senior Member
****
member is offline

[avatar]


[homepage]

Joined: Apr 2005
Gender: Male
Posts: 468
Location: California USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #10 on Feb 23, 2007, 10:37pm »

JT may I also ask what PS2->USB adapter you used? Was it just one of the purlpe devices I have seen or was it an active device?
Link to Post - Back to Top  IP: Logged

jtwinters
Junior Member
**
member is offline

[avatar]


[homepage]

Joined: Dec 2006
Gender: Male
Posts: 87
Location: Florida USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #11 on Feb 25, 2007, 2:29am »

Do you mean a USB->PS2 adapter? I just used a little passive adapter that came with the keyboard. It's really nothing special.... all it does is route the PS2 connections to USB. Though, the keyboard has to be smart enough to know that it is in PS2 mode. I don't think all USB keyboards can do that.
Link to Post - Back to Top  IP: Logged

Jason Winters

Check out my interactive fishcam!
http://www.picobay.com/fishcam

My other projects:
http://www.picobay.com/projects/index.html
expertsetup
Senior Member
****
member is offline

[avatar]


[homepage]

Joined: Apr 2005
Gender: Male
Posts: 468
Location: California USA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #12 on Feb 25, 2007, 2:56pm »


Quote:
Do you mean a USB->PS2 adapter?

I guess so, I think of adapters as a device that connects the Host to a device so in this case the host is PS/2 and the device is USB. So from my point of view its an PS2 host port to USB device adapter. However I assumed this and am far from sure if there is a standard to describe adapters.


Quote:
I just used a little passive adapter that came with the keyboard. It's really nothing special.... all it does is route the PS2 connections to USB. Though, the keyboard has to be smart enough to know that it is in PS2 mode. I don't think all USB keyboards can do that.

Great then the adapter I have should work with kayboards that are 'PS2 compatible'.

Thanks JT.

P.S.
I am loving the Beaker Avatar you are using now :D
« Last Edit: Feb 25, 2007, 2:59pm by expertsetup »Link to Post - Back to Top  IP: Logged

Golan Klinger
Moderator
*****
member is offline

[avatar]

64K is enough for me.


[homepage]

Joined: Mar 2005
Gender: Male
Posts: 1,031
Location: Toronto, CANADA
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #13 on Feb 25, 2007, 6:46pm »


Quote:

Quote:
Do you mean a USB->PS2 adapter?

I guess so, I think of adapters as a device that connects the Host to a device so in this case the host is PS/2 and the device is USB. So from my point of view its an PS2 host port to USB device adapter.

While there is no standardized definition, common usage is the opposite. To connect a USB mouse to a computer with a PS/2 port requires a USB to PS/2 adaptor as it is the mouse that is being adapted to work with the PC. Search Google Images for "USB-to-PS2" and "PS2-to-USB" and you'll quickly see the difference. With all that being said, you should always specify *exactly* what you want. If you want a 'female USB to male PS2' adaptor, ask for one.

Semi-OT: One of my pet peeves is people who say things like, "I need a serial cable". That's so ambiguous. It's like going into a restaurant and ordering, "Food". What kind of end connectors? Gender? How many pins? Where do you want the pins to go? <sigh>
Link to Post - Back to Top  IP: Logged

Call me Golan; my parents did.
nojoopa
Full Member
***
member is offline





Joined: Sept 2006
Gender: Male
Posts: 169
Location: Finland
 Re: Jornada Micro Keyboard Hack: RS-232 to PS/2
« Reply #14 on Feb 26, 2007, 8:02am »


Quote:
Great then the adapter I have should work with kayboards that are 'PS2 compatible'.
...if the keyboard doesn't require the 0xF4 activation, as mentioned here. If it does, try the fix by zee.

Someone should include this stuff on the DTV Wiki.
Link to Post - Back to Top  IP: Logged

VICEplus is dead, long live VICE!
http://picobay.com/dtv_wiki/ - C64DTV hacking wiki
Page 1 of 2 » Jump to page   Go    [Search This Thread][Send Topic To Friend] [Print]

Google
Webjledger.proboards.com
Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Report Abuse | Mobile