Data Missing in Serial Communication

Hi,
I am Communicating an Embedded Board with LabVIEW.Data is transfering in 1 Data per second priodically.Problem is Some data are missing in between.I am using simple serial read VI.Can any one suggest me a solution? Data Log file is attached.I crossed check with some other applications in that its working fine.
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
:a) 329 b) 400 c) 100 d) 328 e) 373 f) 059 g) 816 h) 000 i) 000 j) 000 k) 01944 l) 000 m) --- n) 0000 o) 00 p) ---- q) --- r) --- s) xx.xx/xx.xx t) 0.35 u) 12
Please Mark the solution as accepted if your problem is solved and donate kudoes

Can you share some code?  It would help a lot if we could see how your program is put together.
Is the embedded board using a termination character?  A termination character is something like an End Of Line character at the end of each message.  If it is sending it, then make sure you are not using the Bytes At Port function.  Just tell the VISA Read to read a huge number and the read will finish when that termination character is found.  This, of course, is assuming you enable the termination character in your program.
My other guess is that you are constantly opening and closing the serial port.  DON'T DO THAT.  You should open and configure the port before your loop and close it after the loop.  You can send and read data inside as much as you want then.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Byte missing via Serial Communication

    Hi i am facing a prob of byte missing via serial communication.
    but for some application it's work fine.
    i am using net beans 5.5 ID

    the code that i am using is as under:
    public void connect() {
    ComChoose port = new ComChoose(); // Is used to select from diff port available in system
    CommPortIdentifier portId = port.getCommPort();
    System.out.println("portid"+portId);
    try {
    serialPort = (SerialPort) portId.open("Meter Parameter", 2000);
    } catch (PortInUseException e) {
    JOptionPane.showMessageDialog(this, e);
    try {
    inputStream = serialPort.getInputStream();
    outputStream = serialPort.getOutputStream();
    } catch (IOException e) {
    JOptionPane.showMessageDialog(this, e);
    try {
    serialPort.addEventListener(this);
    } catch (TooManyListenersException e) {}
    serialPort.notifyOnDataAvailable(true);
    try {
    serialPort.setSerialPortParams(4800,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    serialPort.setRTS(false);
    } catch (UnsupportedCommOperationException e) {}
    //Closing the serial Port
    public void closesr(){
    if (serialPort != null){
    serialPort.close();
    //Serial Event
    // &Ch[i] is the string array used to store bytes
    public void serialEvent(SerialPortEvent serialPortEvent) {
    switch (serialPortEvent.getEventType()) {
    case SerialPortEvent.BI:
    break;
    case SerialPortEvent.OE:
    break;
    case SerialPortEvent.FE:
    break;
    case SerialPortEvent.PE:
    break;
    case SerialPortEvent.CD:
    break;
    case SerialPortEvent.CTS:
    break;
    case SerialPortEvent.DSR:
    break;
    case SerialPortEvent.RI:
    break;
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
    // outputBufferEmpty(serialPortEvent);
    break;
    case SerialPortEvent.DATA_AVAILABLE:
    try {
    int numBytes = inputStream.read(readBuffer);
    for(int i=0;i<numBytes;i++){
    number =readBuffer[i] ;
    if(number<0){
    number=number+256;
    if(number==256){
    number=0;
    String r = Integer.toHexString(number);
    if(r.length()==2){
    ch1[k]=r; //K is an integer value defined globally K=0;
    } else{
    ch1[k]="0"+r;
    // System.out.println(ch1[k]);
    // System.out.println(k);
    k++;
    if(k >=200){
    System.out.println(k);
    k=0;
    serialPort.close();
    flag=true;
    } catch (Exception evt) {
    System.out.println(evt);
    serialPort.close();
    break;
    }

  • Bytes missing in serial communication UART - NI Visa READ

    hello everyone,
                         I am using NI Visa read to transfer data from microcontroller to laptop using write-to-binary-file.vi... I have observed a very weird phenomenon, in the fact that some bytes appear to be missing from the data-file. this however, does not occur for all laptops... In some laptops, i have never observed a single byte being missed from the data file...
    the OS running on laptop with byte missing is win 7, whereas the laptop running perfectly fine has win xp.
    has anyone ever experienced such issue before? i am using Silicon Labs CP2102 as UART-USB converter over a baudrate of 921600 bps... the data size is normally in GB's... and the no. of bytes missing is purely random and varies from 2bytes to 32 bytes,... the way i determine if a byte is missing or not is by right clicking the file, check properties and compare size on disk and size of file ... they shud be same to ensure no data loss...
    Now on LabVIEW 10.0 on Win7

    Oh.. Created by mistake ,.. How to delete this post ???
    Now on LabVIEW 10.0 on Win7

  • I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication

    I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
    I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read  from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured  at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
    this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
    I don't know why? please help me. thank you.

    When I copy that code into "Explain Error" I get: "VISA:  (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
    You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
    Also ensure that you are not pointing the example towards a serial port that does not exist.
    Please let us know what you find and what gets this working for you.
         Rob

  • How to send data using serial Communication

    I want to make serial communication using RXTXcomm.jar file.I was written the code.From this I got the list of serial ports avilable on pc but then after when I was tring to send command to machine which is attached to port it didn't gave any reply.
    Tell me that how to send command to port?

    This is how I do it:// open port, get ownership
    SerialPort serialPort= (SerialPort)portId.open(APPLICATIONNAME, timeout);
    // no framing and no threshold
    serialPort.disableReceiveFraming();
    serialPort.disableReceiveThreshold();
    // communication speed, parity, stopbits and databits
    serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8,
         SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
    // no handshaking or other flow control
    serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
    // timer on any read of the serial port
    serialPort.enableReceiveTimeout(TIMEOUT);
    // open streams for reading and writing
    InputStream is= serialPort.getInputStream();
    OutputStream os= serialPort.getOutputStream();... then you use the 'os' stream for writing and the 'is' stream for reading.
    kind regards,
    Jos

  • I w'd like to know if LabVIEW 6.0 Application Builder includes the daqdrv (for data acquisition) and serpdrv (for serial communication) support files by default.

    Building an application to communicate to a device by serial port

    Hi velou
    The LabVIEW 6i Application Builder no longer requires daqdrv. Regardless of your Application Builder and LabVIEW version, you must always install the appropriate driver files on the target machine. For example, if your application communicates with a DAQ board and a GPIB board, then you must install NI-DAQ and NI-488.2 on your target machine. If you are using the VISA VI's for serial communication, than you have to install NI-VISA . If you are using the "old" serial VI's, than you have to include serpdrv separately.
    Luca P.
    Regards,
    Luca

  • My motor receives data via a serial connection, but it won't move. What am I doing wrong?

    Hello everyone,
    as the title says, I am trying to use a motor called "MP285" by Sutter Instruments via LabView. The control unit of this motor only has a RS232-output, but I use a Serial-to-Usb-Adapter to connect the device to the PC.
    My problem is the following:
    I tried to perform a basic Input/Output test by using the Ni MAX an sending ASCII strings to the control unit (after configuring it according to the reference manual), which worked fine. I also used the "jabber"-function of the control unit to send an output string to the PC and was also able to read that string from the buffer. Besides, when I used a LabView-VI to send a command via VISA Write, it also appears on the display of the control (at least the ASCII letters).
     Accordingly, I assume that the Serial-to-USB-adapter does work. Is that for sure, or can the adapter evoke any other problems?
    However, when I try to use the shipped controlling software, the motor won't work. Furthermore, I contacted the customer support and they sent me some VIs and a LabView-Project, which was tested by the company. Unfortunately, it did not work for me. The motor wouldn't move, when I sent the command, although the LabView-interface indicates that there the connection between PC and controller has been established. As the program has many features and I only need a command to move the motor, read the position and set the origin, I tried to build my own VI. I had a look at some basic VIs for motor control and referred to the manual.
    As it seems, the controller uses data streams of full bytes (8 bits, not ASCII) in Big Endian for its strings (I copied the information at the bottom of this text). Thus, I tried to concatenate particular strings to send it via VISA in the correct form (see attached). Do I have to convert the "m" into hexadecimal explcitly? I looked up "Convert ASCII to Hexadecimal", but when I try this, the output string does not change.
    However, when I send this string to the controller in normal mode, nothing happens . When I activate the Input/Ouput test (see above), there is a m displayed on the controller unit. So I guess, I am messing up the command structure. Can anybody help me please?
    Kind regards
    PS: Sorry for cleaning up the diagramm..
    PPS: For some reason, I could not attach the VI because " The contents of the attachment doesn't match its file type". So, I changed the name in "-vi" instead of ".vi" as suggested by a forum user. Hope this works for you!
    Excerpt form the reference manual:
    General Information:
    "Command requests are single bytes followed by optional parameters and terminated by a
    carriage return (CR, 0Dh). The data stream consists of full bytes (all 8 bits — not ASCII.
    The lowest order byte (for example, of the four bytes encoding the X coordinate) is the first
    into the controller and is the first out. The default Baud rate is 9600. Commands are
    processed bytewise by interrupt and executed only after the terminating CR is received.
    There are no delimiters within command strings. The controller will reply with carriage
    return (CR, 0Dh) at the completion of normal command processing."
    Command structure:
    Get Current Position      command ‘c’CR 063h + 0Dh
                                               returns xxxxyyyyzzzzCR three signed long (32-bit) integers + 0Dh
    Go To Position                 command ‘m’xxxxyyyyzzzzCR 06Dh + three signed long (32-bit) integers + 0Dh    
                                                returns CR 0Dh
    Setting up for Serial Communication:
    First, use the 9-pin serial port cable provided with the MP-285 to connect the “serial port” of
    your computer to that of the MP-285 controller. Next configure your terminal emulator (e.g.,
    HyperTerminal in Microsoft Windows (9X and above) to the following settings (or their
    equivalent):
    • TTY mode
    • Echo typed characters locally only (do not echo input to the computer serial port back to
    the controller)
    • Baud rate to 9600
    • 8 data bits, no parity, 1 stop bit
    • COM port - set to the port to which you have connected the MP-285 controller
    Solved!
    Go to Solution.
    Attachments:
    MotorTestVI-vi ‏17 KB

    Thank you for your feedback!
    To make this clear: I dont know if the motor MOVES when sending the appropriate command via MAX. That is because I dont know how to enter the binary? command. I only tried to send some string like "dear moto please move" to see if this ASCII string can be displayed on the control unit while running the input-mode (which I described above).
    This works for both, MAX and my Labview-Vi.
    However, these are the I/O traces:
    1. MAX: I sent the string: "Test"
    NI I/O trace:
    viWrite (ASRL25::INSTR (0x026B41E8), "Test", 4, 4) Process ID: 0x0000123C         Thread ID: 0x00001434 Start Time: 16:18:31.599       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    2. LabView-Vi (I removed everything that followed the first "Visa Write" and added the recommended property node to check if my termination char is correct). I sent string "TEST".
    14.  viOpenDefaultRM (0x065171F0) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.918       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    15.  viParseRsrc (0x065171F0, "COM25", 4, 25) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.918       Call Duration 00:00:00.002 Status: 0 (VI_SUCCESS)
    16.  VISA Set Attribute ("COM25", 0x3FFF001A, 3000) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.920       Call Duration 00:00:00.020 Status: 0 (VI_SUCCESS)
    17.  VISA Set Attribute ("COM25", 0x3FFF0021, 1200) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.940       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    18.  VISA Set Attribute ("COM25", 0x3FFF0022, 8) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.940       Call Duration 00:00:00.001 Status: 0 (VI_SUCCESS)
    19.  VISA Set Attribute ("COM25", 0x3FFF0024, 10) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    20.  VISA Set Attribute ("COM25", 0x3FFF0023, 0) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    21.  VISA Set Attribute ("COM25", 0x3FFF0038, 1) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    22.  VISA Set Attribute ("COM25", 0x3FFF0018, 13) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    23.  VISA Set Attribute ("COM25", 0x3FFF0025, 0) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    24.  VISA Set Attribute ("COM25", 0x3FFF00B3, 2) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    25.  VISA Get Attribute ("COM25", 0x3FFF0018, 13) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    26.  VISA Get Attribute ("COM25", 0x3FFF0038, True) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
    27.  VISA Write ("COM25", "TEST", 4) Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.941       Call Duration 00:00:00.001 Status: 0 (VI_SUCCESS)
    28.  VISA Close ("COM25") Process ID: 0x0000154C         Thread ID: 0x00000678 Start Time: 16:24:34.942       Call Duration 00:00:00.110 Status: 0 (VI_SUCCESS)
    Both strings are correctly displayed.

  • Changing the name of serial communication example in lab windows. Urgent help required

    I am using the example of getting data from rs 232 in lab windows. I want to use this in my final year project that's why I want to change its name that appears as  "serial communication example" how can I change its name and how can I make its exe file that will run on any system even without lab windows.
    How can I modify this example to save the data. I am very new to lab windows, I was using hyper terminal previously.

    I am not informed about the file format that hyperterminal uses.  However, CVI allows wiring to files.  To get a list of functions that deal with file handling, press <Ctrl-Shift-p> to get the "Find Function Panel" dialog.  Type in "file" and press the "Find" button.  This will open a list of funtions that contain "file" in their name.

  • To read 512 bytes using serial communication

    I want to read 512 bytes of data using rs 232 with the timeout of 30ms. I am using "Serial read with timeout -Palm.vi". Is there a limitation of the number of bytes I can specify to this VI?
    Thanks!!
    Attachments:
    Serial_Read_with_Timeout--Palm.vi ‏63 KB

    Hi software enigineer,
    It is not possible to transfer 512 bytes per 30 ms here. To do this would require a baud rate of 136533 (512*8/.03) and the maximum possible baud rate is 115000. The recommend baud rate for a serial transfer is 9600, which would mean transferring at most 36 bytes if the timeout is kept at 30ms. Moreover, there is usually some overhead involved in serial communication, and I would recommend sending a little less than the maximum 36 bytes every time too.
    On another note, I noticed that in your block diagram, you are using the Bytes at Serial Port vi. Definitely use the output of this vi to determine how many bytes to read at a time and read the bytes as they become available in the serial buffer rather than reading in a large buffer
    all at once. Continuously read and append the output until there are no more bytes to be read or until the termination character is read. This will avoid any lost data transmission due to overflow.
    Good luck with your program!
    Kileen Cheng
    Applications Engineer
    National Instruments

  • How to upgrade system from serial communication to parallel communication

    Hi,
    I am working on Lab VIEW 8.5.In my project I am using ADAM cards(7) for analog/digital inputs/outputs. Communication is done via RS 232 serial cable. Right now my system is working fine, but if i want to make it more fast i will need to use parallel communication right? Because Simultaneous inputs and outputs are processed. How much my communication file will change? Which card i should use?
    How to upgrade system? On which factors it depends or it affects? I need guide lines.
    Thank you
    Gaurav k
    CLD Certified !!!!!
    Do not forget to Mark solution and to give Kudo if problem is solved.

    Hi
    In your setup you have a ADAM 4250 RS232/485 repeater talking with 7 instruments in a network. Each instrument have a unique address, and you can only address 1 instrument at a time. If you need more speed you have to insert more ADAM 4250 units in your system and more RS232 ports on the PC. Identical ADAM instruments may receive commands over the same communication line, but transmit data on a unique communication line. You can not use the parallel port in your setup at all. This is not a Labview problem but a hardware problem. If speed is critical maybe the Ethernet I/O Modules: ADAM-6000 series are better for your setup 
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Serial communication error

    hello,
    when i try to run my application(serial communication simple data transfer using loop back), labview evaluaton 8.6 showing the erron as attached.I dont understand what went wrong, it was working fine earlier.
    Thanks,
    hari
    Solved!
    Go to Solution.
    Attachments:
    laberror.JPG ‏85 KB

    Is that mean permission from NI? it was working fine, once i terminated the labview application abruptly when not responding since then i have this problem.
    hari

  • Serial communication from simulink to labview

    hello everybody,
    i have problems with establishing serial communication from simulink(where the data is generated) to labview (version 2010).
    i tried everything but it won t work.can you please help me on this one pleaaase.
    thanks ^^
    Attachments:
    projet labview.vi ‏15 KB

    thanks so far for your replies,
    to clarify any confusion this is my system in simulink.
    the data are decimal values
    thanks again, hope i ll receive a reply from you guys soon cause i really need to progress in my project
    Attachments:
    xxx.PNG ‏20 KB
    yy.PNG ‏35 KB

  • Problems with Serial Communication using Labview 6 and Solaris 8

    I am working on a Driver for a Temperature Controller. But I am stuck at the very basics. I am using Labview 6 and the platform is Solaris 8 on a SUN Ultra 60 Workstation. I can not get the Serial communication to work. When I am running raw (uncompiled) code it works (I can read from and write to ttya and ttyb) but once compiled I get error code 37 (device not found). I have tried the following steps to fix this with no luck.
    1) I made sure that the "serpdrv" file is in the same folder with the executable. I also make sure the serpdrv file is added as a support file when building the app.
    2) I changed from using traditional serial VI's to labview 6's new visa functions. With these "new" VI's when
    I try to initiliaze the visa device and wire a control to the "visa reference" input only 1 serial port shows up (ASRL2, missing ASRL1). I am not sure if this is part of same problem or whole new issue.
    3) I reinstalled both visa and labview 6.0.2 update hoping this would help with no luck
    4) I placed the following entry into the ".labviewrc" file
    labview.serialdevices: "/dev/ttya:/dev/ttyb"
    If anybody has had the same problem I would love to hear about it and if you have any solutions
    Jamie Shea

    Hi Jamie,
    1. Do you have NI-VISA driver installed on the machine on which you are running this executable?? If you are trying to run the executable on the same machine on which the development program has ran fine, then you can ignore this point.
    2. If you have done all the changes that are suggested by other discussions related to this topic, then try changing the Port input to Visa Serial Configure.Vi from a control to a constant and try it. In some case, I have seen this to do the trick. I think this point should solve your problem. If it does do tell me. :-))

  • RE:Serial communication using java

    Hello,
    First of all, I want to make clear thatI did not double post it as previously I posted it in Networking section..But I was told that I have not posted it at appropirate place....thats wht I am posting here.
    I am a newbie in Java.I have started with Netbeans.I have designed a interface using Netbeans.It has 5 texboxes and two buttons named "Start" and "Stop".
    I want to receive data from the serial port and display the data in text boxes.I want when I press Start button, then it should start listening to the serial port .If adat is present on serial port, then it must receive it and displayin the text boxes.when I press Stop button, then it should stop receiving data as well close connection.
    can please anyone help me on this?
    I would be highly thankful for this.
    Regards,
    Jass

    Hello All,
    I am using the javax.comm for serial communication using serial to usb converter at port COM4(I check using device manager.).Beside that I have also added the option in the programming to look into other COMs also.I have placed "comm.jar " and "javax.properties" into jdk\lib\ext and "win32.dll" into jdk\bin.
    But I am getting the following output:
    Wed Dec 24 02:23:43 EST 2008: COM4 null
    Serial port List is  javax.comm.CommPortEnumerator@1a46e30
    Serial port ID  is null
    BUILD SUCCESSFUL (total time: 0 seconds)
    The code Is as follows:
    import java.io.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.comm.*;
    import java.util.*;
    public class serialport implements Runnable, SerialPortEventListener
        static CommPortIdentifier portId, portId1;
        public SerialPort serialPort;
        public OutputStream outputStream;
        public InputStream inputStream;
        Thread readThread;
        static Enumeration portList;
         static String TimeStamp;
        public static void main(String args[])     
        {try {
              portId1 = CommPortIdentifier.getPortIdentifier("COM4");
              }catch(Exception e) {
          TimeStamp = new java.util.Date().toString();
          System.out.println(TimeStamp + ": COM4 " + portId1);}
               portList = CommPortIdentifier.getPortIdentifiers();
               System.out.println("Serial port List is  "+portList+"\n");
               portId = (CommPortIdentifier) portList.nextElement();
              System.out.println("Serial port ID  is "+portId+"\n");
           while (portList.hasMoreElements()) {
              portId = (CommPortIdentifier) portList.nextElement();
              if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals("COM3")) {
                     System.out.println("Serial port COM3 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM4")) {
                     System.out.println("Serial port COM4 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM6")) {
                     System.out.println("Serial port COM6 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM7")) {
                     System.out.println("Serial port COM7 is found\n");
                serialport Port = new serialport();
                else if (portId.getName().equals("COM5")) {
                     System.out.println("Serial port COM8 is found\n");
                serialport Port = new serialport();
      public serialport()
        try {
          serialPort = (SerialPort) portId.open("MainClassApp", 2000);
        } catch (PortInUseException e) {
                  System.out.println("Port is owned by another application \nor port cannot be opened\n");
        try {
          inputStream = serialPort.getInputStream();
        } catch (IOException e) {
             System.out.println("IOstream for port is not available\n");}
        try {
          serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
        } catch (UnsupportedCommOperationException e) {
             System.out.println("Serial port is not properly configured\n");}
        try {
          serialPort.addEventListener(this);
        } catch (TooManyListenersException e) {
             e.printStackTrace();}
        serialPort.notifyOnDataAvailable(true);
        readThread = new Thread(this);
        readThread.start();
        public void run() {
           try {
             Thread.sleep(2000);
               } catch (InterruptedException e) {      e.printStackTrace();}
        public void serialEvent(SerialPortEvent event) {
             Runtime rt = Runtime.getRuntime() ;
             Process p;
        switch (event.getEventType()) {
        case SerialPortEvent.BI:
        case SerialPortEvent.OE:
        case SerialPortEvent.FE:
        case SerialPortEvent.PE:
        case SerialPortEvent.CD:
        case SerialPortEvent.CTS:
        case SerialPortEvent.DSR:
        case SerialPortEvent.RI:
        case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
          break;
        case SerialPortEvent.DATA_AVAILABLE:
          byte[] readBuffer = new byte[1];
          try {
            while (inputStream.available() > 0)
                   int numBytes = inputStream.read(readBuffer);
                   System.out.print(new String(readBuffer));
                    break;
            System.out.print(new String(readBuffer));
                } catch (Exception e) {
               e.printStackTrace();}
          break;}  }  }Kindly help........I really wanna to know where is the error???
    Thanks
    Edited by: jass11 on Dec 23, 2008 11:39 PM
    Edited by: jass11 on Dec 23, 2008 11:51 PM

  • Visa error handling in serial communication

    Greetings,
    I have a problem with the serial communication in my Labview program.
    I have made an application that reads from serial port, searches for beggining characters, and later counts data after that beggining characters into variables in Labview program.
    Everything work fine, but problem starts when I unplug the device from computer.
    Program blocks and I could not do anything. Even Visa Close does not do anything.
    I need to restart my computer to make my application works.
    I made some indicators in subVi, and I see that when I unplug the device the error from READ VISA changes.
    My question is:  How to handle this event(error) to restart or unblock my serial device.
    I am attaching a SubVi, that searches for starting characters " KBON,"
    Best regards,
    Chris
    Attachments:
    find_start.vi ‏12 KB

    Hi Chris,
    From the standpoint of VISA capabilities, you should be able to programmatically handle the desconection of the serial port. I am however not certain that your specific serial port hardware is OK with that.
    As to how to handle disconnection using VISA:
    I recommend using the "timeout" pin of the VISA Configure Serial Port VI
    when the timeout is reached and no data is transferred, you will get a timeout error on the error wire.
    You can then programmatically handle this error case in your code in a very similarly to this example.
    I recommend experimenting to see what error codes your application throws, or alternatively you can use the VISA error codes documentation to create the case structures needed to hande these errors.
    In all cases, you should close the VISA reference. Leaving the serial port rescource "open" in your operating system may be the reason why you need to restart your computer every time (as restarting will for sure free up the serial port rescource).
    Best Regards,
    T Simon
    National Instruments
    Applications Engineer
    Certified LabVIEW Developer - Certified TestStand Architect

Maybe you are looking for

  • IPhoto not backing up properly in Time Machine

    My WD external drive (should have read the reviews on Costco before buying it) failed on me and I had to restore my iPhoto library from Time Machine(TM). When I got it back there were ~250 ghost photos (black box with the file name listed). If I trie

  • No 24-bit 96 kHz audio in media pla

    I have a vista premium HTPC and a Audigy 2 NX USB sound card connected to a NAD analogue stereo used mainly for TV and music listening with a 2. focal system. Vista is fully updated. I checked 24 bit 96-kHz audio in Vista when i installed it in march

  • Disk utilities repair permissions

    I am trying to repair permissions on my imac OSX2.8. When I get into the repair permissions on the start up disk everything seams fine. The indicator bar starts filling up with the blue and white rotating filler. But thats as far as it goes. It will

  • Increasing filesystem size in disksuite

    I need to increase the size of a file system on a Solaris 9 server. The filesystem is apparently a metadevice, it shows in /etc/vfstab as: /dev/md/dsk/d15 /dev/md/rdsk/d15 /opt/inlum ufs 1 yes - metastat: d15: Concat/Stripe Size: 37749760 blocks (18

  • I can't open the Preferences dialog in Messages Beta

    The Preferences option is greyed out in a freshly installed copy of Messages. I'm on 10.7.3. Anyone else had this problem?