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

Similar Messages

  • 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

  • VISA Read function Read buffer problem in serial communication

    Hi,  I use VISA write and read function in serial communication app, the device continuously sends 0x00 if it is not receive a request from Labview program running on PC.
    And the request sent by labview is programmable. I met a weird problem, each time the request changes, the VISA read buffer output port still shows the last request firstly, from second time, shows the right request.
    It works like: Req code: ... 50, 51,51,51,50....;  VISA Read buffer: ...50, 50, 51, 51, 51, 51, 50....
    Please refer to the program.
    Attachments:
    readOne_test.vi ‏21 KB

    How are you running this?  You don't have a while loop around it.  Is it part of a larger VI?  Please don't tell me you are using the run continuously button.
    You don't have any wait statement between you VISA Write and your bytes at port.  So it is very likely the receive buffer is still empty since you didn't give your VI time to wait for the device to turn around and give a reply.  If you read 0 bytes, your VISA read string will be empty.  How does your decoder subVI (which you didn't include) handle an empty string?

  • 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

  • Unable to read/write bytes using 9870 with cRio 9151

    Hi everyone,
    I'm currently having some problems trying to use 2 ports of module NI 9870. I'm unable to read bytes even if I try to send some datas (I always get a Timeout) and I'm also unable to write some datas( I can't see nothing on Hyperterminal).
    Please find enclosed a snapshot of my Fpga code.
    Regard,
    Nicolas Kaminski, Toulouse France
    Attachments:
    ReadBytes.jpg ‏93 KB
    WriteBytes.jpg ‏30 KB

    Hello,
    Can you give us some other details:
    Are you sure that you provide power to the 9870 module?
    Do you have tested your system with an example? (NI-987x Serial Loopback.lvproj)
    DO you get something through that loopback?
    Regards,
    Mathieu P. | Certified LabVIEW Associate Developer
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Journées techniques : des fondamentaux aux dernières technologies pour la mesure et le contrôle/comm...

  • I am using serial communication and always having error 1073807246, I try to solved using the idea given in the ni site but it still doesnot work. Looking for your help?

    I am using labview 6i. The ahrdware I am communictating is light modualtor.

    "Here is the definition of the error from LabView:
    "VISA: (Hex 0xBFFF0072) The resource is valid, but VISA cannot currently access it"
    Are you able to communicate with the hardware manually using a sw like "HyperTerminal"? If so, configure the serial port setting to the same as that to communicate manually.
    It appears that you are using a valid comm port, but it cannot talk to the hardware for some reason. It could be as simple as a bad connection (wiring / soldering / etc) to the hardware.
    The first thing I would check is the ability to communicate manually. If it works manually and you duplicate the settings, it should work. If you can;t communicate manually, then you'll have to do some troubleshooting..
    -JLV-

  • Serial communication to read single character

    Hi! List,
    I want to read single character using serial communication(see the attached VI).
    The initialization of the serial port is taken care.
    TIA
    Attachments:
    Serial_comm[2_read_single_character].vi ‏42 KB

    I'm not sure I can understand you. If you want to read just one single character why can't you do so by just passing 1 to the Serial Read function as the number of bytes to read?
    The diagram of above VI doesn't make to much sense to me I have to admit.
    Rolf K
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • I always lose data when i read continous using serial

    I am developping a application, using serial communication for data
    acquisition.
    This serial read data continuous.but when i click on the graph or made
    a zoom i lose data in that interval ...
    What can i do

    If I understand correctly what you're saying, there is a gap in you data when you click on the graph, or zoom in on it. If you have the acquisition and the graph in the same loop, you could be essentially pausing or slowing down the loop while you are interacting with the graph. I've never noticed this effect before myself, but it is possible.One solution might be to put the acquisition process in a seperate loop and pass data to the loop containing the graph in something like a queue.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

  • Serial communication via Sub vi

    i wrote a vi to communicate with my test device. It works fine if it is used as a "standalone". When i try to call it from another vi as a Subvi no communication is possible. (time out). In the main vi i never use serial communication.
    Greetings J.Lankenau
    (english is not my native language)

    Neither. NI-GPIB is for communicating with a GPIB instrument and NI-VXI is for a VXI chassis. You have an instrument connected to the serial port. All you should need is NI-VISA installed. The VISA driver is on your LabVIEW drivers CD. Check MAX to see if it's already installed. You can also get the latest here.

  • Serial communication mark space

    I need to send Mark and Space characters using serial communications. I have not found a way to do this with LabVIEW. Anyone have any knowledge on this topic?
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

    mfitzsimons wrote:
    I need to send Mark and Space characters using serial communications. I have not found a way to do this with LabVIEW. Anyone have any knowledge on this topic?
    I have found the answer to my own question. Using VISA Configure Serial Port you can set the parity to Mark or Space. Here is some information on mark and space:
    Mark parity means that the parity bit is always set to the mark signal condition and likewise space parity always sends the parity bit in the space signal condition. Since these two parity options serve no useful purpose whatsoever, they are almost never used.
    For example, when even parity is chosen, the parity bit is transmitted with a value of 0 if the number of preceding marks is an even number. For the binary value of 0110 0011 the parity bit would be 0. If even parity were in effect and the binary number 1101 0110 were sent, then the parity bit would be 1. Odd parity is just the opposite, and the parity bit is 0 when the number of mark bits in the preceding word is an odd number. Parity error checking is very rudimentary. While it will tell you if there is a single bit error in the character, it doesn't show which bit was received in error. Also, if an even number of bits are in error then the parity bit would not reflect any error at all.
    Source: http://www.taltech.com/TALtech_web/resources/intro-sc.html
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

  • I pull fiftyfour bytes of data from MicroProcessor's EEPROM using serial port. It works fine. I then send a request for 512 bytes and my "read" goes into loop condition, no bytes are delivered and system is lost

    I pull fiftyfour bytes of data from MicroProcessor's EEPROM using serial port. It works fine. I then send a request for 512 bytes and my "read" goes into loop condition, no bytes are delivered and system is lost

    Hello,
    You mention that you send a string to the microprocessor that tells it how many bytes to send. Instead of requesting 512 bytes, try reading 10 times and only requesting about 50 bytes at a time.
    If that doesn�t help, try directly communicating with your microprocessor through HyperTerminal. If you are not on a Windows system, please let me know. Also, if you are using an NI serial board instead of your computer�s serial port, let me know.
    In Windows XP, go to Start, Programs, Accessories, Communications, and select HyperTerminal.
    Enter a name for the connection and click OK.
    In the next pop-up dialog, choose the COM port you are using to communicate with your device and click OK.
    In the final pop
    -up dialog, set the communication settings for communicating with your device.
    Type the same commands you sent through LabVIEW and observe if you can receive the first 54 bytes you mention. Also observe if data is returned from your 512 byte request or if HyperTerminal just waits.
    If you do not receive the 512 byte request through HyperTerminal, your microprocessor is unable to communicate with your computer at a low level. LabVIEW uses the same Windows DLLs as HyperTerminal for serial communication. Double check the instrument user manual for any additional information that may be necessary to communicate.
    Please let me know the results from the above test in HyperTerminal. We can then proceed from there.
    Grant M.
    National Instruments

  • 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

  • I was unable to establish a serial communication using a DLL library file

    i had designed a VI application in Labview7.1, now i had upgraded Labview to 8.5 but my application is not responding. The design includes
    Application: I am trying to access a third party controller, through serial communication(RS232 Cable). I am configuring the serial port using a third party DLL library file using call library function block. but i cannot get the starting reciever response.

    hi santosh,
                       i cant get u, How do i check whether the dll is activex dll or not. else i do have an activex dll. Mouse, keyboard are USB connected. no other serial communication is connected to it. I am geting 2 errors when i tried to register the file
                         1. DLL server point not found          --    sometimes
                         2. The module was not found        -- sometimes
                  One more thing is i am able to get the reciever status for the first time but was unable to connect for the consequtive bit/byte loadings. to the third party controller connected at the other end.

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

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

Maybe you are looking for