Linux parallel port

Dear All,
is it posible to read and write registers in the io address space under linux. I want to use  the  parallel port to  turn on/off some LEDs and check the state of several switches. I have done this with windows 2000, but i cannot find any solution for linux.
cheers,
Frank

There are several solutions for your problem. The most simple is to create a shell script that control the state of the parallel port and call "execute" from LabVIEW. 
Using http://parashell.sourceforge.net/ is simple: (http://parashell.sourceforge.net/docs/parallel.txt)
----- How to use the program -----
parashell is a very easy to use program. The program takes two parameters, the Parallel port to send the data to and
the data value to send. That value must be integer in decimal format (for example 255). Hexadecimal
numbers can also be used, but they must be preceded by 0x (for example 0xFF). The program uses very little error
checking to keep it simple.
Example how to use parashell.
parashell 0x378 0
Set all datapins to low level.
parashell 0x378 255
Set all datapins to high level.
parashell 0x378 1
Set datapin D0 to high level and all other datapins to low level.

Similar Messages

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

  • Help needed urgent please ( parallel port access in linux)

    hi all, i am trying to read and write data to /from the parallel port , i am running IBM j9 vm on linux.under /dev there are lp0..lp3 parport0..parport3, and port devices , i dont know which one to use , i have tried all , they all return with an ioexception saying "cannot find the file" except for port device which does not generate any error but it does not return what i have written on it ,
    any help would be much appreciated.
    i am using fileoutputstream and printwriter calsses .
    i dont want to use javax.comm api cause i think its incompatible with ibms visual age micro edition ( the one i am using ) so i would prefer something that works with my IDE .
    thanks
    yahya
    [email protected]

    However, there is an on-going OpenSource version called "RXTX" (http://jarvi.ezlink.com/rxtx/) that works quite well. Be sure to read all the documentation that comes with it, as you'll need to set some permissions on the ports you want to use.

  • Problem in sending data to parallel port

    Hello,
    I can open a parallel port (LPT1) using java comm api i,e javax.comm.
    but problem in sending data to parallel port,
    I choose the appropriate port(LPT1), it is in bi-directional mode according to BIOS configuration.
    but according to the java program the mode is SSP.
    when i write data to parallel port the volt-meter give a reading of high state for all data pin (pin1 to 9) i,e the parallel port doesnot change state. I am using windows XP.
    What is the solution?

    try it on Open Solaris 10 or Linux platform.
    also just try using the new FileWriter("LPT1").write("Hello");
    on windows platform
    Pravin

  • Parallel port programming for a Sun Ultra 5 running Solaris 8

    Hi I'm trying to look for information about reading/writing to the parallel port of a Sun Ultra 5 running Solaris 8. I'd just like to see some basic programs written in C, nothing fancy, just reading and wrting to the port, getting the port address etc. toggling the lines.
    I've tried searching for this information and there is plenty of information about PC parallel port programming with windows or Linux. But there seems to be little for Sun's
    I've tried doing 'man ecpp' but that doesn't really give any clear example. What I need is an idiots guide.
    I've tried searching this Forum and I see that other people have asked the same question before but no one has replied to them. Why is this?
    Thanks if you can help.
    fishman.

    The key is gettting the port into diag mode. Here's a quickly little example that turns all the data pins on and then turns them off:
    #include <sys/types.h>
    #include <sys/conf.h>
    #include <sys/stat.h>
    #include <unistd.h>
    #include <stropts.h>
    #include <fcntl.h>
    #include <stdio.h>
    #include <sys/ecppio.h>
    int fd = 0;
    // ecpp structures
    ecpp_transfer_parms etp;
    ecpp_regs eregs;
    // returns -1 if error otherwise returns fd
    int openoutput()
    fd = open("/dev/ecpp0",O_RDWR);
    if (fd==-1) { return -1; }
    // default is 90
    etp.write_timeout = 10;
    // the big secret
    etp.mode = ECPP_DIAG_MODE;
    ioctl(fd,ECPPIOC_SETPARMS,&etp);
    return fd;
    unsigned char in()
    unsigned char data;
    // from the man pages
    ioctl(fd,ECPPIOC_GETREGS,&eregs);
    data = eregs.dsr;
    return data;
    void out( unsigned char data )
    write(fd,&data,1);
    int main( void )
    int dummy;
    openoutput();
    //all data pins on
    out( 255 );
    scanf("%d", &dummy);
    //all data pins off
    out( 0 );
    scanf("%d", &dummy);
    close( fd );
    return 0;
    }

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

  • Using parallel port

    Hi, i will use labview for my thesis project and i plan to input my data via parallel port.
    My input data is 8 bits so i tried to use control and status lines of the parallel port.
    I used the method that is described at NI`s developer zone web page which shows using control and status lines.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/72​c6fc6ce4ad4d1386256b1800794596?OpenDocument
    By using that method i achieved to input first 4 bits of my data over status lines while there were no change at those of control lines.
    Because my data that i want to input consists of 8 bits, i could only be able to manage half of it.
    what can i do for using control lines?
    Or as a second alternative, is there any way to input 8 bits over data register?
    Below i have attached the code that i had written to input by using control and status registers.
    Attachments:
    can1.vi ‏30 KB

    Well, I looked at your VI and it looks like you have everything setup right. The only thing I can think of is that you are not grounding the control lines when you want to set them low.
    As far as your second question is concerned some parallel ports can be bidirectional. The article that you provided explains how you can test if you parallel port is bidirectional, and gives an example on how you would read and write from the data bits.
    Also, you may want to try the two parallel port shipping examples in LabVIEW. There is one that uses the data bits, and one that uses the status and control registers. You can find these examples by going to Help>>Find Examples, then search for Parallel.
    Shawn B.
    National Instruments
    Use NI products on Linux? Come join the NI Linux Users Community

  • How to enable parallel port DC5800

    This PC has header pins on the motherboard for a parallel port and I have connected a header cable but linux does not recognise that the computer has any parallel port hardware. There also seems to be no way to enable or disable the parallel port in the BIOS although it does have a setting for the printer port mode. The parallel support is described as "optional" on this PC, is it possible that the port cannot be enabled on this model?
    Additional: I just installed Windows and it's the same. It really seems like the parallel port is disabled at BIOS level and cannot be activated.

    869578 wrote:
    Could you give me a sample query using by the above example query?
    What kind of hints are needed in order to invoke multiple db link? As I said - this (distributed PQ across db links) is not supported. PQ needs to run inside a single database.
    The only time that PQ runs across servers, is with an Oracle RAC database. But even then, PQ runs inside a single physical database.
    If you want to use parallel processing across databases via db links, you need to code and implement that yourself.

  • Parallel Port Help. Please

    Dear friends,
    Am developing an application that is to use the javax.comm package under a Linux (Fedora Core 5) system. However am quite stuck when it comes to sending a signal to a specific 'wire' off the parallel port.
    I have read about the configuration of the parport that is in such a way:
    1      Not normally used
    2-17      Data ports
    17-25     Ground
    so that if I want to send a signal to port 2 and ground I will open the port and transmit the signal 0100000000000000000000000 correspoding to the various port wires. This is, however, not working since the ports are giving me a HIGH signal through the entire time even when no signal is being trandmitted. How can I work around this or is there an easier or better way to go round this?
    This is the class I use to open/close the ports
    package controllers;
    import javax.comm.*;
    import java.io.IOException;
    import java.util.*;
    import java.io.OutputStream;
    import java.io.InputStream;
    * This class forms the base of all communication port events
    * It opens and closes ports and sends packets of data through the
    * serial and parallel ports
    public class RS232BaseClass
        private SerialPort portName;
        private ParallelPort parPort;
        private CommPortIdentifier portID;
        private OutputStream portOut = null;
        private InputStream portIn = null;
        private boolean isParallelPortOpen = false;
         * The class constructor
        public RS232BaseClass()
            portName = null;
            parPort = null;
            portID = null;
            portIn = null;
            portOut = null;
         * Method to re-init everything
        public void reInit()
            this.portName = null;
            this.parPort = null;
            this.portID = null;
            this.portIn = null;
            this.portOut = null;
         * Method to retrieve list of ports in OS
        public void getListofPorts()
            System.out.println(
                    "Getting the List of Ports configured in this server");
            Enumeration pList = CommPortIdentifier.getPortIdentifiers();
            while (pList.hasMoreElements())
                portID = (CommPortIdentifier) pList.nextElement();
                System.out.println("Port :[" + portID.getName() + "]");
         * Method to open specific port required
        public void openPorts(String toOpenPort)
            System.out.println("Process is opening port: [" + toOpenPort + "]");
            // Retrieve the port
            try
                portID = CommPortIdentifier.getPortIdentifier(toOpenPort);
            catch (NoSuchPortException e)
                System.out.println(
                        "No such port available to retrieve - Program will Exit!");
                e.printStackTrace();
                System.exit(1);
            // Open the port
            if(toOpenPort.startsWith("LP") || toOpenPort.startsWith("/dev/parport"))
                try
                    parPort = (javax.comm.ParallelPort) portID.open(toOpenPort, 30000);
                    System.out.println("Port opened successfully!");
                    this.isParallelPortOpen = true;
                    // Get Output Stream
                    portOut = parPort.getOutputStream();
                    // We do not get InputStream since Parallel port does not support input
                catch (PortInUseException e)
                    System.out.println("Port is in use - Program will Exit!");
                    System.out.println("Owner is [" + e.currentOwner + "]");
                    e.printStackTrace();
                    System.exit(1);
                catch (IOException ioe)
                    System.out.println(
                            "IO Exception during stream IO - Program will Exit!");
                    ioe.printStackTrace();
                    System.exit(1);
            else
                try
                    portName = (javax.comm.SerialPort) portID.open(toOpenPort, 30000);
                    System.out.println("Port opened successfully!");
                    // Get Input Stream
                    portIn = portName.getInputStream();
                    // Get Output Stream
                    portOut = portName.getOutputStream();
                catch (PortInUseException e)
                    System.out.println("Port is in use - Program will Exit!");
                    System.out.println("Owner is [" + e.currentOwner + "]");
                    e.printStackTrace();
                    System.exit(1);
                catch (IOException ioe)
                    System.out.println(
                            "IO Exception during stream IO - Program will Exit!");
                    ioe.printStackTrace();
                    System.exit(1);
         * Method to set the port parameters
         * @param baudrate the baud rate of communication
         * @param dataBits the data bits of communication
         * @param stopBits the data bits to signify end of message
         * @param parity the parity rate of communication
        public void setPortParameters(
                int baudrate,
                int dataBits,
                int stopBits,
                int parity)
            try
                portName.setSerialPortParams(baudrate, dataBits, stopBits, parity);
            catch (UnsupportedCommOperationException ucce)
                System.out.println(
                        "Unsupported Comms Operation - Program will Exit!");
                ucce.printStackTrace();
                System.exit(1);
         * Method to set Port Wait timing - Different for different devices
        public void setPortReceiveTimeout(int timeOut)
            try
                this.portName.enableReceiveTimeout(timeOut);
            catch (UnsupportedCommOperationException ucce)
                System.out.println(
                        "Unsupported Comms Operation - Program will Exit!");
                ucce.printStackTrace();
         * Method to Read contents from the port
        public String readPort()
            System.out.println("Reading From port...");
            StringBuffer buffer = new StringBuffer();
            int ch = 0;
            try
                while ((ch = portIn.read()) != -1)
                    buffer.append((char) ch);
                portIn.close();
            catch (IOException e)
                e.printStackTrace();
            System.out.println(
                    "String read is ["
                    + buffer.toString()
                    + "] Length is "
                    + buffer.toString().length());
            return buffer.toString();
         * Method to write contents to the port
        public void writePort(String outToPort)
            try
                portOut.write(outToPort.getBytes());
                System.out.println("Writing out [" + outToPort + "]");
    //            System.out.println("Data written out successsfully!");
            catch (IOException e)
                System.out.println("IO Exception during Writing to port");
                e.printStackTrace();
         * Method to close the port
        public void closePort()
            System.out.println("Closing Port");
            if(isParallelPortOpen)
                this.parPort.close();
            else
                this.portName.close();
            System.out.println("Port closed successfully!");
    }Thanks.

    After much googling and searching all over the web, I found out that package javax.comm is just redundant and, for a lack of more appropriate word, useless. The same goes for package rxtx. However, I came across something called parport that gives excellent output in very simple ways :)

  • Parallel port to usb cables

    Hi guys,
    I just bought a new PC for my parents (Dell Inspiron, Merry Christmas...), and realized only this morning that it doesn't have a parallel port to support their antique laser printer (which still works well).
    I did a quick search and found these Parallel Port to USB cables:
    http://www.tigerdirect.ca/applications/ … &CatId=471
    http://www.thesourcecc.com/estore/Produ … ct=2608263
    I prefer the latter because tiger direct charge way too much for shipping and there's a The Source in town here.
    Will these work with Linux -- they claim its seamless, but I can imagine cups possibly getting confused if it expects a parallel port and gets USB? Any idea how they work?
    Also, the printer is from 1994, will it work with a IEEE-1284 parallel port, or were they using EPP or something else back then?
    I could also get a PCI parallel port adaptor, but you've probably heard my horror stories every time I open a case. ;-)
    Thanks for any advice!
    Dusty

    I was just given an old Canon BJC-1000 printer with a parallel to USB adapter today. Cups does find the printer and will print on it. My only problem so far is that the page is shrunk down to about 1/16 of its original size! It's very funny but not real convenient.
    Edit
    Never mind that. It works!!! Readjusted everything in the CUPS config, restarted my application, and all is well.
    Last edited by skottish (2007-12-26 01:49:54)

  • K9A plantinum and Parallel Port. [closed]

    Greetings,
    I'm wondering bout the parallel port settings in the bios.   
    What settings are recommended for Vista 64.  I've tried most "common" settings without luck. :(
    I've been trying to get my hp2100 to function under vista and linux, but just cant get it to operate.
    I'm starting to fear a defective MB.   In fact vista has been terribly unstable on this system.
    I've verified the RAM with memtest.
    I've had the printer functioning perfectly on a prior computer.  Normally windows auto detects the hp 2100.  I get nothing from vista.... thought the hardware manager does say the LPT for is operational.
    comments?  Suggestions? 
    Thanks

    Any answers to those?:
    Quote from: Bas on 16-December-07, 09:39:26
    What HP 1200 might this be?
    LaserJet, DeskJet, what???
    HP has hundreds of devices that have the number 1200...
    What you have tried from those and what are the results?:
    Quote from: BOSSKILLER on 16-December-07, 07:02:54
    "Next I tried ECP DMA 1  This also did not detect the 2100 but I was able to finish the wizard, but alas I was still unable to print.  Testing the printer stated that the test sheet was sent, but the printer never responds."
    Check printer cable connections, try change printer port, switch to EPP+ECP.
    Pickup latest drivers from HP for your Printer:
    http://h20000.www2.hp.com/bizsupport/TechSupport/ProductList.jsp?lang=en&cc=us&prodTypeId=18972&prodSeriesId=25469&taskId=135

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

  • Control Parallel Port using Python!

    Hello, I've coded a new library for python which only purporse is to control the parallel port natively. It uses a C lib ported to python by me(although the C functions to handle this are really simple, all credits go to its original author Juan Gabriel del Cid Portillo) and what I like more about it in python is the interactive mode it offers! check sample code and more information at http://devpower.blogsite.org (in spanish).
    By the way, this is for linux only by now, windows is supported too but I don't have a windows system to compile it, if you want to you can compile it your self since the code for the C lib is included. I hope anyone can find this useful (say goodbye to pyparallel! no more Java deps!). Direct Download Link: http://devpower.blogsite.org/data/files … arport.zip
    Edgar Merino

    This is a frequently asked question. I'd dare say it probably gets asked once each month. You should look at this article:
    Using VISA to Access the Parallel Port in LabVIEW
    In a nutshell: You have to write/read by port. You cannot read/write by bit. This means that if you want to change the value of a single line you have to read the current value of the port, mask it to get the new value that has the line you want changed, and then write out the new value of the port.
    If you also do a search in this board, or on the NI site for "parallel port labview" you will find lots of hits.
    Message Edited by smercurio_fc on 04-09-2007 04:18 PM

  • Problem with JNI and Parallel Port dll

    Hi. I'm doing some testes with JNI. Firs i followed the netbeans tutorial for doing a C programa that prints somthing for java.. like.. "Hello java from C".
    So i tried to load a dll from my dll. Like, I have this dll to use the parallel port on windows Xp. So i created a dll to access it an comunicates eoth java.
    I did everything just fine.
    When I start my Java app, the first thing it does is to load this parallel port dll and configure the functions of it.
    After that .. I get this error
    EXCEPTION_FLT_STACK_CHECK (0xc0000092) at pc=0x0093d269, pid=2284, tid=3000
    Can someone explain why ?
    (Sorry if i wasn't clear enough, english is not my native language, so ask if you don't understand something.. )

    hi ,
    I met the same problem this morning, and searched the www.google.com in order to solve it, as a result, your article was shown on my screen. :)
    Till now I have read some technical information and solved my problems. Maybe the solution be useful to you:
    ==============================
    error message : (Environment : Tomcat 5, Windows 2003, Mysql5)
    2006-3-29 11:53:48 org.apache.catalina.core.StandardWrapper unload
    message: Waiting for 2 instance(s) to be deallocated
    ==============================
    cause: the number of connection to database exceeded.another word,too many connections.
    ==============================
    solution: close the connection when it becomes useless for your program. :)
    ==============================
    ps. Sorry for my weak English . hehe ....

  • 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

Maybe you are looking for