Reading Serial Port?

Sorry, I'm not sure if this thread is the same thing but is Java capable of reading in 15 pins RS-232 port data stream? If so, could some one please point me to a good place to start, such which classes shall I use? thanks

Peter__Lawrey wrote:
You are right serialization and serial ports have little to do with one another.
You could start by looking at [http://java.sun.com/products/javacomm/]
I couldn't find an obvious forum for serial ports either [http://www.google.co.uk/search?q=java+serial+api+forum]
Thanks, Pete. Thanks, George. It seems like Sun is no longer supplying Javax comm development kits from that link. I take that all newer version of JDK are shipped with it?

Similar Messages

  • Read Serial port @100 us

    Hi guys,
    I'd like to know if Labview can read serial port @ 100 microseconds?
    Is it necessary any specific HW for  that? What HW can I use to read at that rate?
    Regards
    Kito

    Take 5-10 minutes and explain your problem much better. Like this. I have an instrument xyz. This instrument use a ZZZ communication protocol, over a YYY link. In my Labview program I want to achieve this XXX. This is what I have done so far.
    Remember good questions draw good answers.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Not correctly reading serial port data after first cycle

    I set up a VI for serial communication using RS232 with a pressure transducer meter. The pressure readings are in a loop along with a series of calculations in that loop. The readout from the first cycle is correct, but i just see garbage characters on every subsequent cycle. The VI was running fine when the loop was just reading the pressure data and not performing any calculations. What could be the reason for this discrepancy.
    The OS is windows NT and software is Labview 6.1
    Thanks

    Thanks for your response,
    I am using a VISA. The bytes at serial port are fixed, that is for a particular command the response number of bytes is fixed. The read operation in the first cycle (of a loop) is correct but it reads garbage characters for every other cycle. I am using a 9600 baud rate and the meter responds directly in strings, no handshake is used.
    Thanks for the response,
    PS: The computer with the code is not connected to the net, i will need to transfer it to post the code.

  • An error about reading serial port

    Hi,
      I have sent 5 bytes(for example: "0","2","F","1","/n") to serial port and used VISA Read. But I only can read 0.  The right result is in the second line of the read string window, The first line is void. Generally speaking, "02F1" should in the first line,then I can read them correctly. The following picture is the result.
      Thank you!
    帖子被hengfo在09-17-2007 03:57 AM时编辑过了
    Attachments:
    read string.JPG ‏6 KB

    Hello,
    you should add a flat sequence with some extra e.g. 50ms delays between the visa writes and reads, that helped us a lot.
    You should also specify a large enough buffer. And don't forget to send the terminating CR and LF.

  • "how to read serial port using labview 6.0"

    sir i am doing a project and is in a need to extract data from serial port. can anyone help me

    This link, and the links from it, are a great place to start:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/8DECBF3E0B714BF3862568F9006E7851?opendocument
    2006 Ultimate LabVIEW G-eek.

  • How to read serial port only when new data has been sent to it

    I've written this very simple vi to read the serial port whenever the MKS Helium Detector sends a new value.  The timing of new data is controlled directly from the front panel of the MKS instrument.  I thought it was as simple as looking at the "bytes at port", and reading the port only if the value is not zero.  The problem I'm having is that the read function is occuring whether I want it to or not.  Consequently, the "Scan from String" function is returning an error (0) once in a while, because it's reading the serial port as it's being updated (I think).   Apparently, when the port is in the process of being updated, it is not zero.   Anyway, I'm assuming there is a simple fix, but I'm having no luck finding the Easter egg.  Any help would be, as always, very much appreciated. 
    Attachments:
    MKSRead.vi ‏55 KB

    You can approach your problem in a couple of ways. The way you've got it written now, as soon as the number of bytes is non-zero, you read and convert. This means that when a partial string is there, you conversion is nor correct. One way is to wait until non-zero bytes like you do now, and then in another loop, read until the byte count is equal to zero and then do the conversion. You can also read until the cr\lf is detected and then do the conversion on the string. You can also enable the termination character for the read but then you'll have to increase the number of bytes to read to something other than just the number of bytes first available. If the instrument always returns the same number of bytes, you can use that as a constant for the VISA Read. Then the read will terminate whenever the byte count OR the termination character is detected.
    I modified your VI to show you how you might put it in a loop and what for the CR/LF to be detected. You would want to add a timeout to this so that if the character does not show up, the loop will not run infinitely
    Attachments:
    MKSRead_mod.vi ‏68 KB

  • Occasional freeze when reading serial port

    I've a labview application which is a gui for a remote device via RS422.  The host computer is a quad core running XP SP3.  Initially I was developing with labview 7.1.1.  At random intervals (anywhere between 10 minutes and 5 hours observed), labview will freeze.  Using a port monitor during this freeze, I'm able to observe repeating calls for IOCTL_SERIAL_GET_COMM_STATUS followed by IRP_MJ_READ.  VISA is configured for 0.5s timeout.  The serial card is a MOXA, CP-114EL (4port RS422).  During the freeze, Labview cannot be closed.  Sometimes it will try by displaying the "Resetting..." text but it never completes.  A hard reset is then required.  After the freeze, processor usage is 25% (on average, 1 processor working full time for labview, but bouncing between cores).  Before the freeze, its less than 2%.
    At first I investigated the serial card driver via emails with MOXA.  After running a terminal emulation program and a loopback connector they gave me for several days without their program freezing, they're confident the problem isn't with their card or driver.  During discussions with them, I installed the evaluation of LabVIEW 2009.  The program still freezes except now I have less access to the VI (I used to be able to switch to the block diagram and via the highlighter tool observe it stuck in the read operation.  In either version though, the above mentioned port monitor output is the same.
    My instinct is that the source of the problem is in the multi-core application, some kind of timeout race condition.  My VI is fairly simple in summary, write a command (read temps, read status, write new params, etc) and wait for reply timing out if there's a problem.  Repeat.  Serial port is configured for 115kbps and transfers are in binary.  Before the freeze, the communication works well.
    I appreciate any suggestions.  I've looked around the net and this forum and didn't find anything similar.  Long time reader, first time poster.  I've a lot of experience in labview but can't solve this - the random interval doesn't help.  I think I'll start logging all serial transfers and see if anything always occurs before the freezing.

    This morning I updated the labview drivers to the most recent online (I hadn't done that yet when I installed LV2009, download was large).  It was something I planned to try if the LV2009 change alone did not resolve things.  The update also did not solve the serial freezing problem.
    I've attached two captures from NI Spy, one during normal operation and one of the last capture (up to the arrow).  I did a brief probing of a different VI that isn't a part of this afterward.  You can see the Read request of Com 2 for 266 bytes.  In the before image, red lines are timeouts.  So this read request is hung up waiting for bytes and never timing out.  That's at least my interpretation.
    I appreciate your and tbob's suggestions.  I've a new serial card (Brainboxes PX-310 card) to try coming soon, not that I don't want to solve this, I just can't spend too much time on it.  If it still gets hung up on the new card, I'll look into the motherboard PCIe port, maybe a failing transaction.  I would've went with the NI card but I need electrical isolation and 8 ports is excessive.
    Attachments:
    NI Spy - before freeze.JPG ‏104 KB
    NI Spy - after freeze.JPG ‏108 KB

  • How to read serial port and substring

    I am new for labview .I send data from microcontroller with C languange every 1 minute this codeprintf("T%3.2f,H%3.2f",fTemp_true,fRh_true);
    And I read data with Hyperterminal it show this T29.11,H67.88 I want to show 29.11 and 67.88 only and stroe in database. I study connect serial port in example and I have a question. If I use this code.Can I auto read every 1 minute or this code can read 1 time only and I have to click every 1 minute.How to auto read when I send data to serial port with microcontroller every 1 minute. And I cannot substring 29.11 and 67.88 because %3.2f can show T29.11,H67.88 or T129.11,H100 . and  How can I simple send data to database. Thank you . 

    No, you don't have to click run every minute. You just need to place a while loop around the VISA Read. You could use Wait (ms) but it would be better to use something like the Elapsed Time function and wire the time has elapsed output to a case statement with the VISA Read inside the true case.
    This is one way to parse the string:
    If you have the database connectivity toolkit, you can easily write to a database. There is also something called LabSQL.
    Message Edited by Dennis Knutson on 01-22-2010 01:42 PM
    Attachments:
    Parse String.png ‏16 KB

  • Problems reading the serial port with labview 5.1.

    I open the example serial.vi , I select write to serial port, run the programm, I don`t have any problem. But when I select read serial port, I get the error code 16392and hex code error x4008. I need to know what can I do? Thanks a lot

    Any time you get an error in LV you can right click on the error cluster indicator and do a "Explain Error".
    If you do this for the error code you reported, the explanation says that it was a framing error.
    In serial communications, a framing error indicates that the hardware was not able to detect a start bit, data then the stop bits that comprise a frame.
    This prompts me to suggest that you check you port setting on the serial port. You want to make sure you are setting the port for the correct;
    Number of start/stop bits,
    Baud rate
    data bits
    parity (just for good measure)
    and hardware handshaking.
    I hope this helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How can detect the serial port is active

    I made a program. It can read datas via serial port. But the datas wont came all the time, so the other part of the program not need to run. I want to put before the "reading serial port" a detection about the serial port is get a data. So the reading is wont start before datas are not coming. Can anybody help me how can i solve this problem?

    Hi Zoyo, if you use the VISA- VIs, the functionyou need is "VISA Bytes at serial port". It shows, how many Bytes are available in the input buffer. You can find it here:
    greets, Dave
    Message Edited by daveTW on 11-22-2006 02:01 PM
    Greets, Dave
    Attachments:
    Bytes at serial port.png ‏20 KB

  • Serial port dropping bytes

    Hello To All,
    I am having a problem with the following.
    In my VI i have a I opened a serial port (com1) and am using the property node to read the number of bytes present at the port. I feed this value into the read serial port vi and the return count does not match what was present at the port does any one now why? What must I be doing wrong?
    I am using the basic read write example.
    Thanks in advance.
    FD

    Glad you found your error. Today I was doing some more testing/development of my application and noticed something interesting (unexpected):
    I have the termination character enabled and set to \n (LF). I am sending my vi a string of 20 bytes with a \n in the middle.
    I have a Bytes at Port property node wired to the Byte Count (required input) of the VISA Read. That seems to override the termination character. In other words, I receive (the VISA Read read buffer is) the entire 20 byte string (including the \n), while I was expecting to receive only up to (and including) the \n (after which I am doing another VISA Read to get the remaining part of the string).
    It appears that the Byte Count and the Termination Character can conflict. In this case, it appears that the Byte Count takes priority. When the Termination Character comes before the Byte Count, as in my case, it seems to be ignored. Can anyone confirm this?
    If this is true, what happens if there is a slight delay (much less than the timeout) between the \n and the remainder of the string? In other words, my string is continuous at 9600 baud. How long a gap must there be for the VISA read to terminate the read upon seeing the \n and letting the block diagram continue? (Possibly the length of a Break = 250 mS default, or greater than say 2 stop bits time, for example?) I searched the Help and have not found the answer yet.
    Thanks! -Ed
    Message Edited by Edjsch on 06-03-2008 01:44 PM

  • Java applets in a browser, and Serial port input

    I know that there is a special package for serial port input in java. (java.Comm.SerialPort)
    What I am trying to figure out before a final decision on design is made, is if there is anyway of reading serial port input into a java applet that is running inside of a browser.
    I have found lots of reference to Serial port input, but nothing that really goes in the direction that I am lookind for.
    Any little tid bits of information pertaining to this would be greatly appreciated.
    Cuervo

    You should also consider that applets are not allowed to access their client system's hardware without being signed; in other words, the user must agree (by clicking a button) to disable the applet security features. Why would you use an applet to do this? Applets are meant to be an extension of a website. You should use an application in this situation.

  • "Example on reading combined signals from a serial port and separating them for display purposes". I am a beginner in Labview and would appreciate if anyone help with that

    I am working on a wireless vital sign monitor. I have 3 signals; heart rate and temperature. I filter and amplify the signals before converting them into digital form. I then pass them via MAX232 before passing them to RS232 serial cable.
    I am therefore working on a program to receive the combined signal and separate them.
    I have come across serial read and write examples on ni.com but am looking for one where I can actually separate combined signals and display them separately.

    Reading the serial port will give you a string. How you divide the channels depends on how the data was formatted before it was sent over the serial channel.
    If you are designing the instrument, as it seems from your query, then you can set up any form you wish. If your data is always floating point numeric, you could use space or tab characters to separate data words. You could use and XML format. If the instrument is provided by a vendor, contact them for the protocol.
    If tabs are used between words and returns between sets of readings, the resutlant string can be interpretted by the Spreadsheet String to Array function in LV.
    Things to avoid are characters often used by serial communications systems as control characters. Carraige returns are
    often used as command terminators by serial protocols, but may also be used by the port.
    Lynn

  • Help with reading information coming from a software into LabVIEW through Serial port

    Hi,
    I am new to LabVIEW and also an amateur in using RS232 for communication. I have this software that has these icons like speed increase/decrease, elevation up/down, start/stop. Now, when I click these buttons on the software, they perform the appropriate functions. For example, if I press start button, the signal must go through a serial COM port into LabVIEW to start the machine. How do I do that? How do I find what format the code word is when I press a button on the software? And how to decode the information to read whether the button pushed is start etc...? Any help would be appreciated.

    I may not be perfect, but I'm all I got!

    That information would be in the programming manual for the device you're controlling. Unless you have a device that has no documentation or you cannot get the documentation that's the first place you should look. If you cannot get the documentation at all then you've got some reverse-engineering to do. To do this you will either need a serial port sniffer (a hardware device), or you can try to use a software-based port capturing program. On Windows PortMon is the most prevalent. This will show you how the port was configured (baud rate, stop bits, etc). Warning: the information is technical.
    As far as how to get it running in LabVIEW, you should take a look at the serial port communication examples that ship with LabVIEW. The most problems occur in figuring out how to (a) terminate a write command, and (b) determining when to stop reading. For (a) this is typically done by appending a carriage return or linefeed to the command. This is device dependent. For (b) this is usually done by the byte stream ending with a character like a linefeed. Again, this is device-dependent. 
    You may also want to peruse this KB article: Serial Instrument Control Tutorial. There are also lots of tutorial on the internet for basic tutorials on serial port communication.

  • How do I use serial port read and show text, but not have it scroll off screen?

    I am new-ish/returning amateur user of Labview and I am trying to edit the example VI "Advanced serial write and read VI" that is part of dev suite 2012.  I need to use the string box to show ALL text received from serial port, always appending and only rolls off screen when more real data arrives at serial port. 
    What is actually happening is as more bytes (or no bytes AT ALL!) arrive during read time, current text rolls off the string box.  Even when 0 bytes are received, screen is blanked out.  I am not very familiar with functions locations and even worse at understanding obscure references to functions, so please keep replies very basic so I can follow.
    Just to be clear, I need the string window to behave like hyperterm does-always shows data and it is not pushed out of window arbitrarily.
    Thanks,
    Steve  
    Solved!
    Go to Solution.

    OK- lets start back at the beginning.  I have a few questions...
    WHy does incoming txt get placed at top of txt box and then scroll up?  why would it make more sense to input at the bottom and scroll toward the top.  I have created this huge txt box that appears to be impossible to use.
    I have attached example of txt boxes I have tried, and pic of VI I have edited.  Bad marks for uglyness....
    Attachments:
    Capture_VI.JPG ‏117 KB
    Capture_VI2.JPG ‏133 KB

Maybe you are looking for

  • No sound from the TV when using HDMI cable, No sound from the TV when using HDMI cable

    I recently purchased HDMI cable and adaptor, so that I can play downloads from my Macbook Air on my TV. There is only sound from the Macbook, not the TV - Do I need as separate cable for sound?

  • IP which only allowed for PAT

    Hello, I am looking for example which allow some of the IP's belongs to INSIDE which can allow to using PAT method to access Internet. With reference to URL http://www.cisco.com/c/en/us/td/docs/security/asa/asa90/configuration/guide/asa_90_cli_config

  • Quick drop window issue

    The Quick Drop window is now expanded (see below) and I don't know how to return to its original size. What should I do ? Message Edité par chilly charly le 08-31-2008 04:29 PM Chilly Charly    (aka CC)          E-List Master - Kudos glutton - Press

  • SAP HR Infotype 0002 field PERID

    hi i am having one issue in it0002 for field PERID for poland. when i entered number in this field and press enter this field didnot take that velue. any solution thanks

  • How do I delete an audiobook from ipod

    How do I delete an audiobook from my ipod.  The new iTunes doesn't seem to give delete as an option.  Larger question:  Why do you guys always have to change something that is working?!!!