Can you SEND ASCII strings with this CHIP? HELP PLEASE
gth629e
Posts: 40
Okay,
Here is what I need to do or find out if it is possible.
Lets say I have 20 standard I/O switches. With the propeller chip, can you detect those switches and program it to send ASCII keyboard codes to the PC via PS/2 or USB.
So pretty much I need to detect when a switch has been closed and in return send the ASCII command to computer. Like making your own keyboard. Also it would have to be able to realize when a key is continuously pressed.
I am at whits end and I know this has to be possible with some kind of PIC.
Please let me know if you have any idea. Thanks
Here is what I need to do or find out if it is possible.
Lets say I have 20 standard I/O switches. With the propeller chip, can you detect those switches and program it to send ASCII keyboard codes to the PC via PS/2 or USB.
So pretty much I need to detect when a switch has been closed and in return send the ASCII command to computer. Like making your own keyboard. Also it would have to be able to realize when a key is continuously pressed.
I am at whits end and I know this has to be possible with some kind of PIC.
Please let me know if you have any idea. Thanks
Comments
Try search.parallax.com for "USB HID driver f=25".
What about a basic chip or something else. All I need is to have a button pressed and send a code to the pc. I mean I could hack a keyboard but I would rather not. The only other requirment is that it either be usb or ps/2.
Microsoft provides straightforward instructions on how to use this feature. All you need is some experience with serial port access on your microcontroller.
support.microsoft.com/kb/260517
www.microsoft.com/enable/training/windowsxp/serialkeys.aspx
Just remember this takes control of your selected serial port. This shouldn't be too much of an issue since you can buy usb to serial converters for < $20.
Harrison
Thanks though
Looks like Ill have to find another PIC to do the job =(
If costs is an issue..look also at the SX chip from Parallax
It has 21 I/I lines ( the SX28 dip version)
Low cost $3-4 bucks USA
Basic compiler also easy to use..
Beats a PIC
cheers ron mel oz..
Now could you program it to send the correct "report" like a keyboard. Also, it should show up on the pc as a HID device or keyboard.
With the SX can you output via USB?
Thank all you guys for your help so far. I should mention I will be producing my own circuit boards so that is not an issue.
http://www.ultimarc.com/ipacve.html
This turns button pushes into USB keyboard commands.· It's actually designed for MAME based arcade games, but should work for you...
·
Also, its $30.00 vs $5.00 and I am not allowed to sale anything with the ipac board already installed. There are other issues as well. But essentially it does exactly what I am looking for and a lot more.
I know that this is possible though using a PIc, look at this
http://pe.ece.olin.edu/ece/handouts/050215_lab2.pdf
but that is not enough information.
But is does let me know that using a simple PIC that has been programed, you can hook up using usb and have it create the require string.
You are correct that it should be possible to program a PIC to provide a string via USB in response to a switch closure.
Remember that if you want to sell such a device, you need to have an official device identification code which is expensive to get.
It's different if you want to just experiment.
Have a look at this thread. It may give you some ideas. http://forums.parallax.com/showthread.php?p=645487
--Chuck
Chuck,
Excuse my ignorance as electrical engineering is obviously not my cup of tea. I'm a mechanical engineer by trade. Could you explain a little more on you comment above?
It is absolutely easy - even for the advanced beginner - to have a program on the Propeller to
- send PS/2 strings to a PC
- check any switches or whatever.
This in fact is one of the homeworks for my class
It can be done in SPIN when the PS/2 clock from the PC is not too demanding (it should not exceed 20 kHz). There is no special hardware needed for 20 keys except 2 resistors. When you want to power it from the PS/2 port you also need a (small) 3.3 V regulator.
But using a more specific chip for this - ESPECIALLY with USB - will be less expensive. (As it uses 1% of the propeller power only...)
Post Edited (deSilva) : 2/7/2008 7:37:41 PM GMT
That sounds good. Could you send me a link to your hw? lol, I am getting real close and have been doing a lot of reading and am starting to understand a little more. It seems possible. Yes I thought I would have to use a small regulator to get 3.3 volts.
If you would be willing to help me I would gladly try to compensate you for your time. Also, I have several CNC machines so if you need anything cut for projects or anything of the like, I could give you my services in return.
I have to find a PC with a real PS/2 interface; I have checked only with a propeller running Keyboard.spin, which is not representative... As it is SPIN "only", the clock is slower than from a generic Keyboard... Maybe I shall translate it to assembly.... Also the electrical interface is not yet represantative.
A PC has those pins out of the miniDIN connector:
4: +5 V
1: DATA (bi-directional)
3: GND
5: CLOCK (Keyboard to PC, but pulled low by the PC for commands)
As I am using 3 Volts only at the moment there is no need for any special care...
But as both Pull-Ups are on the PC side, there is no way around 5V...
(@Rayman as well!)
However DATA and CLOCK are assumed to be driven low only (!) so the paranoic's 100 Ohm series safety belt against short cuts might suffice. The Hydra interface is safer though and more recommendable for a commercial project...
The +5V regulated by a low power/low drop down regulator deliveres ample power for the Propeller.
----
Edit:
Oops: I looked at the wrong plug
1 - Data
3 - Ground
4 - VCC (+5 V)
5 - Clock
Post Edited (deSilva) : 2/8/2008 7:47:38 AM GMT
Sure, the PIC chip is Microchip's single chip microcontroller solution, the AVR series is the Atmel equivalent. They are similar in many ways except that AVRs tend to be programmed more often in C whereas PIC chips seem to be more commonly programmed in BASIC (compiled or interpreted) and assembly. There are C compilers for the PIC but the architecture doesn't lend itself well to the assumptions that C makes about the computer it is being compiled to.
AVR chips come in effectively three families, the ATTiny series (most like the PIC), the ATMega series (similar to the high end PIC chips), and specialized for specific environments (like automotive, or driving LCDs, etc) There is an active support community on the AVRFreaks web site (www.avrfreaks.net). One of Atmels recent chips is the AVRUSB which has a USB device built into it which they put into a demo board called the AVR-USBKEY (which is similar to a bazzillion other microprocessor demo/eval boards that exist as a USB device). Long story short, some bright guys figured out that if you clocked the AVR at 12Mhz (the native clock speed of USB 1.1) you could implement USB in software. A number of things came out of that, the most popular seems to be alternative human interface devices (an easy to program USB class), but USB keyboard devices are showing up as well. The software the Atmel distributes with their AVR-USBKEY demo board allows it to emulate a keyboard and you can put a button on the board and have it type in "Hello World" to your computer. There are plenty of I/O pins on the USBKEY for adding switches as well, but the AVR-USB chip (the AT90USB series) is about twice as expensive as the ATTiny series. So if all you want to do is a replacement keyboard the ATTiny running a simple keyboard matrix scanning algorithm and doing USB in software would probably be your cheapest solution.
--Chuck
http://forums.parallax.com/showthread.php?p=673220
As I read it (maybe Mike Green will correct me?), it turns the Prop into a USB host that is recognized as a keyboard and then sends keys to the PC...
Or at least thats my plan. Although I'm about to research the AVR-USBKEY and see what that leads to. I am concerned about trying to program one actual pushbutton to send multiple key press string. Hopefully I can get it done.
I will keep you guys posted as I might try using an propeller as well. I still welcome input.
Here is a question, I would like to buy or build a programmer for pics or the ATmega chips, do you guys have any suggestions
Brian
The most awkward piece of code ist the parity.. I remember we had a discussion about that some months ago...
Post Edited (deSilva) : 2/8/2008 8:08:15 AM GMT