Parallel Port Appliance Control

Do you have a technical question that doesn't really fit a specific console? Want some general info on electronics, hacking, making cookies, etc? Here's the place to ask! Go nuts.

Moderator: Moderators

Post Reply
MM007
Moderator
Posts: 1175
Joined: Mon Apr 05, 2004 6:01 pm
Location: In the wilds of suburbia...

Parallel Port Appliance Control

Post by MM007 »

I am considering using QBasic (maybe Visual basic with a special DLL file later, if it works with VB.NET) to control electrical appliances to my computer.

http://www.aaroncake.net/circuits/crombuld.htm

Turning dials and controlling on/off switches should be easy enough, as I have a partial grasp as to how this guy managed it, though how he got the multiplexor/demultiplexor to work in software is still something I don't understand.

If you only have 8 data bits, plus 3 address bits, to assign in software to begin with, how can you use any arrangement of multiplexors/demultiplexors to make it work? Do you have to code a type of multiplexing function in software? I don't understand what he seems to be doing there at least.

Since I don't fully understand what he is doing with the Multiplexors, I am considering trying to control the devices by using each output bit of the parallel port in an independant serial manner (since there are ways of changing one bit in the parallel port without altering the others on the site), rather than in the simpler parallel manner which his site teaches. I am considering this for a TV remote control.

I have a remote with 37 buttons. since 64 > 37 > 32, this normally needs 6 bits to control. However, if I use 2 IC chips with 4 J/K Flip Flops each, and add a SEND bit, I should be able to load commands into the device with just one of the output bits. Here is how I plan for it to work...

Step 1:
CLEAR: This will be fairly simple, and controlled by an AND gate. One input of the gate will always be high, and the output will be connected to the CLEAR input of all of the J/K Flip Flops. The remaining input will be connected to some part of the remote's circuitry that will recieve voltage when signal is sent through the remote, perhaps something close to the IR LED. This may be connected to a latch circuit of some type so as not to make the "button press" too fast to register. This may depend on the remote. As such, the "address" in the flip-flops of the button that is pressed will always be cleared when the task is completed, and the flip flops prepared for the next button address, without any of the inputs from the parallel port even being needed. A wait command of perhaps 1 second or even less can be used between each "button address" in the program, then the program will send a zero to the device, more for the sake of the software than the device, as this will prevent conflict with other devices on other bits on the parallel port(if all the other devices to the same thing, only one device will recieve a HIGH bit from the parallel port at a time anyway).

Step 2:
PRESS: The computer will output through one pin of the parallel port a single 7-bit code in this format: one bit send, 6 bit button address, in the form of 1xxxxxx (may be reversed in practice to xxxxxx1). Seeing as all of the bits in the register (what we will call the flipflop chain) are zero, the code can be entered, and activated in this way:

There is an individual AND gate connected to each flipflop. One AND gate input is connected to the button address flip flop output, and the other input of all the AND gates is tied to the send bit. When the send bit equals "1", that tells the AND gates that the button address has been fully entered into the register and is to be executed. This is because since the registry will contain all zeroes when a new address is inputed, a single bit can be used to indicate when seven bits have been entered, pushing the first entry all the way to the SEND bit.

Now that the button address has been inputed and enabled by the SEND bit, the internal logic of the hard-wired logic gates takes over, activating the remote control's button which is assigned to that particular six-bit address. Once this has been pressed, it clears and starts over.

While using a computer to control my TV/VCR may be harder than using a remote, this was just an example of what could be done. Something similar could be done with a telephone, using something like a telephone connected to a speaker and microphone, with a 5 bit register. (1 SEND bit plus 4 bits control, as we have twelve buttons plus the hang-up switch, and 16 > 13 > 8 ). This can be done with any computer using QBasic and a parallel, even an old MS-DOS machine in your attic, possibly.


So, any questions? Suggestions? Improvements? Explanations?(I still don't get what he's trying to do with multiplexing entirely. I know what multiplexing IS, but not how he manages it here.)
Warranty-Voiding fun!

Image
timmeh87
Senior Member
Posts: 3047
Joined: Mon Nov 14, 2005 10:19 pm
Location: Ontario, Canada

Post by timmeh87 »

if you are going to do things serially, why not use the serial port instead?

maxim makes a chip called the MAX232 that will convert rs232 serial to a format that a PIC microcontroller can understand, and then you can get the PIC to do just about anything.

just another idea... yours sounds like it would work too though.
Image

"Linux is only free if your time is worthless"
MM007
Moderator
Posts: 1175
Joined: Mon Apr 05, 2004 6:01 pm
Location: In the wilds of suburbia...

Post by MM007 »

It's just that if I can do things serially, I can connect 12 devices to the parallel port in this manner. Also, it has been stated by someone who has done something very similar (the article I got the idea from) that this method isn't very well suited for serial ports software-wise, at least not using QBasic.
Warranty-Voiding fun!

Image
timmeh87
Senior Member
Posts: 3047
Joined: Mon Nov 14, 2005 10:19 pm
Location: Ontario, Canada

Post by timmeh87 »

well vb has pretty good serial port stuff. and you could control at least 35 devices with a pic16f887a.

but yeah. it was just one idea.
Image

"Linux is only free if your time is worthless"
Post Reply