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.

Similar Messages

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

  • Getting error in sockt programming pls help

    i got these 4 warning while i compile my first socket program in windows VC++..
    anyone plz helpp me...
    Compiling...
    server.c
    c:\windows\desktop\prasad\socket\server.c(28) : warning C4013: 'bzero' undefined; assuming extern returning int
    c:\windows\desktop\prasad\socket\server.c(44) : warning C4013: 'read' undefined; assuming extern returning int
    c:\windows\desktop\prasad\socket\server.c(47) : warning C4013: 'write' undefined; assuming extern returning int
    c:\windows\desktop\prasad\socket\server.c(32) : warning C4761: integral size mismatch in argument; conversion supplied
    server.obj - 0 error(s), 4 warning(s)

    i have two program server and client..first i compile this server.c file only....
    pls help n im jus a bigner
    this is the "server.c"
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <sys/in.h>
    void error(char *msg)
    perror(msg);
    exit(1);
    int main(int argc, char *argv[])
    int sockfd, newsockfd, portno, clilen;
    char buffer[256];
    struct sockaddr_in serv_addr, cli_addr;
    int n;
    if (argc < 2) {
    fprintf(stderr,"ERROR, no port provided\n");
    exit(1);
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd < 0)
    error("ERROR opening socket");
    bzero((char *) &serv_addr, sizeof(serv_addr));
    portno = atoi(argv[1]);
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = INADDR_ANY;
    serv_addr.sin_port = htons(portno);
    if (bind(sockfd, (struct sockaddr *) &serv_addr,
    sizeof(serv_addr)) < 0)
    error("ERROR on binding");
    listen(sockfd,5);
    clilen = sizeof(cli_addr);
    newsockfd = accept(sockfd,
    (struct sockaddr *) &cli_addr,
    &clilen);
    if (newsockfd < 0)
    error("ERROR on accept");
    bzero(buffer,256);
    n = read(newsockfd,buffer,255);
    if (n < 0) error("ERROR reading from socket");
    printf("Here is the message: %s\n",buffer);
    n = write(newsockfd,"I got your message",18);
    if (n < 0) error("ERROR writing to socket");
    return 0;
    }

  • Am not able to run the java program - pls help

    1. I installed java in the below path
         c:\program files\java\jdk1.5.0
         c:\program files\java\jre1.5.0
    I set the path in
         User variable i. variable name: path
              ii. variable value: c:\program files\java\jdk1.5.0\bin
    when I compile it in command prompt-applying javac ? it performed successfully-shows
    options like ?g create all debug info, -g : new Generate no debug info etc.,
    But am not able to run the file. It shows error msg.
    2. I specified the same name for file name & class name.
    3. Java <class name>
         Exception in thread ?main?java.lang.NoclassDeffoundError: <class name>
    4. Java ?cp <class name>
         Unrecognized option: -cp.<classname>
         Could not create the Java Virtual Machine
    5. Java ?classpath . <classname>
         Exception in thread ?main?.java.lang.unsupported classversionError: <classname>
         <unsupported major.minor version 49.0
              at java.lang.classloader.defineclass0<native method>
              at java.lang.classloader.defineclass<unknown source>
                   --and many listed below?
    6. Java ?classpath c:\program files\java\jdk1.5.0\bin <class name>
         Exception in thread ?main?java.lang.NoclassDeffoundError: <class name>
    7. I re-installed the java, but still the problem continuing.
    pls help... its very urgent

    Is the java class you compiled/calling in the default package? If it is not, you will have to call it by the fully qualified name.
    e.g.
    package com.mycompany.myproject;
    public class MyClass {
        public static void main(String[] args) { }
    }This would be called as "Java com.mycompany.myproject.MyClass" and must contain a main method with signature as above.
    You would have to call this from folder where the compiled classes are located. If using package, you would call from directory at level of top most package so com folder in this example as Java will look at each package name in qualified name and try to traverse directories with those same names to get to .class file matching class name specified. To avoid this, your newly compiled .class files must also be in your classpath.
    Hopefully that helps.
    --Kevin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

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

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

  • How to Change the Default SSH Port from Terminal ? now showing default SSH Port 22 i need change it pls help me how can do

    How to Change the Default SSH Port from Terminal ?
    now showing default SSH Port 22 i need change it pls help me how can do

    How to Change the Default SSH Port from Terminal ?
    now showing default SSH Port 22 i need change it pls help me how can do

  • I have updated my ipod touch to ios5 and it is saying that the device is not registered in apple developers program.I have a back up fle in itunes and itunes is not prompting for restore.how can i restore my pod?pls help me to restore my ipod .am worried

    I have updated my ipod touch to ios5 and it is saying that the device is not registered in apple developers program.I have a back up fle in itunes and itunes is not prompting for restore.how can i restore my pod?pls help me to restore my ipod .am worried as it my new ipod and am not able to restore it.pls help.

    i have done that .:(..PLs help me restoring it to older version.though i have a back up file.in itunes..am not able to restore it.as itunes is not asking for resotre option..pls help me

  • There is a problem with this windows installer package.  A program required for this install to complete could not be run. Contact your support personnel or package vendor. Pls help, need assistance.

    I tried uninstalling my itunes thinking it was perhaps a conflict with the previous version, now I don't have itunes on my pc at all!!
    Reading a previous post for this problem, I attempted to uninstall the 6 individual programs from within control panel.  Everything uninstalled fine except for the Apple Software Updater which failed to uninstall and gave me the same error message.
    I only encountered this when trying to update to the current version of itunes64setup.  When using itunes ver 9 on Windows 7, everything was still fine.
    Pls help, any assistance would be appreciated.

    I have also tried extracting the individual components to the temp file and attempting to install them individually despite being unable to remove the previous install of Apple Software Updater.  The outcome, both Apple Software Updater and itunes encountered the same error message during the install process.

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

  • Pls help to understand this routine program

    Pls help to understand this routine program written in transformation level for a field.
    Data a Type /bic/oizsnote_2.
    Data: l_len type i,
          l_time type i.
    Move source_fields-zztdline+60(60) TO a.
    l_len = STRLEN(a).
    DO l_len TIMES.
    IF a+l_time(1) CN
    ',<>?/:;"''ABCDEFGHIJKLMNOPQTRSTUVWXYZ abcdefghijklmnopqrstuvwxyz!%^&' & '*' & "()__+=12346567890'
    a+l_time(1) = '~'.
    Endif.
    l_time = l_time + 1.      
    enddo.
    replace all occurrences of '~' in a with space.
    Result = a.
    not having much exposure in ABAP programming.
    Raj

    In addition to the above to posts..
    HI Raj,
    Your routine is used to remove the invalid characters.
      IF  A+l_time(1)  CN
    A is a Char which contains the data .*
      I_time is used for iteration(itu2019ll check each char by char in a word/Sentence).
    *CN u2013 Contains not
    ,?/:;"''ABCDEFGHIJKLMNOPQTRSTUVWXYZ abcdefghijklmnopqrstuvwxyz!%^&' & '*' & "()__+=12346567890.
    These are the Valid chars and numbers which will be accepted by BW system, System will throw an error only when load receives a char which is not there in the above. And that char will be treated as a Invalid Char.
    A+l_time(1) = '~'.
    What ever the special/Invalid char appears in the load apart from the above mentioned, system will convert  them to u2018~u2019
    REPLACE ALL OCCURRENCES OF '~' IN a WITH space.
       CONDENSE A.
    System will replace all the ~ with space, then condenses the space.
    You can do this using RSKC transaction instead of going for routine.

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

  • I've a parallel port problem.Can anyone help me?

    Hi everybody I've a problem about programming with parallel port.I tried to write a simple byte data likes "0x0D" through the OutputStream of parallel port "LPT1" but it didn't get out from the runtime process;I 've found that it has stuck at OutputStream.write(0x0D); when i 've debugged it. Do you guys have any clues? and How can i make it through.

    Maybe take a look at this:
    http://java.sun.com/products/javacomm/javadocs/index.html

  • 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

Maybe you are looking for

  • ORA 600, duplicate from RAC to NON-RAC

    Hi Experts, I'm trying to restore Production database for development purpose point in time recovery environment: ASM: 11gR1 DB: 10gR2 At the end of internal duplicate steps i have faced error contents of Memory Script: Alter clone database open rese

  • Load balancing between Instance for same external IP client

    Hi, I have a azure website which is single tenant and is going to be used inside a single Domain from same region. Now my website provide good  performance till 20 concurrent request. I want to scale this so that it can reach up to 30 - 40 -100 so on

  • File Associations on Citrix

    Dear all, does anybody know where the File-Associations are stored in the registry? I would like to aks my CItrix-Admin to store it once, so that it will work for all Citrix-NON-Admin users. Currently we are all getting this NAG-Screen regarding the

  • Apple Logo Flashing?!?!?

    I just got this IPOD MINI the battery was very low, so I tried to charge it with the USB cable. When i connected it, the apple logo appeared on the screen and just began flashing slowly. The ipod doesnt show in iTunes and i've been charging it for a

  • Windows won't display on external monitor on MBP

    I've tried every combination of the Windows ATI control panel (w/BootCamp), but I can't get output on an external monitor (mirror or extended desktop). The computer thinks the desktop is extended, because I can move windows out of sight in that direc