![]() |
Forum Index : Microcontroller and PC projects : PS/2 to serial and parallel
Author | Message | ||||
tgerbic Regular Member ![]() Joined: 25/07/2019 Location: United StatesPosts: 66 |
Hi, I am new to this forum, but have used the older MX150 processors with MMBasic 4.5C. I have a need to convert some PS/2 keyboards to provide serial TTL, parallel and/or RS232 output. There are some vintage computers (kit and home built) around my hobby lab that need parallel keyboards or serial TTL. Since I have some spare PS/2 keyboards and a tube of MX150s, I thought I would build a simple board inside which could have some interface connectors which would allow me to make a flexible serial/parallel keyboard I could use across a variety of projects and bench experiments. There are some converter cards around (mostly closed SW designs) that do either serial or parallel, not both, but would require additional hardware logic for positive or negative signaling for parallel, which should be simple to implement in software. There is some old C code out there that I found would need to be updated to work with more modern compliers. I don't want to reinvent the wheel and be the 500th person to scratch build a PS/2 to serial decoder. I thought I would check with this forum to see if anyone had already created some code to do either standard ASCII serial, preferred, or parallel conversion from PS/2 that would run on the MX150 processor, in assembler or MMBasic. This would get me started in the right direction, which I could then enhance to meet my needs. Please let me know if something is available. Thanks |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2950 |
G’day tgerbic, I think, from my shocking memory, that CIRCUITGIZMOS has just the product. I had a quick look at his site CIRCUITGIZMOS.COM but couldn’t see it anywhere.. Drop him a PM or visit his site. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I think Basic would be too slow, especially on the MX150. You should be able to do a simple PS/2 to serial converter with an Arduino. Jim VK7JH MMedit |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
FYI: A bit costly but off the shelf : ps-2-keyboard-to-ttl-serial-converter.html NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
tgerbic Regular Member ![]() Joined: 25/07/2019 Location: United StatesPosts: 66 |
Thanks team for responding. bigmik, Seems that CIRCUITGIZMOS has a pushbutton to PS/2 chip to allow a set of pushbuttons to send PS/2 key codes. This is the opposite direction from what I need. TassyJim, probably right about the Arduino but was hoping to stay with PIC since I have a lot of them. Assembler should be blazing fast in this app, with a 40Mhz to 48Mhz clock speed. Some say BASIC would be too slow but I have not seen any hard evidence that it is actually the case, just the assumption it would not work. Interrupt driven might be fast enough and polling potentially could be too slow. KeepIS, It is costly, and it does not provide an ASCII parallel output. I would need a serial to parallel converter following this with hardware config to get a flexible parallel output. This is the problem with solutions I have found so far. Some are very expensive by the time it is implemented or lacks both parallel and serial. Others support parallel but only upper case or lower case and very limited key support, plus no option for negative/positive going latch line. I believe I need something I can modify. PS/2 to serial would take care of the heavy lifting of scanning and converting to ASCII. Parallel should be a few lines of code added after some defs for the pins. The purchased solutions have closed code so I cannot put it on a chip with enough pins or make changes. Let me know if any other options come to mind. Regards |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1882 |
Actually the code is quite simple in assembler on a small PIC, I wrote one over 20 years ago for my CW decoder / encoder. There are timing diagrams and Key scan codes for the PS2 on the net, but as you say, "trying not to reinvent the wheel", however it may be the only way to go. Hopefully someone may post a link to some code before you have to start reinventing one. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
dead easy to do with Great Cow Basic.. Will compile code for any 14/16bit PIC so you can use one from your junk box. Simply read the keyboard (inkey) and if you get anything except a zero, send it out via a serial port. Beware of 5v PICS you'll have it all done in a morning http://gcbasic.sourceforge.net/help/_ps_2_overview.html |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
ah... no edit button. following on from the above... https://sourceforge.net/p/gcbasic/discussion/579126/thread/66e9eed6/ |
||||
Quazee137![]() Guru ![]() Joined: 07/08/2016 Location: United StatesPosts: 593 |
Geoff's ASCII Video Terminal ASCII Video Terminal has USB, PS/2 inputs and and serial I/O. There are 9 other pins from the VGA and ICSP that can do 8 bit out with strobe. But it is using the PIC32MX250 chip. But skipping the USB maybe the 150 will work. Have a look it's a good starting point. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
I agree with Quazee137. The terminal chip could simply work as your PS/2 to serial adaptor - just don't connect the VGA or composite video output pins. Smoke makes things work. When the smoke gets out, it stops! |
||||
tgerbic Regular Member ![]() Joined: 25/07/2019 Location: United StatesPosts: 66 |
Team, Spent the day working on this with good results. CaptainBoing, Good call on using GCB. Easy to install, learn and code in. No support for MX chips yet but I have some 16F and 18F around to play with. Spent most of my day tweaking the PS2.h file. It is missing some characters like TAB and does not seem to have support for Xon or Xoff. Bell (^G) and line feed are also missing. I think the caps lock is backwards judging from my scope display of the serial stream. Will need to connect up to a terminal and make sure all the characters are correct. May also be a quirk in releasing the caps lock as it seems to freeze the keyboard. Probably something with the routine to writeback status for the caps lock LED. Also added support for the F keys, numeric pad keys and anything else with single byte keydown code. I need some extra keys for special functions. It is now taking in keyscans, writing to a parallel port, toggling a data strobe line and then sending the character out the serial port. I am using the F keys for setup such as data strobe polarity, and on the fly baud rate changes. Numeric pad * sends ^G, + toggles between sending Xon/Xoff, and - provides a 500ms reset line pulse to reset the target PC. I think I have most of the keyboard support I need for my older S100, Apple II and old microcontroller cards. Should work for some retro projects I have in mind. Overall I am very happy with the project so far, just need to get the hardware built, clean up the code a bit and build this into two or three keyboards. Regards |
||||
tgerbic Regular Member ![]() Joined: 25/07/2019 Location: United StatesPosts: 66 |
Well, now the actual control keys ^a to ^z work. Scroll lock now toggles Xon/Xoff. I think I have a full replacement for old serial (8N1) and parallel (rising and falling edge data strobe) keyboards. Looks like I have a good enough implementation for my needs with a few spare keys and about 8 or 9 spare pins should I want to add more functions. I might move it to a smaller processor but I have plenty of the current ones. Let me know if anyone needs an upgraded PS2.h file for GCB. Regards |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |