Hi, I would like to create a remote control with 4 buttons: First, Previous, Next and Last. It will send signals to a box joined to parallel (or serial) port of the PC. It will be use to send commands to MS-PowerPOint so we will can be at distance to change our presentation. Can someone tell me a start tutorial to do that? Or can help me with ideas? How can I get the digital signals (+5V -5V, etc.) from LPT1 port to Win32asm? How can I simulate a key pressing (to send commands to PowerPoint)? Any suggestion will be apreciated. :)
To do a remote would be a bit lengthy to give you a tutorial on. Unlike ASM, there is not to many chances to recompile or try again. IE] One BLUE SCREEN OF DEATH is equivalent to one fried parallel port :( . If your truely interested, i suggest going to an electrical supply shop (one that will sell an osciloscope), and find a few books on digital electronics that will give you some fundamental starting points. IE] most digital is (+5,0)V for a 1 bit or a 0 bit. The asm shouldnt be to rough tho but hooking into powerpoint is a bit beyond my experience. Anywho, if you want some positives, here is a basic concept you could use (i personally wouldnt go this way, its a very basic solution but it will work) The simplest design i guess would be a clocked input pattern: Have a remote send a signal for a time durration which will represent separate states. -shortest (2 clocks High) == Begin. -mid 1 (4 clocks High) == Next -mid 2 (6 clocks High) == Prev -longest (8 clocks High) == End - wait for input (all clocks Low) The catch is your homemade remote must be designed to have the same clocking frequency, (whatever you choose ~ faster the better, but you will reach a limit with the ability to decipher the signals). Next, once a timed pattern is found, you need to latch its occourance (Set/Reset latch, D-Flip flop, whatever) and have its output present on a data In pin on the parallel port. Then your windows program should scan the port fairly frequently and if a bit is found high, figure out which one it is (for the functions), and send back a Reset value OUT the port to Unlatch the detemined signal, and make an new input ready. This is a very BASIC solution im giving you. There is faults, IE] if you turn the remote away while in mid transition, a longer signal may become interpretted as a shorted signal (bad control). But if you understand its limitations it will work. The rest is a bit beyond my experience so i will hand off the torch to anyone else who is willing to add some thought... BTW: ALWAYS ground your electronic devices together with a common ground. If your reciever is built to run on a 9V battery, make sure you make the GROUND on the battery (-) connect to the GND pin on the parrallel port. NaN
First, get yourself a nice reference on the parallel port, like the ones here. I do a lot of work (professionally even) getting bits into and out of a PC, but I never use the parallel (printer) port as it's too small for my needs. An 8255 I/O IC however, IS good enough for my needs, and I don't have to worry about frying my PC when I'm using it. (I HAVE fried this IC, but it's a 5-10 buck replacement that way.) These are available very cheap if you go hobby quality (check these guys). For 60 bucks and a spare ISA slot you are in business (PCI versions are much more expensive, around $300, and demand device drivers). That said, you will be matching TTL (Transistor-Transistor Logic) logic levels. These are <0.7 VDC is a zero, >2.4VDC is a one. And don't go below zero volts or above 5 volts or smoke will result. OK, so let's say you use the parallel port anyway. The biggest problem you face now is it doesn't bring out the +5 volts the computer is running off of... so you need make your own, AND switch it on and off with the computer. A 9 volt battery and a 7805 regulator, and a manual switch are probably fine here. Data bits 0 to 3 (4 bits worth) will be used to sense your buttons. These signals will appear on pins 2 thru 5 of the port socket. You'll probably want a matching connector on your board to fit a port IO cable (cutting the end off, stripping out these 4 wires will be a major pain, don't do it). Also pick up a ground reference pin from 18 to 25 (best use them ALL). TTL is easier to 'pull' high then pull low, so we do the opposite of what you might expect next. Tie each data line to +5 volts thru a resistor (about 1K ohm should work). Arrange your pushbutton switches (get normally open ones) to GROUND each input when pressed. Then, your code needs to constantly check the state of the inputs. AND the pins with 7H (you read them with an IN statement I believe, check the above references). If you get a 7H again, no key was pressed. Each bit will go low when the button is pressed, and your code can then do whatever you want it to do. Just about all the parts I mentioned you can get at Radio shack, expensive, but readily available. The best place is probably digi-key, as long as you don't mind a $25 min order. Good luck.
Ernie, Well said, and those are some good sites :) Also, I dont want to step on any toes, but there is a small type-o, nothing really but thought i would point it out for Walfo if he didnt already see it. The 'and' value should be '0Fh' for bits 0->3 data bits, to test 4 input bits. All discussion with 7h's should be 0Fh's NaN