Setting Pins on Parallel Ports

Ok - going crazy - am trying to run a motor via parallel port - have a basic c app that does this but need to translate it into java. The code runs fine but no data is getting to the motor. Have tried with both a PrintStream and BufferedOutputStream but neither work (if they are in fact the prob)- this is what i have for the write methods.
public void getOutStream(){
bos = null;
try {
//bos = new BufferedOutputStream(port.getOutputStream());
pos = new PrintStream(port.getOutputStream());
System.out.println("_GET_OUTPUT_STREAM_");
} catch (IOException e) {
e.printStackTrace();
public void write(){
int [] b = {0x19, 0x39, 0x13, 0x33, 0x16, 0x36, 0x1c, 0x3c};
for(int i=0; i<b.length; i++){
pos.write(b);
//bos.write(b[i]);
delay(500);
Have checked out the forums and a couple of people have mentioned setting the pins on the port to set values - how and where can i do this? and will it do the trick? Maybe someone can see something wrong with the code that i've missed?
Any help will be HUGELY appreciated - cheers

You must to forces the buffered output bytes to be written out to the underlying output stream.
To do this use the flush method.
public void write(){
int [] b = {0x19, 0x39, 0x13, 0x33, 0x16, 0x36, 0x1c, 0x3c};
for(int i=0; i<b.length; i++){
pos.write(b);
//bos.write(b);
// put here if you want to flush after write one byte.
bos.flush();
delay(500);
// or here if you want to flush only after write all bytes.
bos.flush();
}

Similar Messages

  • Signal detection on pins of parallel port

    hello,
    i am using the outport.vi in order to write to the parallel port of my windows 98 pc. I am writing a value to the port register. To detect that, i am trying to detect a signal change directly on the pin of the parallel port using an oscilloscope. I don´t detect anyhting although the vi ran without complaining. What am i doing wrong ?
    saludos
    miriam

    Hi miriam,
    I never used the access to parallel port from LV but from C based programs. As I know outport should do under Win 98.
    Are you aware that the port nubmer is in Hex? The address can change if you have one or two parallel ports in your machine.
    If you have one port it is 0x378 for LPT1.
    If you have two ports it is 0x278 for LPT1 and 0x378 for LPT2.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Can we read the status of a particular pin in the Parallel port(LPT1)?

    Hi,
    I have a Camera.I'm trying to read the status of the camera by connecting it to the parallel port.The camera has a DB26 ,high-density I/O connector .A high level on pin 19 indicates that the camera power is switched on(+5v =on ,0v=off).I want to read the status of this pin by connecting it to the parallel port.Can i read the status of a particular pin in parallel port thru LABVIEW? if so how ? Any help in this regard is appreciated.

    Rajesh,
    You may find the following tutorial useful:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/72C6FC6CE4AD4D1386256B1800794596?opendocument&node=DZ52058_US
    Regards,
    Khalid

  • Writing to parallel port

    i need to be able to write to the parallel port on a desktop computer
    to control a stepper motor.  I need to be able to write logic high and
    low
    at certain pins that go to a stepper motor driver.  The writing to the
    port needs to be done so many times, or so many steps that are entered
    into the interface. Pins7 is the clock that that starts the stepper
    motor control in the stepper motor driver.  Also, pins 9 and 10 need
    to be driven low or high to tell driver wether half or full step and counter clockwise or clockwise.
    Basically i need to know how to set up my parallel port on my labtop in labView 7.1?
    I want to be able to use the write to digital I/O.vi to send the proper
    binary or hex value of an index array  to the parallel port
    to drive the motor driver.

    Hi exavier,
    Look here maybe someone else hase asked.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Java and parallel port

    I don't know if this is forum I should ask this question but I didn't find any corresponding
    to java and ports control.
    I'm using Aurox 11.0 linux.
    I wonder if I could control each output (DATA pin) of parallel port separately in
    Java Communications API?. I can control outputs in Java with JNI but I need to run
    program as root. If I would want to create applet which would use parallel port
    I would have to create server with which this applet would communicate (Limitations of
    applets). But this server would have to run as root. It would affect security of system.

    Because of C++ ioperm function. This function requires root privileges. I have JNI Java
    program which can control outputs of parallel port on the level of one byte (write
    whole byte - all DATA outputs) and C++ program which can control outputs of port separately (control of each pin) and both are based on ioperm function. Both require
    root privileges. So my question is: can I control each output pin separately with Java Communications API?. Maybe if I used wholly Java code I could access port with user privileges?.

  • RXTX Parallel port communication with Pin Printer

    I have successfully installed and configured RXTX-2.0-7pre1 on Linux platform.
    2 printers, one Laser jet printer connected to the Serial port and the other Pin Printer connected to the Parallel port.
    I can print my files out successfully with RXTX on both my 2 printers. But, there is some problem with my Pin Printer performance. The print job is a little slow and the printing is word by word output.
    While the Laser printer received the whole string of my RXTX output and printed them out asap.
    RXTX read my data and write them to the Parallel/Serial port directly, so, for my laser jet printer, it buffered the RXTX output data and processed them all in one. No problem, laser printer works well. But to the Pin Printer, it got the RXTX output and printed them out with no buffer. I am not authorized to deal with the Pin Printer device driver.
    So, my question is that, is there someone knows how to resolve this problem on RXTX side? That is to say, how to modify the source code of RXTX and customize it?
    I wanna know how to create buffer in RXTX, for example, buffering a whole string line and then sending them to the Parallel port. Then, It supposed to be that the Pin Printer will receive once a whole line output and printing line by line in the paper! Not the problemly slowly word by word output!
    Thanks a lot!

    Simple metrics from google should suffice the SUN team from understand the need/huge requirement for supporting Serial and parallel port programming in windows. Platforms would always change and the team at SUN should remain commited in supporting new platforms.

  • Controlling pins on the parallel port

    Hey
    I'm writing a program in  labview to controll a matrix card with labview. For that I'll use the parallel port. On  the datasheet it says  that only one off the pins shall send data serial into the card, and others are pins for update. clk etc.
    So I need help on how to configure the parallel port to  send different  things to the dedicated pins.
    jonas

    Hi Jonas,
    your task is a typical  SPI - communication ( like it is used for many chips - A/D  or D/A- converters; µC's etc. )
    Find attached a SPI-example-program (LV7.1.1), ( 16 Bit in this case )  - there you will see the mechanism, how to
    serialize Data @ LPT - Port and how a clock and /CS signals are added.
    I think with all my comments inside the Diagram you should understand, how it works.
    Switch the yellow light bulb "ON" and step through the program in Debug mode - every single clock and
    Data change can be observed  .............. or use a scope in "loop mode".
    If there are still open questions - let me know.
    Regards
    Werner
    P.S. Next time you should first simply type "parallel port" or "SPI"  in search line.... on this forum you will
    find a lot of threads about this issue........
    Attachments:
    project xx SPI.zip ‏92 KB

  • PICO DrDAQ USB Parallel Port setting for labview 8.2

    Hi,
    I have a PICO DrDAQ card (parallel port) and by using USB Parallel Port  (USB)connect to the laptop, and i already install this software. I can run DrDAQ with PicoScope(DrDAQ software) and can produce a result, but when i try to run it in LabVIEW 8.2 there's no result generated from it. Furthermore, i had check through the device manager (in My Computer=>System Properties) and prompt to see the Pico parallel port within the USB controllers. Therefore, i would like to know is there any setting i need to perform so that the problem can be solve.
    Thanks.

    Hi,
    Thanks for your reply. Ya before the driver installed, i specify the USB port for this device to used on and after that i set it to port 101 (for USB) in the LabVIEW.
    and the programming is on the attach file.
    thanks.
    Attachments:
    DrDAQ.vi ‏32 KB

  • Is it possible to get direct access to parallel port pins under Windows NT? What can I do

    to get such an access under NT? I found Write to Parallel Port.vi but I can`t open it. The error that occurs is:
    resource not found, error occured while loading the vi, labview load error code 8: could not load vi ressources.
    This vi is from 1994. Maybe the source of trouble is that I`m using version 5.1.1 or it is a problem with NT. What do you think?

    Parallel Port.vi can only be used in DOS-Systems (like Win9x, WinME ;-). NT does not allow writing to parallel port with low level routines. It is more useful to use the digital port that is on most of the DAQ cards.
    Some more informations on parallel ports: http://www.lvr.com/parport.htm
    In general it seems to be possible. Somebody told me just to use the write port command with the address of the parallel port. Another way seems to be to tell NT to allow direct port access - but I don't know how.
    Andreas

  • 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

  • Parallel port under linux

    could anybody help a linux-labview beginner?
    i'm trying to write to my parallel port. but labview is obviousely not set
    up for this. does anywone happen to have a vi which can do that?
    best of regards
    michael h. fischer
    ============================================
    cell: +43 664 1254415
    fax: +34 664 1265930
    icq: #61578912
    vienna university
    institute of geology
    geochronology laboratories
    althanstrasse 14 / 2a482
    a - 1090 vienna (austria)
    web: www.univie.ac.at/geologie/fischer/
    wap: www.univie.ac.at/geochron/wap/
    ============================================

    "michael h. fischer" writes:
    > maybe i didn't comunicate here.
    > i don't intend to print anything out but i want to set each pin of the port
    > hi or low. i'm trying to turn some electrical relay-switches on and off.
    >
    > thanks anyway, all these hints are useful to me
    Michael,
    So using an true ASCII printer or dircetly /dev/lpx is the easiest
    solution. Just "print" the ASCII charakter representing the bits to
    set.
    Johannes Nieß
    >
    > "Johannes Niess" wrote in message
    > news:[email protected]..
    > > "michael h. fischer" writes:
    > >
    > > > could anybody help a linux-labview beginner?
    > > > i'm trying to write to my parallel port. bu
    t labview is obviousely not
    > set
    > > > up for this. does anywone happen to have a vi which can do that?
    > >
    > > Michael,
    > >
    > > I'm not sure how you adress the parallel port.
    > >
    > > Writing directly to an I/O port is not allowed for security
    > > reasons. There are VI's to do the required system calls.
    > >
    > > You might be able to use the (old) serial VI's with a high serial port
    > > number. You can look up the port number on a LV version for Windows.
    > >
    > > I'd use a completely different strategy: VISA can address parallel
    > > ports. With Windows you just use ASRL10. You might need some tweaking
    > > of the VISA preferences files to do it.
    > >
    > > Printing data to a parallel port should be done with the tools
    > > designed for it: System Exec: lpr file.txt
    > >
    > > Does someone have a summary of the options for reading the parallel
    > > port and setting control lines via the described methods?
    > >
    > > Johannes Nieß

  • [WinXP/Lab​View7.0]Re​ading parallel port is too slow...

    Hi,
    First I would like to apologize for my English. I'm from Switzerland....
    I'm trying to read out a 16Bit A/D in 1us steps. Serial Communication over a PIC is too slow, so I was looking for a faster option. I found out there is possibility to read from the parallel port:
    I downloaded and installed the AccessHW drivers. I found 2 Vi's (see attached files) to read and write to the port. But this works only very slow. (100Hz read frequency).
    By the way I need some advice how to use 16 bits in minimum as inputs. When I set the bit 5 in Baseregister+2 I can read the Baseregister. I can read the whole byte except bit 3. This bit stays always high (3.4 VDC).
    The 5 status bits from Baseregister+1 I can
    read with no problems but the read frequency is around 100Hz too...
    The 4 control bits from Baseregister+2 I can't access. I followed the instructions in this link: http://zone.ni.com/devzone/conceptd.nsf/webmain/72​C6FC6CE4AD4D1386256B1800794596?opendocument#4 to make this 4 bits inputs, but it doesn't work. I set the Baseregister+2 00100100 (all of the 4 bits are high) and then I start to read out the Baseregister+2, but there are no changes, when I connect one of the 4 pins to ground.
    Hope there is anyone who can help me..!
    Greets
    Attachments:
    Input_Byte_From_Port.vi ‏20 KB
    Output_Byte_To_Port.vi ‏12 KB

    If you're trying to acquire a 16-bit sample at 1MS/s, using the parallel port, it will not work. In fact, many full-fledged DAQ cards do not support this high sampling-rate/resolution combination. Look at what NI has available here, in the S and E series DAQ boards--this should give you a feel for what's out there and what a professionally manufactured piece of equipment is capable of:
    http://sine.ni.com/apps/we/nioc.vp?cid=10955〈=US
    http://sine.ni.com/apps/we/nioc.vp?cid=1038〈=US
    As you noted already, a parellel port is going to be extremely slow for your needs, and likely not only be slow, but also have a pretty fair amount of timing jitter, since the timing of your read calls will be indeterminate. I would definitely recommend you look into som
    e other hardware acquisition option besides your parallel port... it won't get you very far unfortunately, because that isn't what it's really designed for.

  • 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.

  • HP color laserjet 4600 parallel port is wierd need help to identify

    Hi I have a laserjet 4600 and it has a wierd looking parallel port and I can't seem to find out the name for it so I can buy it online. I have tried looking for it online but the only thing that comes up is the IEEE 1284 36 pin parallel port. Can anyone help me identify this port so I can connect it to my computer?
    Thanks

    dan4757 wrote:
    I am running windows 7 64 bit trying to connect to a HP color laser jet 4600. We have tried multiple times to get a Notebook to load the driver. Everything works and asks to print a test page. When you press print test page nothing happens and nothing will print. 
      This is a working printer. It is presently hooked to a network and it works from it. I am trying to make it work from my notebook. I am using a ethernet cable wired directly to the Jetdirict card. 
      Do I need to set up a network. I know the IP of the printer and can not access it from the Notebook.
    This should work for you.  I've installed several printers using a Jet Direct this way:
    Install the printer manually.  Go into Devices and Printers -> Click "Add a printer" then select "add a local printer" and select the option for "Create a new port - Standard TCP/IP Port" and click next.  Type the IP address of the printer into the Hostname/IP Address field then click "next" -  Choose Hewlett Packard Jet Direct from the Standard drop down menu then click next.  You will need to select your printer model/driver from the list and then click next.  

  • Parallel port read with a CIN

    I need to read the status of a pin of the parallel port from within a Labview CIN.
    I intend to use this as a trigger for multiple camera acquisitions, and going back to Labview to read this value would not be fast enough.
    I know that under windows XP I need to "unlock" access to this port. I used a set of functions called "winio" to do this. This works fine from a regular C program, but won't work from within a CIN. Does Labview lock the use of the parallel port in any way?
    Does anyone know what I should do ?
    Thanks.

    Tchill wrote:
    Does Labview lock the use of the parallel port in any way?
    Does anyone know what I should do ?
    Thanks.
    Hi Tchill,
    I can't remember Win-XP causing trouble with the parallel port. But I do know about the security feature which does not allow to change the parallel port IO addressing (that's another topic )
    If you are running LV7.0, you can do a search example on parallel port. There are a couple of very useful vi's that you can run right away and it should get you going.
    You can also check this thread.
    or more directly into the developer zone for a tutorial by clicking HERE.
    JLV

Maybe you are looking for

  • Feature Requests beyond BlackBerry OS10.3.1

    So, with 10.3.0 and 10.3.1 now officially released on the Passport and Classic, let's look forward! What feature request(s) would you like to see included in future updates, say OS10.3.2 and beyond? Of course, there's nothing official to this thread,

  • Updated to Bundle 3049...and Now Can't Access my Email

    Hi there!    I have an issue. I updated my bundle for OS 6.0 to 3049 (from 2409ish) today (Dec. 10, 2011). Since I was out and about, I updated via OTA rather than thru the comp. So far everything is A.O.K, and not haywire...sort of. Every time I try

  • Pages 5.0 won't let me add a new page to a 13 page document.

    Since updating to Pages 5.0, I have not been able to add anymore pages to a 13 page document I am working on for an art project. The document uses original photographs as a background and a text box over them for the text. In the "Insert" drop down b

  • Material price in PO depending on quantity

    Hi All My requirement is that for a particular material and plant if I make a PO of quantity greater than 1000 then system should propose me price of material as 1000 INR but if I make PO of quantity less than 1000 then system should propose me price

  • I photo  does not open always says Loading photos

    I have a similar problem to a previous post and found where the photos are on my hard drive. However when I open I photo all I get is "loading photos" I am new to the Mac and need to load new photos from my camera as well as sort the old files and pe