Parallel Port Output

...doing a school project where i connect the parallel port to a bread bord which connencts to motors etc...
i understand u use javax.comm.*; classes to access the parallel port.
rite now i have like this...
import javax.comm.*;
import java.io.*;
public class carPort {
  ParallelPort port;
  byte[] outputByte = new byte[8];
  public carPort() {
    port.setOutputBufferSize(8);
  public OutputStream getOutputStream() {
    try {
      return port.getOutputStream();
    } catch(Exception e) {
      return null;
  public void outputBit(byte bit, byte position) {
    try {
      outputByte[position] = bit;
      port.getOutputStream().write(outputByte);
    } catch(Exception e) { }
}lets say outputByte has these value inside the array
outputByte[0] = 1
outputByte[1] = 0
outputByte[2] = 1
outputByte[3] = 0
outputByte[4] = 1
outputByte[5] = 0
outputByte[6] = 1
outputByte[7] = 0
and i call the outputBit method...
and this executes
port.getOutputStream().write(outputByte);
will the result be.
PIN 1 = ON
PIN 2 = OFF
PIN 3 = ON
PIN 4 = OFF
PIN 5 = ON
PIN 6 = OFF
PIN 7 = ON
PIN 8 = OFF
(ps. i have an thread class that provides constant output)
i know i know i know...i should be using c++....
if the above isnt the output wut can i do to make that?
just i case u dont understand wut im trying to do lolz. im trying to output indiviudal raw bits through the parallel ports 8 pins.
thx =)

wut i want to do is to turn leds/motors on and off through the parallel port. to do that, pin 1 would like be the right motor. and pin 2 the left motor, and like pin 3 for an led...etc...if pin 1 is on than the right motor will go if its 0 then the motor wont go....
in other words i want the program to output raw bits not bytes to the individual pins of the parallel port.

Similar Messages

  • Parallel port stepper motor

    Hi All,
    I followed the instructions on this link
    http://zone.ni.com/devzone/conceptd.nsf/webmain/72C6FC6CE4AD4D1386256B1800794596,
    in an attempt to drive a stepper motor. I used the VISA method and grounded pins 12 and 13 and tried to obtained some output with no success... Is there any other pins that I should take care of other than the data pins 2-9 and pins 12,13. I am using a mulitmeter to measure the voltage of the output data pins. I also tried the register method by using the outport.vi but also without any success. Both vis I written does not give me any errors. I tested the parallel port on a printer and it seem to be working fine. Perhaps I had missed out something? An early thanks for anyone who could enlighten me on parallel
    port output.

    Hello;
    You don't need to worry about any other pins than the ones you described. The best way to trouble shoot that is by using a Scope to catch the output line of the parallel port and to have a really simple VI just writting a high level state on that line.
    Regards
    Filipe A.
    Applications Engineer
    National Instruments

  • Parallel Port address out of range for output.vi

    Hi all,
    I know people have had this question before, but I don't seem to follow the responses.
    Basically, I have a Parallel Port connected through a PCI slot with the address BCC8, and I've been trying to talk to a stepper motor using output.vi, but as far as I can tell the address input is limited to I16 values.  Is there away to get around this?
    Hann

    Hi Hann,
    What forum postings have you been researching before posting? We need more information about your application, perhaps posting your code would be helping in resolving your issue. Are you using a particular LabVIEW toolkit like the LabVIEW Motion Control Tools or are you using VISA Read and Write functions?Where are you getting the output.vi? What version of LabVIEW are you using.
    Joshua B.
    National Instruments
    NI Services
    NI Support Resources
    NI Training Resources

  • Control parallel port (data and control lines)

    I need to control the output on the parallel port (LPT1) - Both data and control lines.  Once the data is written (Pins2-9), I then need to toggle the Sprocket signal (PIN1) - on the parallel port. The sprocket signal is also referred to as the Data Strobe Output.
    The required method is as follows:
    1. Lower the sprocket signal on PIN1
    2. Send the data (Pins2-9) and wait
    3. Raise the sprocket signal and wait.
    4. Repeat.
    I am looking for a method to control the data on LPT1 pins 2-9 and then be able to toggle PIN1 - Strobe signal - without the data falling from the other pins. What I have found is that whenever the state is changed on the strobe - the data that was written to Pin2-9 falls to zero. This will not work for my application - the strobe tells the hardware device that the data is ready. If it falls to zero when I toggle the strobe - that will not work.
    Regards,
    Guy

    Hello Adam,
    I am familiar with both references.  If you look more closely at the library reference - it allows me to communicate using VISA across the parallel port pins 2-9.  It does not permit direct communication to pin1 (the strobe signal) - property nodes don't allow the strobe to be refereced either (similar to control lines/signals for COM ports).
    Worse, I have also located examples using OUT PORT that does enable pin1 to be toggled.  The problem is, when those VIs are used, the data falls from the data pins when the strobe signal is written, even if its value is not changed.  For example, if the strobe is already high, if another high value is passed, the data falls from the data lines.  The other issue, when using VISA, as soon as the data is writen, the strobe signal automatically goes high even though I need a wait before setting the strobe high.  This is in complete contradiction to the second article you referenced which clearly discusses writing data to pins2-9 then taking the strobe high to indicate to the printer that new data is available.  It must be possible since this is the typical handshake.
    I am still looking for a more complete answer/solution.
    Regards,
    Guy

  • Push button signal to parallel port to trigger a process

    I just need to connect a push button to the parallel port to set it as a trigger signal for a process.
    When push button is pressed, labview executes a process.
    Kindly help me how to do this, the wiring please
    Regards
    Grugh Mike
    Success is Everything !!
    Solved!
    Go to Solution.

    Data Lines to be used as inputsSome parallel ports can be configured to use the data lines as inputs. It depends a great deal on the way the manufacturer designed the parallel port. With some models the data lines can be read the same way we read the control lines, by driving them to high logic so they will take on the value of an external signal. However, most parallel ports require that you set the direction bit for input. This is bit 5 in the Control register (base+2). If the port is capable of it, setting the direction bit high has the effect of making the lines tri-state so it can be driven externally. Sometimes it is also necessary to toggle bit 6 high or low. However, it should be noted that some manufacturers actually lock these bits so that software cannot change them. An example is shown below in Figure 7.
    To test whether your data lines can be used for input, try the following:
    Set bit 5 of the control register high (at base address+2).
    With nothing connected to the port, write a couple of values to the data port, and read each back after you write it.
    If the reads DON'T match the writes, your port is probably bidirectional. Setting C5 disabled the data outputs and you're reading the open inputs of the data-port buffer. If the reads DO match the writes, your port isn't bidirectional. The data outputs are still enabled, you're reading back what you wrote, and you won't be able to read external signals. If it is possible to use your data lines for input, then you just need to set control register bit 5 high and read from the value of the data lines at the base address.

  • How should I develop Level Controller using Parallel port(Printer port)

    I need to develop a level controller using parallel port of my computer with a third party Data Acquisition Device.  Is it possible to do it with In and out port vi in labView 7.1. Please guide me how can should I configure these Vis to write control data and then receive level transmitteed data through parallel Port(Printer port). My third party DAQ has two analog input channel and one analog output channel.  

    Dennis Knuston
    I have uploded the details of that  third party daq in another thread please see that and tell wether this type of daq requires driver software
    http://forums.ni.com/t5/Multifunction-DAQ/Parallel-port-based-daq-and-drivers/m-p/1819997

  • How can i us the parallel port of the printer to control a frequenz-generator?

    Hello all !
    I like to  control with LabVIEW 8 student-version, the Frequenz-generator gadget . For this challenge i like to us the parallel port of the printer. I need for data flow only 2 cable. The frequenz-generator gadget need two signal : Low and High.How  can i  us the parallel port of the printer to control a frequenz-generator gadget? I have us  the VIs-Visa  (Visa-Serial, write, Close ), but i dont no what command i have to write on the Visa-Write so that the Signal can be in the low or high position.
    Thanks

    Hi Jeanjac,
    first, look here:
    http://en.wikipedia.org/wiki/Parallel_port
    to get the port numbering. also, be sure not to leave pin unconected, sometimes you might get an error message otherwise (i remember pin11 has to be always connected or so for windows...)
    second, just run the test panel in MAX and write something to your device to check if it works.
    then in LV, you have to decide to which pin is connected your instrument. in any case you have to address all 8 output pins together! this is a parallel...
    if you prefere to use only one pin, then you can use the serial port, with just pin 2 and 3 connected. it would work easier for you, since you address only one bit.
    Gabriel
    ... And here's where I keep assorted lengths of wires...

  • 8200 elite Parallel port not run

    Hi to all,
    On my elite8200 I can not run the LPT port on my windows7 64bit port with the address but F0E0 wrong with the management software for a CNC machine.
    In the bios (updated) I can only edit the IRQ of the serial port (it looks like prunes A) For the parallel port can only choose between Standard ECC + ESP etc..
    Does anyone know help me?
    thank you very much

    Perhaps a more complete model number would help.  In looking with that  limited model number there are several listed, even an AIO unit.  In the models such as the small form factor model, there is no parallel port ( which is normally  LPT ) shown.  What actual output port is being addressed as the LPT?
    {---------- Please click the "Thumbs Up" to say thanks for helping.
    Please click "Accept As Solution" if my help has solved your problem. ----------}
    This is a user supported forum. I am a volunteer and I do not work for HP.

  • How can i write a vi in using parallel port for digital inputs

    Dear all,
    i am a beginner user of LabVIEW and i want to write a vi in using parallel port for digital I/O. After reading the article "Using the Parallel Port in LabVIEW
    " and download the parallel.zip, i know how to write the vi for output, but i still don't know how to write the input one.i've try to use a Inport.vi to test, but nothing change when i set pin2-9 to high. (my computer:win2K & LabVIEW 6.1)
    Can anybody teach me how to write it?
    Can anyone write the vi for me too?
    Thanks all!
    p.s.i've already install the "accessHW.exe"

    Are you using VISA or the accessHW VIs? You may need to goto the bios and set the parallel port to run in spp mode or standard mode. This is the simpliest configuration and where you should start.
    As far as writing the VI goes, just copy the diagram out of the tutorial you mentioned.

  • Writing a series of codes to parallel port LPT1

    Currently i'm using Labview version 5 to write a program which sets the individual pins on my LPT1, which i'm sucessful in. However, I notice that after writing an ascii to Serial Port Write.vi, it still doesnt sets the parallel port. It is only when i include close serial driver.vi after writing the string then the respective output is set.
    In my application, i need to send many ascii within a very short time frame, currently, using the above method, for 40 ascii characters that i write into the parallel port, it took the computer about 2 seconds to finish (which is too slow). How do i improve the performance of my application?

    Jared,
    I tried using Out Port.vi but when i key in 378 to the register address and key in the number for the value control and run the vi just for testing purposes, it gives a dialog "Capability not supported. VI 'Out Port.vi' was stopped at Code Interface Node 0x1BC of subVI 'Out Port.vi' . I do not have the advance analysis package and i wonder if it's that is the root of the problem for the mentioned, or have i misintepreted 0x378.
    Thanx for your attention.

  • Pulse generation on PC parallel port and its maximum frequency

    Can i generate pulse pattern on any one out of 8 lines of IEEE1284 using Labview? if yes what is minimum period and duty cycle?
    Yours sincerely

    I doubt you will get up to 2 MBps and whatever you get you will not have any real control about the timing. If you use VISA LabVIEW sends the data to the COMM port driver and that driver outputs it with whatever handshake speed the remote side answers. Also in order to use anything but the old unidirectional printer mode you need to have a device that is intelligent enough to startup in Nibble mode to negotiate the maximum mode it supports. Without any remote device that does the negotiation and handshaking there won't be any EPP, ECP or whatever other bidirectional mode.
    In unidirectional mode you can expect a few kBps at most and again the speed will be whatever the CPU is able to hammer through the parallel port. If you want to have any control of the speed you need to program the parallel port directly on register level. However that will maxout at 1 or 2 kBps at most and you should not expect any fine grained and steady speed control at that level. Windows is not realtime and trying to control anything reliably in software that is less than several 10ths of milliseconds is simply impossible without going into kernel mode and writing the timing critical parts in a kernel driver.
    Also direct access to the paralell port registers is out of question for 64 bit Windows.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • New workstation lacking parallel port poses printing challenge

    I'm supporting a Netware 4.11 + sp9 small business network, which long ago
    had a custom DOS-like database application written to manage rental
    activities. The app allows the user to print out lists of things rented,
    etc. It has been working very well for years. There are several
    workstations, some DOS, some Windows XP, etc., and they all share the rental
    database resident in the Netware 4.11 file server.
    I have had various networked printers, starting with parallel-port lasers.
    More recently I have had a large Canon printer that connects directly via
    our Ethernet_802.2 IPX (as well as IP) intranet. In other words, this
    printer works both for Windows programs, which use IP, and for our rental
    program, which uses IPX.
    What's the problem, then?
    An important Windows 2000 Pro workstation died, and I replaced it with a new
    Windows XP Pro workstation. This new Dell computer HAS NO PRINTER PORT. I
    have YET to tinker with this, as I am hoping to get this request for help
    posted as soon as possible.
    All my workstation computers "CAPTURE" print jobs that the rental program
    "thinks" are going to LPT ports. Once these jobs get into various queues, I
    have no problem getting them into printed hard copy. The problem NOW is to
    fool the DOS-like rental program, which will be running on the new Dell
    computer, into seeing some kind of a parallel port that doesn't exist.
    I suppose I could launch a major effort into modifying the BIOS of a Dell
    computer, but I am hoping there must be a better way!
    Can "net use" be of any assistance?
    Can Unix "lpt" printing be of any assistance?
    It is not likely this rental application can be chanaged. I am not the
    author.
    I read another thread regarding an "opposite" predicament. It won't help
    me, then, to buy a USB->LPT adapter box, because what's important here is
    NOT to actually connect a printer to this workstation computer, but to
    supply something (a faux LPT port) that can be captured inside this
    workstation.
    Any ideas most welcome.
    Thank you.
    John B

    This is neat. But I think the all-important DOS-like custom application
    rigidly prints only to LPT1.
    In the absence of a real LPT1, I need to find a "faux LPT1."
    Over the weekend, I'll look at this utility..."printfil."
    Thanks very much!
    "Davide Guolo" <[email protected]> wrote in message
    news:[email protected] s.com...
    > John,
    >
    > > I wonder how long it will be before no such cards
    > > are available?
    > >
    > > So any tips on "faux LPT ports" are still of interest.
    >
    > you may want to have a look at Printfil, which can capture LPT output
    > and forward it to file or directly to a Windows printer, even if no
    > LPT ports are physically available on the Windows machine.
    >
    > You can find more info and a free trial version to download at
    > http://www.printfil.com
    >
    > Regards,
    > Davide
    > aSwIt s.r.l.
    > --------------------------------------------------------------
    > Printfil - Windows Printing System for Applications
    > http://www.printfil.com
    > Odbc4All - Connection to ODBC Data Sources for any Application
    > http://www.aswit.com/odbc4all
    > @Kill - Batch Close Windows Applications - Freeware
    > http://www.aswit.com/akill
    > --------------------------------------------------------------
    >
    >
    >

  • Using stand alone executables to send data to the parallel port

    I have a executable that uses the parallel port to activate an alarm. The program works well on the base machine which is running windows XP. However when I try to run the stand alone executable on a windows NT machine there is nothing sent to the parallel port. I have updated the Cvirt file on all machines. I don't get any error messages when running the stand alone executable.

    I have the same situation using parallel port to control a hot swap PCI extender card and no error showed.  I can turn on/off and read correct voltages from the card in base machine.  After creating executables, I can turn on/off the card, but got wrong voltages in target machine.
    I've installed AccessHW in both machines and copied AccessHW.dll and cvirte.dll to system32 folder and the folder same with executables.  I also tried installer with port support and serial support checked. 
    Windows XP is in both machines and LV 7 in base machine.  I use "Output Byte to Port.vi" and "Input Byte from Port.vi" in AccessHW lib.
    One thing I observe is initiation.  The card manufacturer provides a program with same functions.  After running their program, the voltage readings from the executables become correct.  The readings remain good after closing their program.  I close the executables and run the executables again and still see good results unless restarting the target machine.
    Any solution for the problem? Thanks in advance!

  • Using Parallel Port with Outport.vi Problem

    Hello,
    I am trying to use my parallel port to control a relay network and have run into a problem. I am using the outport instead of visa because for some reason I get an error with visa and outport seems more simple. The problem I am having is that my program doesn't seem to be able to initially take control of the port. What I mean by this is that if I restart the computer and open/run my program, I get an incorrect output on the parallel port. However, if I run one of the example programs for controlling the paralle port using outport (attached) (I believe the one I use is called Reading and writing to parallel port using loops) I am able to control the output to the parallel port. Also, after the example has run, my program works correctly. However, if I restart my computer again and run my program first it can no longer control the port correctly. So the problem seems to be that my program isn't initializing the port correctly or assessing it right at the beginning of the program. However, looking at the example program I don't really see what they are doing that I am not. I have the correct port address. 
    My program takes values from a text file and displays them on the port and that works correctly. 
    Attachments:
    CircuitTopModule.vi ‏26 KB
    parallel port examples.llb ‏72 KB

    Hi Jag213, I'm glad you were able to resolve the issues you discussed on the other forum related to this issue.
    Now that you have it working, I would recommend a few things:
    1. Just try modifying one of the existing examples and see what you can get away with removing in order to keep it working the first time.
    2. Try modifying the timing on your example - 10 seconds is a long time to wait between each week, I wonder if you are getting a time out? Do the examples work when you insert that kind of timing delay?
    3. Add the In Port.vi into your code - this may be related to getting your Out Port.vi to work correctly.
    4. Your code controls 8-bits on the parallel port, while the examples control 32-bits. Do all 32 bits need to be initalized? Looking at the Parellel Port Read and Write Loop.vi Example, in the IO Connector Status, the 31st bit controls whether the target is initialized.
    Play with these settings and see if you can get yours to work the first. If all else fails, build your program to run off of one of the examples. For example, have the while loop run once, and then call yours as a SubVI.
    Good luck!
    Joey S.
    Software Product Manager
    National Instruments

  • Question: serial/parallel port

    Hi, I am trying to control a simple digital switch using labview and either
    my serial- or parallel port. I want to control each individual pin on the
    port: to turn on/off +5V on the output pins. Does anybody now how? Is it
    possible? I am running labview 6.1 on W2k.
    Thanks in advance

    Hi Luca, JS & Pawel,
    in general everything is correct, but I would suggest to use the "Out Port" and "In Port" functions from LabVIEW. Have a look to the simple printer_port_test.vi. This also needs the accesshw as already explained.
    In addition I recommend to use buffer-circuits in between LPT and an application in order not to destroy the motherboard-Chips by accident !!
    Regards
    wha
    Attachments:
    printer_port_test.llb ‏52 KB

Maybe you are looking for