Shop OBEX P1 Docs P2 Docs Learn Events
PC Keyboard In/Out of the basic stamp? — Parallax Forums

PC Keyboard In/Out of the basic stamp?

Vern GranerVern Graner Posts: 337
edited 2005-06-11 12:08 in BASIC Stamp
Recently, I came across a need for the ability to intercept/interpret the data from a PC keyboard before it was then passed along to the PC. I was wondering if anyone had done this already and had code that would read a standard PS2 style keyboard and also would allow the stamp to send PS2 keyboard compatible keystrokes to the PC? The hookup I envision would look something like this:

PC Keyboard--->BSII--->PC

Ideally, I would like to have the BSII "Watch" the input for keystrokes and simply pass them through to the keyboard jack on the PC unless the stamp sees a keystroke (or keystroke combo) that triggers a reaction such as:
  • BSII Sees "A", BSII sends "A"
  • BSII Sees "f", BSII sends "f"
  • BSII Sees "4", BSII sends "4"
  • BSII Sees "CTRL-R", BSII sends "ALT-Q"
  • BSII Sees "CTRL-C", BSII sends "CTRL-C"
Does anyone know of code somewhere that does this? And if not, maybe the Parallax guys could venture a guess as to how hard this would be to implement...? smile.gif

Vern

PS: before someone points out the obvious that this could be done with a utility program in DOS or Windows, this is not an option as the I/O is being sent to a machine while it is in the BIOS screen, before any OS is operating.. roll.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
Senior Systems Engineer    | obviously incompetent so why are we
Texas Information Services | paying you? Of course,if the network
http://www.txis.com        | is up, then we obviously don't need
Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG


Post Edited (Vern) : 6/9/2005 9:27:47 PM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-09 22:23
    Vern,

    ·· There used to be a device available called the KeyVerter that allowed you to connect a PC keyboard to the Stamp and read key presses.· You might be able to find a used one on eBay.· That would allow you to obtain the keystrokes.· As for sending them, I have heard of people doing that directly from the Stamp Module.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NewzedNewzed Posts: 2,503
    edited 2005-06-09 22:32
    I have a PAK6 circuit that accepts a keybnoard press then transmits the key to Stamp.· Take a look at the Keyboard Interface at http://hometown.aol.com/newzed/page3.html


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Need a bezel for your LCD?

    Newzed@aol.com


    Post Edited (Newzed) : 6/9/2005 10:47:39 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-06-09 22:38
    Sid, your link includes the period and therefore does a 404 bounce, not a big issue, but thought Id raise it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • NewzedNewzed Posts: 2,503
    edited 2005-06-09 22:49
    You're right about thatsmhair.gif

    I just edited the post.· Thanks, Paul.

    Sid
  • Donald BartleyDonald Bartley Posts: 19
    edited 2005-06-09 22:53
    Multilabs just released the ezKEY which is a PS/2 Keyboard serial adapter.· It converts all the scan codes into simple single byte ASCII values to make things simple.· This product works great with the BASIC Stamp and there is sample code of how to use it with a BS2 along with documentation.· You can see it at www.multilabs.net
  • Vern GranerVern Graner Posts: 337
    edited 2005-06-09 23:03
    Donald Bartley said...
    Multilabs just released the ezKEY which is a PS/2 Keyboard serial adapter. It converts all the scan codes into simple single byte ASCII values to make things simple. This product works great with the BASIC Stamp and there is sample code of how to use it with a BS2 along with documentation. You can see it at www.multilabs.net

    Wow! That handily solves the "keyboard in" part.. now how about the keyboard out? smile.gif Of course, I'm still curious if the stamp could do this w/o an external piece of hardware...?

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-06-09 23:41
    Vern -

    Here is a direct link to the PAK-6 Co-Processoer, if you want to learn more about it:
    http://www.awce.com/pak6.htm

    Regards,

    Bruce Bates
  • Jayguy5000Jayguy5000 Posts: 139
    edited 2005-06-10 03:59
    Sounds like some body wants to be a bit sneaky eh? owell at least your using your brain to be productive, and not hanging out with the cool kids after school.
  • Vern GranerVern Graner Posts: 337
    edited 2005-06-10 04:18
    Jayguy5000 said...
    Sounds like some body wants to be a bit sneaky eh? Oh well, at least you're using your brain to be productive, and not hanging out with the cool kids after school.

    I think I gave up trying to be sneaky around.. hmm lets just say "over 40"! lol.gif What I'm looking for is a way to bulk-program BIOS setups w/o having to do a bazillion keystrokes. In this particular application, certain settings need be done by hand, per machine, others are common for all machines. So, if I had one of these an operator could hit a "combo" keystroke and dump a string of keystrokes into the PC using a sort of "macro". Thus, reducing setup time and speeding production. Necessity being a mother and all that.. roll.gif

    Frankly, if I wanted a keystroke logger, there are plenty of those around and they would take considerably less brain power for me to implement than this idea! smile.gif

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2005-06-10 15:24
    Vern said...
    Jayguy5000 said...
    Sounds like some body wants to be a bit sneaky eh? Oh well, at least you're using your brain to be productive, and not hanging out with the cool kids after school.

    I think I gave up trying to be sneaky around.. hmm lets just say "over 40"! lol.gif What I'm looking for is a way to bulk-program BIOS setups w/o having to do a bazillion keystrokes. In this particular application, certain settings need be done by hand, per machine, others are common for all machines. So, if I had one of these an operator could hit a "combo" keystroke and dump a string of keystrokes into the PC using a sort of "macro". Thus, reducing setup time and speeding production. Necessity being a mother and all that.. roll.gif

    Frankly, if I wanted a keystroke logger, there are plenty of those around and they would take considerably less brain power for me to implement than this idea! smile.gif

    Vern

    If the systems are all identical, would you consider using a bios copy/restore utility that boots off of a floppy or cd???
    A lot of the newer mobs do support this option.

    Good luck!


    Bob N9LVU scool.gif
  • NewzedNewzed Posts: 2,503
    edited 2005-06-10 15:48
    I hooked up my PAK6 to a miniature keyboard and played around with for a bit.· I declared "key VAR byte(20) and wrote for my BS2:

    start:

    serin 14, baud, [noparse][[/noparse]STR keyin\20\13
    for x = 0 to 19
    if keyin(x) = 0 THEN
    debug cr
    goto start
    ENDIF
    debug keyin(x)
    next

    I·can a string of 20 charcters to the debug screen or I can press one key then Enter and the screen will display the key I pressed.

    I wrote another routine:

    if key(x) = "A" then

    serout 16, baud, [noparse][[/noparse]"1234", cr]

    When I press A on my little keyboard followed by Enter the debug screen displays 1234.






    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Need a bezel for your LCD?

    Newzed@aol.com
    ·
  • Vern GranerVern Graner Posts: 337
    edited 2005-06-10 20:03
    Robert Kubichek said...
    If the systems are all identical, would you consider using a bios copy/restore utility that boots off of a floppy or cd???
    A lot of the newer mobos do support this option.

    Though a good idea, and one that was considered, there is some data that is specific to each machine. I need the ability to have the system non-interfere with regular keystrokes, but then "jump into action" when it sees the command it is supposed to replace with a string of digits.

    The "input" portion to the stamp seems to be solvable with a couple of hardware solutions (though I'm still curious if it could be done software-only). At this point all I would need would be a routine that would allow the Stamp to send PS2 keyboard formatted text out.

    Does anyone know if this is possible through software on the stamp or through hardware (i.e. a serial->ps2 keyboard adapter)?

    Thanks for the idea though.. we might be able to use this to pre-set the bios and then maybe have the operators just change the specifics... hmm might merit exploration. Only stumbling block I can see is these are custom single board PCs w/o any floppy or CDROM...

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • Vern GranerVern Graner Posts: 337
    edited 2005-06-10 20:11
    Newzed said...
    I hooked up my PAK6 to a miniature keyboard and played around with for a bit. I declared "key VAR byte(20) and wrote for my BS2 <snip>

    Thanks for this little "Proof of concept" of the intercept and replace idea! smile.gif Very cool! Now I just have to figure out how to get serial data turned into PS2 acceptable signals...

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • NewzedNewzed Posts: 2,503
    edited 2005-06-10 20:19
    Vern, what do you mean by "PS2 acceptable signals".· If you serout from the Stamp an "A" on Pin 16 or Pin 13 or Pin 1, what ever is on the other end of the serial cable is going to get an "A" which is dec 65 which gets converted to %01000001.



    Sid
  • Vern GranerVern Graner Posts: 337
    edited 2005-06-11 07:12
    Newzed said...
    Vern, what do you mean by "PS2 acceptable signals". If you serout from the Stamp an "A" on Pin 16 or Pin 13 or Pin 1, what ever is on the other end of the serial cable is going to get an "A" which is dec 65 which gets converted to %01000001.

    I mean the output of the stamp needs to be plugged into the PS2 keyboard port of a PC and generate signls the PC will accept as if the PC were simply "seeing" a PS2 keyboard. i.e. {PC Keyboard}--->{BSII}--->{PC} The end result being an "insert" between a "regular" x86 PC and a "regular" PS2 style keyboard. Does that help? smile.gif

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • NewzedNewzed Posts: 2,503
    edited 2005-06-11 12:08
    The PAK6 has an output which it sends to the Stamp when a key is pressed.· It also has an input wherein the Keyboard receives input from the Stamp.· It is only being used for Reset, but suppose you had another PAK6 with its four keyboard connections going to the PC.· If the Stamp sent a byte to that PAK6 it appears that byte would be converted to the proper scan code and sent to the PC.

    Sound logical?

    Sid
Sign In or Register to comment.