i dont know if this is the correct forum for this, but i need to be able to control motors from a comp parallel port and have it all controlled by vb. does anyone know how to do this? i need to be able to control 2 motors, each forward and backward thanks for your help
Try here: Look here Here too... Must see.... programming the I/O Ports using C#, can be ported to VB.Net in a breeze... Hope this work for you... Darius
this is pretty simple... you could use 2 relays... one for each motor, or a "H bridge"... (i think it's called that... basicly 4 transistors) just write a number to the port for each direction... and use the lines dirctly to controll the relays...
thanks for the replies @ xdude i dont want to actually write data to the port, just turn the lines on and off @ smilodon what is an H-bridge? it sounds intriuging
This is the simplest circuit i could find quickly You wouldnt have to use MOSFETS, but the general layout of it is the same. A few more here if you scroll down. Basically you use a pair of NPN and PNP transistors to connect each end of the motor to either +12 or ground. You could drive each transistor from the parallel port directly, better would be to use some discreet logic so you use just the 2 lines ie one line 'on' for clockwise, other 'on' for anti clockwise, and motor off if theyre both the same. One thing to watch is that both transistors on the same 'side' of the motor arent turned on at the same time, otherwise you short the +12 to ground through both transistors, which they wont like. Sorry if thats a bit rushed but its been one of those days...
those circuits are perfect, thank you! now i just need someone to tell me the code in vb that says "data line 1 on parallel port 1 on"
Ohohoh forgot to add to my other post, but im sure i have some example code for that around here somehwere You need a 3rd party driver under 2k/XP because they dont like random programs using the parallel port. /me searches hard drive..... EDIT: found the names, search for DLPortIO or WinIO in google, both have the replacemnt drivers and VB source
This is the same thing as writing data to the lines... on the parallel port u have 8 output lines and to turn them on or off u write an eight bit number to the parrallel port which is the sum of all the bits you want on from at least what i learnt in my electronics class.
Another tip for utrning on/off individual lines: Say you already have lines 2 and 3 on, the rest off. The 8 bit data on the PPort would then be b'00000110'. Now you want to turn on line 7. If you dont want to constantly remember which lines are on or off, simply OR b'01000000' to your current output. The result will be b'01000110'. And now you want to turn off line 3. Simply AND b'11111011' to the current output and it will turn off line 3.
what do you mean, simply OR b'01000000' and why the b in front of the nums, is it because its binary? sorry for all the n00b questions!
OR and AND are Boolean terms. I would imagine that some who knows Basic or C++ would know how to use them. The b'XXXXXXXX' is how to represent binary numbers.
i know what OR and AND are! i just wondered how that would work, or are the lines flipflopped? eg when you write 00000001 then 00000001 again, line 1 would go on and back off again?
No. I think he means that you read the current output first (if you can do that?) or keep track of the current output in a variable.