Reading and Writing For Serial Port (RS232)

Hi there;
I want to send data from my comport to a device and take data from there. I use Windows operating system. I looked at a bit javax.comm and RxTx.
Firstly do i have to use RxTx for my project because of i am using Windows operating system?And;
Where should i began to start simply send and receive data via RS232?
Edited by: furkankamaci on Feb 14, 2009 8:05 AM

Use RxTx and follow its examples.

Similar Messages

  • Reading/writing to serial port w/ VISA in Labview

    I'm writing a Labview program to control and to read data from a Varian vacuum pump controller. It is connected to the serial port in my computer, and I have been trying to open a VISA session to communicate with the instrument. So far, however, the computer cannot see the instrument--I get the same error messages reading and writing to the instrument as I do to an empty serial port. Does anyone have any suggestions on what the problem might be? Thank you.

    There are a lot of possiblities. Is the cable correct? You probably need a crossover cable (TX and RX) swapped. You also need to check and make sure the serial ports on both ends are set the same (i.e. baud rate, handshaking, stop bits, etc.). Make sure that the port is enabled. I've seen people try to use a comm port only to find that a modem card installation caused the port to be disabled. You could also try using hyperterminal to talk to the instrument. If you can communicate there, you can eliminate any hardware problem.

  • Error while reading/writing to serial port

    Hello,
    I am trying to read/write to my serial port but
    this message shows every time i launch the
    program. Does anyone know some help ?
    Thanks
    FdB
    Attachments:
    error2.ppt ‏172 KB

    Frederico
    This VI (LV8)
    1. Open the serial port at 2400 baud
    2. Powers down the PT104 and wait 0.5 secs for this to settle
    3. Flushes the serial power buffer to remove any power down acknowledgements in the serial buffer
    4. Powers up the PT104 waits 1 sec for things to settle
    5. Reads any bytes in serial rx buffer.
    6. Power down the PT104
    7. Close the COM Port.
    This is a bit of a guess but this is how I would approach it. Can you try this and let us know how you get on?
    thanks
    David
    Message Edited by David Crawford on 07-20-2006 10:31 AM
    Attachments:
    PT104 - Get Version at Power Up.vi ‏56 KB
    PT104 - Get Version at Power Up.jpg ‏50 KB

  • I updated Itunes today to the latest version. Windows 7 64bit. None of my drivers work and get an error when itunes starts, about registry setting for reading and writing dvds and cds missing. Anyone else have the same issue. I downloaded itunes again, re

    I updated Itunes today to the latest version. Windows 7 64bit. None of my drivers work and get an error when itunes starts, about registry setting for reading and writing dvds and cds missing. Anyone else have the same issue. I downloaded itunes again, reinstalled still have same issue.

    I'd start with the following document, with one modification. At step 12 after typing GEARAspiWDM press the Enter/Return key once prior to clicking OK. (Pressing Return adds a carriage return in the field and is important.)
    iTunes for Windows: "Registry settings" warning when opening iTunes

  • Quickest method for reading and writing files

    Hi
    I need help regarding file operations.(Reading and Writing). Currently I am using BufferedReader and BufferedWriter to read and write files. But the files (XML) are very huge files(from 30 -50 mb). This is slowing the application to a great extent. Is there any other approach to perform the above mentioned operations on XML files in a fast manner.
    Thank You
    Mansoor.

    Hi
    Can u let me know how to use the java.nio pavkage for primitve data types(int,float..., boolean). I have tried it but found no success.
    Thank You
    Mansoor

  • Lightweight library for reading and writing mp3-tags

    Hi,
    I'm currently evaluating libraries for reading and writing mp3-tags. All the projects I found so far where not maintained for a couple of years.
    My question:
    Is there currently a library, which one could call standard for this purpose
    Cheers
    Jonny

    jonnybecker wrote:
    I'm currently evaluating libraries for reading and writing mp3-tags. Don't you rather mean ID3 tags?
    All the projects I found so far where not maintained for a couple of years.It may either be dead, or it may be so finished and free of bugs that no maintenance is needed anymore.
    If you're occurring problems with it and if it is open source you can always consider taking a fork for own development.
    Is there currently a library, which one could call standard for this purposeNo one comes to mind.

  • Control a generator with a control volage by serial port RS232

    Hello everybody,
    I would like to control a generator thanks to a control voltage. This last one would be sent to a switch wich turns on the generator.
    To do that, I want to link the switch and the computer with a serial port RS232 by using NI-USN 232 cable.
    I made some research on this subject and I am only a beginner on LabView but I would like to use one (or several) pin which will send 5V in voltage when I want.
    Is that possible? Is there another way to make it?
    Thanks in advance.

    Thank you for your answer.
    Maybe, I didn't explain myself correctly. 
    For example, on the Raspberry Pi, you can control a card by sending 3,3V signal with RS232 port (I made it last year so it makes a sense).
    What I want to do here is to control an electronic card that turns on my generator after. I don't have enough to buy a generator controlled unless you know one not very expensive.

  • Send thru serial port (RS232) the instruction CTRL+"something"

    How to i send thru a serial port (RS232) the instruction "CTRL", like CTRL+"something", im only looking for the special character CTRL, i have seen that it can send a CTRL+A ... CTRL+Z thru a type cast, but  is not what im looking for, im sending a special instruction (CTRL+PQT<package>) thats requires this character.
    reards

    The control key is not something you can send through a serial connection.  It is a modifier key (like Shift and Alt) and not a character that would have an ASCII value associated with it.
    However, many of the special ASCII control characters (those below decimal 32) can often be entered as a CTRL+key combination.  For instance, the beep is ASCII 8 and is also a CTRL-G combination.  The backspace is ASCII 9 and CTRL-H.  CTRL A is ASCII 1 so sending a string set in hex display as 01 or \01 in \codes display would work.
    What is (CTRL+PQT<package> supposed to mean?  Is it Ctrl P followed by Q T then something else?  What equipment are you trying to interface with?

  • Writing to serial port

    I currently send ASCII characters to a serial port. I have not errors reported back. Everything appears to be error free, except that the device that I am trying to control does nothing. The device being controlled does not send anything back to the pc. The connection is strictly a one way connection. Do you have to send a carriage return or something to get the ASCII characters to "push" out of the buffer? - Sorry I don't have access to my code at the moment.

    A portion of my code is below. What does the 'flush'
    do? I thought it just emptied out the buffer.
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier)
    tIdentifier) portList.nextElement();
    if (portId.getPortType() ==
    ortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM1"))
    .equals("COM1")) {
    try {
    serialPort = (SerialPort)
    portId.open("SimpleWriteApp",
    d.open("SimpleWriteApp", 2000);
    } catch (PortInUseException e)
    ortInUseException e) {}People get life for this crime!
    try {
    outputStream =
    outputStream =
    tStream = serialPort.getOutputStream();
    } catch (IOException e) {}So you now have two life sentences to serve.
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch
    } catch
    } catch (UnsupportedCommOperationException e) {}Sorry, three life sentences to serve.
    try {
    outputStream.write(rightString.getBytes());
    } catch (IOException e) {}You get the prize! Four life sentences from a short bit of code.
    }P.S. You should really use the COMM api for writing to serial ports.

  • After writing into serial port, the same message gets bounced back into the Inqueue also. If anyone know how to avoid this, please rpely.

    Hi,
    After writing into serial port, the same message gets bounced back into the Inqueue also. If anyone know how to avoid this, please reply.
    Thanks,
    Ganesh

    If you disconnect the cable going to the serial device, do you still get the echo? If so you have something going on in the port setup. If disconnecting the cable stops the echo then the device you're talking to is doing it - which would be my bet. One thing to check is whether this might not be normal operation. I have seen devices that if a command was successful, it simply echo'd back the command string you had sent. Also many serial devices have setting for specifying whether they are to echo commands.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Very slow painting while reading and writing doubles into file

    for 15MB length file i = 7662080
    for 50MB length file i = 12414368
    Part of Code for writing into file follows like this:
    try{
    fos = new FileOutputStream("Angel.txt");
    File f = new File("Angel.txt");
         if(f.length() >=4)
         f.delete();
    fos = new FileOutputStream("Angel.txt");     
    dos = new DataOutputStream(new BufferedOutputStream(fos,1000000));
    int x=0;
    double y_last, y_new;
    for(int j=0 ;j<i ;j++)
    if(some condition)
    y_new = ....;
    try{
    //previously in vectors
    y_last = y_new;
    vect.add(new Line2D.Double(x, y_last, x, y_new)_;
    dos.writeDouble(y_new);
         }catch(Exception e){System.out.println(e);}
    dos.close();
    fos.close();
    x++;
    }catch(Exception excp){System.out.println(excp);}
    part of code for reading from file follows like this:
    public void paint(Graphics g)
    try{
         double y1, y2 =0;               
         Line2D.Double doub;
         raf = new RandomAccessFile("Angel.txt","r");
         dis = new DataInputStream(new BufferedInputStream(new FileInputStream(raf.getFD(),1000000)));
         raf.seek((rect.x*8));
         for (int i = 0/any value; (i < value as per choice); i++)
              g2.setStroke(new BasicStroke(0)); //2
              y1 = y2;
         y2 =dis.readDouble();
              doub=new Line2D.Double(i,y1,i,y2);
              g2.draw(doub);
    dis.close();
         raf.close();
    }catch(Exception excp){System.out.println(excp);}
    I tried using Object Streams but NotSerializable Exception is thrown as Line2D.Double objects
    are not serialized.
    Any idea to make reading and writing into file specially from MB files faster is appreciated.

    Why are you reading in the file in the paint method ?
    Create your data once before painting.
    I think you should explain what is your goal and what behavior you want.
    Denis

  • Problem on reading and writing from from a *.txt file

    I get Problem on reading and writing from from a *.txt file. The following is the read() method...
    The software said the DataInputStream is depreciated. Can anyone help me please?
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        String str = "";
        try
          in = new BufferedReader(file);
          //in = new FileInputStream(file);
          for(;;)
            str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);
      }

    Thank you for your reply. I have made some change. However, there is an incompetable type found error.
    in = new BufferedReader(new InputStreamReader(in));The following are all of the code.
    public void read()
        File file = new File("C://Documents and Settings//Charles//My Documents//Brunel//EE2065//Assignment and Lab//Assignment 4 and Lab 4//data.txt");
        FileInputStream in = null;
        //BufferedReader in = null;
        String str = "";
        try
          in = new BufferedReader(new InputStreamReader(in));
          //in = new FileInputStream(file);
          for(;;)
            BufferedReader Bstr = new BufferedReader(new InputStreamReader(in));
            //str = new BufferedReader(in).readLine();
            //str = new DataInputStream(in).readLine();
            if(str == null)
              break;
            System.out.print(str);
        in.close();
        catch(IOException e)
            System.err.println("execution error: " +e);

  • Writing to serial port 1 from a PDA

    ok this program is driving me NUTS! i have this microchip which uses a certain protocol... now this protocol requires that you send it some characters in hexadecimal so it'll reset... afterwhich it'll send you a data packet containing the version of the microchip etc etc (it's an aduc812... which you can find on www.analog.com)... anyway, that's not important... i am having trouble actually WRITING to serial port 1... i noticed that doing it through an actual PC requires some sort of "open serial port.vi" which is not available in the pda version... all i have is init.vi which is apparently not enough from what i am told... i thas to be opened first... initialized next... then written to then read from... does anyone know how i can acc
    omplish this open procedure with the pda module? is that some sort of software i'm missing? why isn't it included with the pda module add on... etc etc... thank you in advance... i really need help with this so as much information as possible would be appreciated... let me know if you need further info...
    christina

    Hey Christina,
    Here is a link to a knowledge base one simply writing to the serial port from a PDA.
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=E011F478861443EFE034080020E74861&p_node=%20DZ52363&p_source=External
    Hope this helps.
    Brett

  • Why does a standalone program created in Labview 8.5 try connecting to the internet when the program only reads data through the serial port? Firewalls object to progams that contact the internet without permission.

    why does a standalone program created in Labview 8.5 try connecting to the internet when the program only reads data through the serial port? Firewalls object to progams that contact the internet without permission.
    The created program is not performing a command I have written when it tries to connect to the internet, it must be Labview that is doing it. How do I stop this from happening? 
    Any help would be very appreciated.

    It looks that way..
    "When LabVIEW starts it contacts the service
    locator to removes all services for itself. This request is triggering
    the firewall.This is done in case there were services that were not
    unregistered the last time LabVIEW executed- for example from VIs that
    didn't clean up after themselves"
    This is not yet fixed in LV2009.
    Message Edited by Ray.R on 11-04-2009 12:25 PM

  • Info about read or write a serial port with forms 6.0.5

    Anybody can give some info. on read or write a serial port using form (Developer 6.0.5).
    Thanks
    MM
    null

    One option you can try is to develop a DLL
    function to read/write serial port,
    and then write a ORA_FFI procedure to call the DLL function.
    Peter Ng
    Calgary, Canada
    null

Maybe you are looking for

  • Image gradient

    can an image be used as a gradient over another image? eg green grass as an overlay instead of using a color from gradient fill box.

  • How to configure Internet access?

    Hello ! I'm running Solaris 8 now and would like to know what I must do to get Internet access. I have a (hardware) Internet router in the network which I use from all the other (Windows-) stations in the network and which I can ping from my Solaris

  • Can use JDBC to create table in the database?

    other than select, insert, update, delete the record set I want to know can I use the JDBE to create table.

  • Save For Web Default Settings

    I need to compress about 1,000 jpg images and I'm using the "save for web" feature in Photoshop 7 but I'm running into problems because my file names are very long and its cutting them off. I found the workaround by editing the output settings and un

  • Umlaute Ü Ö Ä ; "      iweb 2014

    Hello together, I know there are some answers about my problem but we have 2014 and Maverick. I wrote a blog in iWeb, uploaded via cyberduck and all german Umlaute Ü Ö Ä, also the signs " " are changed in hyroglyphes. Where I can change in ISO 8859-1