Programming Parallel Port

Hi all!
I'm new with java and I would appreciate some help!
What I'm trying to do is to control an external device, like 8 LEDs, to turn them on and off using parallel port, data lines( pins 1....9 );
Maybe someone of you guys already had made this and you could give me some tips or some direction to follow.
What I already know is that I have to set one of the parallel bits to +5V and some of them to 0V in order to simulate that the device(printer) is ok.
I know that I have to use additional library "comm.jar" but in this package there are no useful methods in order to control data lines.
Maybe I am missing something!
Thanks

Try this one: [http://rxtx.qbang.org]
It's a library for communicating with the seriell and parallel port.
Here [http://en.wikipedia.org/wiki/IEEE_1284] you will find some helpful links about how the parallel port works.
And if you stick to the comm.jar, have a look at ParallelPort.getOutputStream()
Edited by: yawah on 11.12.2009 00:11

Similar Messages

  • Pre-programmed sequence for data bits on parallel port.

    I've found and made a bunch of vis that allow for interactive high/low control of the 8 data bits on the parallel port. I want to control each pin with a pre-programmed pattern of bits. Any ideas?

    A U8 is an unsigned 8 bit number. To create one place a number control down on the front panel. Right-click on it and select Representation>>U8. To create an array of U8s you place an array control down, and then drag the above numeric into the array shell. You now have an array of U8s, which you can expand and place things in it.

  • Parallel Port Programming

    After series of trials and searching the forum i was able to get the commapi and install it. i want to design a simple program that can control circuits (i.e to on leds) . the problem is how to write a 1 or 0 bit to a particular pin. i saw different posts on this issue but still haven't got the real solution.
    i also got to know about parport api and have downloaded and istalled it. but when i run the SimpleIO.java that comes with the package i get this error:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_PRIV_INSTRUCTION occurred at PC=0x10001057
    Function=[Unknown.]
    Library=C:\Program Files\Java\j2re1.4.1_02\bin\parport.dll
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    at parport.ParallelPort.readOneByte(Native Method)
    at parport.ParallelPort.read(ParallelPort.java:37)
    at SimpleIO.main(SimpleIO.java:8)
    plz i want to know what's the cause of this problem, really can't go further on my own and i know nothing on native interface.
    I would be grateful if i can achieve my objective without the parport also.
    How can i write bits to the parallel port plz???????????????
    Thanx in advance

    Why not communicate with the parallel port using the COMM API 2.0?

  • 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;
    }

  • Parallel Port Programming - Pls Help

    Sir / Madam,
    Greetings.
    We are new to writing parallel port programming. We have tried to execute a sample code.
      import parport.ParallelPort;
      class SimpleIO {
        public static void main ( String []args )
          ParallelPort lpt1 = new ParallelPort(0x378); // 0x378 is normally the base address for the LPT1 port
          int aByte;
          aByte = lpt1.read(); // read a byte from the port's STATUS pins
          System.out.println("Input from parallel port: " + aByte);
          aByte = aByte >> 2; // a simple and irrelevant operation
          lpt1.write(aByte); // write a byte to the port's DATA pins
          System.out.println("Output to port: " + aByte);
      }We get the following error:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_PRIV_INSTRUCTION (0xc0000096) at pc=0x10001057, pid=2224, tid=2916
    # Java VM: Java HotSpot(TM) Client VM (1.5.0-b64 mixed mode, sharing)
    # Problematic frame:
    # C [parport.dll+0x1057]
    We are new to this..
    Pls help us. We have connected a parallel port device already.
    Regards
    Rampalli

    This means there is a bug in the driver you are using.
    I would check you have the latest version of Java 5 or 6 and the latest version of the driver you are using.

  • Programming the parallel port

    Hi. I need to send some bytes to the parallel port. I don't want to print any documents. I found a method called public static void setOut( PrintStream out ). Can I use this method? And if so, how do I do it? What PrintStream sould I use? Thank You!

    Interesting...
    http://mindprod.com/jgloss/parallelport.html
    Well, I'm not sure if that's really true (not that I don't trust that site, it has lots of good info)... My impression was (I've only used serial ports with it before) that since ParallelPort extends CommPort, that it would at least work by using it's CommPort's methods and that the ParallelPort stuff (which is all printer related) was just there for convenience, since most of the time it is a printer there.
    Well, the OP could try it, I guess, but if not, then JNI is the only hope... or another parallel port package if one was ever written.

  • Parallel port programming in java

    anyone please help me!!
    I have to send binary data(of numbers 1-255) to parallel port in 8 bit format.
    If you have code please send me or help me how to do so...

    One post is sufficient.
    Next time try "New to Java".
    Google ( [url http://www.google.com/search?q=java+rxtx+parallel+port]java rxtx parallel port )

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

  • How can I write to the parallel port using LabVIEW 6.0.2

    I have tried updating the labview.ini file and also using the parallel.llb available on the site. When I execute the program it gives me error 37 saying,"device not found". I am running this code on windows 98. I tried to use VISA write,serial port write (using port 10) but nothing seems to work. I also tried to develop a sample code using inPort and outPort, but no success, it is not able to read the data back from the parallel port, even if it seems (????i don't know any way to cross-check it though????) to write.
    Does anybody know the problem here?
    THanks.
    Pari.

    Thanks Brian.
    Well here is the next problem. I got a VI (attatched) off ni.com and it works fine on a windows98 platform. But quits working on NT.
    I can write perfectly (which i checked by hooking an LED display unit at the other end of the parallel port cable). I observed that the LEDs respond to the toggling of individual bits (data bits). But the error occures at the "out port.vi", when I try to run it on a NT machine (where I actually wanna use it). Are you aware of any changes to be made in order to run a VI on NT that works on 98?
    Thanks again.
    Pari.
    Attachments:
    parallelPortSwitcher.vi ‏124 KB

  • Using XP software with a parallel port dongle in windows 7 professional

    Please help...  Looking to have my parallel port dongle recognized for my older version software (XP) in Windows 7 under the XP PC mode.  Help in figuring out if LPT1 is set correctly or what I am doing wrong.
    Thanks

    Hello,
    I have W7 Professional 64 bit with Windows Virtual PC/Windows XP Mode installed. I have some older programs installed in XP Mode and they are working properly.
    Unfortunately, I have one older program that I currently have working on an older XP Machine and that program requires a Sentinel dongle to be seen on the LPT1 Parallel Port. Since my W7 computer has an LPT1 Header on the mother board, I have purchased and
    installed a PCI-Express Parallel Port and I have the ribbon cable connected to the LPT1 Header.
    After I enabled the parallel port in the bios, I could see LPT1 in the W7 Device Manager and in the Windows XP Mode Device Manager. However, when I click on
    Windows Virtual PC, highlight Windows XP Mode.vmcx and click on Settings, LPT1 does not appear.
    I have installed my old program in Windows XP Mode and it starts to run but, when it gets to the point where it must see the Sentinel dongle on the LPT1, the
    program does not find the dongle.
    I also purchased a Manhattan MHUSB to DB25 Parallel Converter and plugged it in. It said that it found new hardware and installed drivers for it but that didn’t
    work either.
    I am not married to any particular solution. So, I would use a USB Adapter or LPT1 connected to the mother board but there must be some code editing or changes
    in settings to make the dongle work in XP Mode.
    Can you tell me how to get W7 Professional 64 bit with Windows Virtual PC/Windows XP Mode to find the Sentinel dongle 
    on LPT1?
    Thank you,
    Dan
    Dan

  • 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 (Mac OS 9)?

    I am putting together an electronic circuit for controlling a stepper motor. The board includes an option for a parallel port as typically found on older PCs.
    Is there a product available that would give me a parallel port on my G4 tower that I could then program? I am familiar with writing Firewire and older serial port drivers and feel comfortable writing code. All I need is the hardware and an associated software library for accessing the port.
    Please note that I am using Mac OS 9.2.2. I have no tools or desire to write for X.
    Gary

    Hi Gary, look for an old USB to Parallel adapter that's Mac compatible.
    Here's one...
    http://www.antarespro.com/890523-item-LINK_DEPOT-USB-DB25--899744001363-USB-DB25+DataTransfer.aspx?sgd=330d319d318d313d316

  • My parallel port cannot work on win2000 and new pc

    I was troubled by the reading/writing from parallel port on win2000 for a long time. I had made my programs work on win2000/OLD PC, but i failed with the same programs on win2000/new PC. I tried with the method from the forum, that is, install accessHW and other method from my colleagues. Allways failed. I have to return to an old pc, it work! I think not only win2000/winxp will influence parallel port work, but also pc hardware. My new PC is Dell's GX260SMT with p4 2.4G. Dell's FAE told me that i can not install win98 on the pc due to some limitation of mainboard. Who met the smae issue as mine? How to fix it? Thanks for any help.

    I typically stay away from Dell PC's. I always have problems with them..
    I'm surprised to read that a new PC doesn't support Win-98. Have you / can you try Win-NT 4?
    I can't understand why Win2K would be different with a newer PC. The OS assigns the base address of the parallel port to a typical value of 0378h. This is for LPT1.
    My question would be: Are you having problems with LPT1 or do you have a PCI-based Parallel Port (to add ports)? If so, you cannot change the base address with Win-2K or Win-XP which assigns a PCI base address to the port.
    Can you provide more details as what exactly changes between the 2 PC's. Other than the motherboard and typical hardware (of course).
    How is the parallel port configured?
    What are you doing
    with it, etc?
    Any information that can help figure out a solution.
    Regards,
    JLV

  • Voltage out from parallel port

    Hi there,
    I want to use the parallel port to run a relay.
    I do not understand the example given by labview. I also read the forum but I did not see what I am looking for.
    I am kindly asking if some one can write a small program ( I use labview 8.5) so I can give a 5v out say to pin #2.
    Thank you in advance

    vlonjati wrote:
    I do not understand the example given by labview. I also read the forum but I did not see what I am looking for.
    I am kindly asking if some one can write a small program ( I use labview 8.5) so I can give a 5v out say to pin #2.
    Please tell us more why you struggle, this is not good enough
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • How to use the Control lines of a parallel port as Input lines to be read using Labview ?

    The details are :
    NI Software : LabVIEW
    Version : 5.0
    OS : Windows 95
    NI Hardware : N/A
    Drivers : N/A
    CPU : Pentium
    RAM : 48
    Vendor : darcom
    Customer Information :
    SPEL TESTING
    SPEL, INDIA
    [email protected]
    Ph: (91) 4114 53818
    We do not have any DAQ cards within the PC. We have the parallel port which is EPP and ECP compatible having the address 278h on LPT2 and we are trying use this port for reading 8bit data from an external circuit. We developed a vi program in Labview 5.0 to control the parallel port.We tried with the Data lines to send signals from PC to external device through this parallel port with the addr
    ess 278h (which
    is Data lines) and it works fine. We also tried using reading 4bit data from external
    device to PC through this port with the address 279h (which is Status lines) and it
    is also working fine.
    But it was not possible for us to read through Control lines whose address is 27Ah. Whereas when line printer (dot matrix printer) was
    connected, it was possible for us to take print out. Thus printer was working. This
    informed us that the control lines are all OK!
    Can you please clarify, how to use both control lines and status lines to read 8 bit data through this parallel port using the Labview software.

    There are several Knowledge Base entries about this on the NI site, but probably the most detailed document is on the Advanced Measurements (www.advmeas.com) website. Try looking at this page, I think you will find it useful.
    http://www.advmeas.com/goodies/parallelport.html

Maybe you are looking for

  • Podcast client downloads to wrong memory

    The podcast client on my N95 8GB have begun the annoying habit of saving downloaded podcasts the the phone memory, and not to the 8GB mass storage unit, where it used to put them.  Any ideas on how to rectify this problem? 

  • Passing multiple ID's in URL variable

    How can I show results from a mysql database from selected ID's using URL variables? Showing results from one ID works fine: mypage.php?id=1 But, My table has 10 rows and I want to show 3 of those rows: mypage.php?id=1&id=3&id=4 Thanks for a point in

  • "No service implementation available" with adhoc template in 1.3

    Hello I'm trying to use the adhoc template available since 1.3, using "X" global variables for connection name, system, query name and query type ... And I systematically get the error message : "No service implementation available" query could not b

  • XMLEncoding of a custom class

    I'm trying to save game levels as XML code using the XMLEncoder. I've made getters and setters for every attribute and a no-arg constructor, but still some attributes are missing in the XML code. I've spent a LOT of time reading about different XML A

  • My Macbook Pro will not let me copy!

    i press cmd C then Cmd V and it is pasting the previous thing i copied, not the new thing i wanted to cope. Why? this doesn't happen all the time, but happens once i've copied sevral bits.....very annoying. also I'm trying to save journals, but when