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

Similar Messages

  • 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

  • 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

  • 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

  • Problem communicating via serial port in Linux

    Hello,
    I am trying to transfer data via serial port, in Linux.
    But it is impossible till now!
    I get Runtime exception.
    Here is my code:
    public class Main {
        public Main() {
        int num=5;
        int[] array = new int[5];
        public static void main(String args[])  {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    array[0]=1;
                    array[1]=2;
                    array[2]=3;
                    array[3]=4;
                    array[4]=5;
                    new ParallelCommunication(num,array);
    import java.io.*;
    import java.util.*;
    import javax.comm.*; // for SUN's serial/parallel port libraries
    //import gnu.io.*; // for rxtxSerial library
    public class ParallelCommunication implements Runnable, SerialPortEventListener {
       static CommPortIdentifier portId;
       static CommPortIdentifier saveportId;
       static Enumeration portList;
       InputStream inputStream;
       SerialPort serialPort;
       Thread readThread;
       static OutputStream outputStream;
       static boolean outputBufferEmptyFlag = false;
       int num;
       int[] array;
       public ParallelCommunication(int this_num,int[] this_array) {
          boolean portFound = false;
          String defaultPort;
          num = this_num;
         array=new int[this_array.length];     
          array = this_array;     
          // determine the name of the serial port on several operating systems
          String osname = System.getProperty("os.name","").toLowerCase();
          if ( osname.startsWith("windows") ) {
             // windows
             defaultPort = "COM1";
          } else if (osname.startsWith("linux")) {
             // linux
            defaultPort = "/dev/ttyS0";
          } else {
             System.out.println("Sorry, your operating system is not supported");
             return;
    //      if (args.length > 0) {
    //         defaultPort = args[0];
          System.out.println("Set default port to "+defaultPort);
          // parse ports and if the default port is found, initialized the reader
          portList = CommPortIdentifier.getPortIdentifiers();
          while (portList.hasMoreElements()) {
             portId = (CommPortIdentifier) portList.nextElement();
             if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals(defaultPort)) {
                   System.out.println("Found port: "+defaultPort);
                   portFound = true;
                   // init reader thread              
                   initialize();
                   break;
          if (!portFound) {
             System.out.println("port " + defaultPort + " not found.");
       public void initwritetoport() {
          // initwritetoport() assumes that the port has already been opened and
          //    initialized by "public void initialize()"
          try {
             // get the outputstream
             outputStream = serialPort.getOutputStream();
          } catch (IOException e) {}
          try {
             // activate the OUTPUT_BUFFER_EMPTY notifier
             serialPort.notifyOnOutputEmpty(true);
          } catch (Exception e) {
             System.out.println("Error setting event notification");
             System.out.println(e.toString());
             System.exit(-1);
       public void writetoport(int counter) {
          try {
             // write string to serial port
             outputStream.write(String.valueOf(array[counter]).getBytes());
          } catch (IOException e) {}
       public void initialize() {
          // initalize serial port
          try {
             serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
          } catch (PortInUseException e) {System.out.println("Port In Use.");}  //******Here is the Exception******
          try {
             inputStream = serialPort.getInputStream();
          } catch (IOException e) {}
          try {
             serialPort.addEventListener(this);
          } catch (TooManyListenersException e) {}
          // activate the DATA_AVAILABLE notifier
          serialPort.notifyOnDataAvailable(true);
          try {
             // set port parameters
             serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                         SerialPort.STOPBITS_1,
                         SerialPort.PARITY_NONE);
          } catch (UnsupportedCommOperationException e) {}
          // start the read thread
          readThread = new Thread(this);
          readThread.start();
       public void run() {
          // first thing in the thread, we initialize the write operation
         initwritetoport();     
         for(int i=0; i<=num_of_inputs; i++) {
            // write string to port, the serialEvent will read it
            writetoport(i);
         serialPort.close();     
       public void serialEvent(SerialPortEvent event) {
          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:
             // we get here if data has been received
             byte[] readBuffer = new byte[20];
             try {
                // read data
                while (inputStream.available() > 0) {
                   int numBytes = inputStream.read(readBuffer);
                // print data
                String result  = new String(readBuffer);
                System.out.println("Read: "+result);
             } catch (IOException e) {}
             break;
    }...and the outcome is :
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
    Error opening "/dev/ttyS0"
    tcgetattr(): Input/output error
    at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.java:66)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:369)
    at ParallelCommunication.initialize(ParallelCommunication.java:128)
    I have searched a lot and I couldn't find a solution.
    Thank you.

    I'm having the same problem this helped somewhat debug the problem
    http://bloggerdigest.blogspot.com/2006/11/linux-serial-com-port-diagnostic-test.html
    I'm running Suse 10.3 and apparently it does not recognize my serial ports. So before
    you can test your Java code you have to figure out how to make linux see the ports.
    If I find a solution I'll let you know but if you find one first let me know. Thanks.

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

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • I want to send 10 bit ADC from PIC via serial communicaton. i send it separetly 8 bit first then the other 2 bit. how to program in labview to capture those two packet then combine it togother

    i want to send 10 bit ADC from PIC mCu via serial communicaton.
     i send it separetly 8 bit first then the other 2 bit (2 bit --> with zero at 6 bit from LSB).
    how to program in labview to capture those two packet and then combine it together
    so i have 10 bit in lab view
    thank you

    Close, but now quite. You need to specify to the VISA Read how many bytes to read, not how many bits. Thus, the input would be 2, not 16. It's also not clear why you're trying to use the "String to Byte Array". The Type Cast will give you a number based on what data type you wired. You're basically telling it how to interpret the string. In this case we're telling it to interpret the string a 16-bit value, so we'll get a 16-bit integer. I know you said you wanted a 10-bit, but you can't have that. You'll get a 16-bit with 6 bits set to zero. Note: I did not completely understand what you said so we may need to change this slightly, but we want to get the communication and reading collection working first.
    Also, since you seem to be setting this in a loop you probably want to monitor this or to collect the data. For that you need a shift register. See attached for a modified version of your attempt. You need to set the datatype to I16 or U16 based on whether the value you get from the PIC is signed or unsigned.
    Message Edited by smercurio_fc on 05-01-2007 02:28 PM
    Attachments:
    Read PIC.vi ‏21 KB
    Read PIC.png ‏7 KB

  • Serial communication protocol

    i must decide with the constructor of my custom card the communication
    protocol via serial interface.
    anyone can help me with example of message based protocol?
    thanks
    david

    Just my 2c worth -- you need to make sure that you can easily convert the incoming characters to message and determine if messages are valid before processing -- usually by using distinguishing start and end of message characters (such as ASCII STX and ETX) and by including a message length byte and some simple checksum (such as an XOR of the characters in the message). Also for shorter messages I would give a higher weight to ease of parsing, while for longer messages reducing the size of the message might be more important (for example a message which returns
    "A=3,B=50,C=300" where A,B,or C is in the range 0-999 I would just as soon see "A=003,B=050,C=300" so I can get the values from the message by position rather than parsing the string for tokens. however
    if the message returns 2000 values its might be better to leave off the leading 0's and parse the message.) Also, depending on what the device does their is sometimes a message to switch between polling for status vs asynchronous sending of messages from the device. I am not sure if this is the kind of info you are looking for or not? I have also included an attachment for the protocol to a cm11a X10 controller (not because I think it is a template to follow, but just because I needed to use it recently and had it laying around -- it may be harder to understand than its worth????)
    Attachments:
    cm11a_protocol.txt ‏26 KB

  • Files via serial port

    I need to send a jpg file via serial port. Have anyone an idea how to get it. I am using LabView 6.0.

    Hi Francesc,
    In order to solve this you will need:
    - a null modem cable (the difference is that pin 2in goes to pin 3out and pin 3in goes to pin 2out)
    - a normal serial communication VI (you can use the one in lv\examples)
    - to pass the data you have to transform your array of bytes (your file) in string at sender and reverse this operation at receiver. THE ONLY PROBLEM is with ASCII character 11 (even if the receiver has all your bytes in buffer it seems that will return to you just those before ASCII 11). Thus, you will have to avoid the transmission of this character. An idea will be to split each byte from file in other two for transmission - for example its hex code (so, 11 will be transmitted as 0B ). Of course, this method doubles the number of transmit
    ted bytes. If somebody found a better solution, please let me know.
    good luck

  • Having issues with simple serial communication.

     I followed a tutorial online to start learning basic serial communication. The tutorial involved shorting pins 1 and 3 on the Comm 1 port, and writing a simple program (attached). I edited the program a little, to show the varied results that I get when trying to write and read a simple phrase via serial port. 
    Could someone explain what causes the kind of result shown in "Serial Comm Example.png"? I believe it has to do with timing. Why would only parts of the phrase be transmitted?
    Thanks,
    Sarah
    Solved!
    Go to Solution.
    Attachments:
    Serial Comm Example.vi ‏30 KB
    Serial Comm Example.png ‏139 KB

    sarahzig wrote:
    The tutorial involved shorting pins 1 and 3 on the Comm 1 port
    Shouldn't that be pins 2 and 3?  On a standard DB-9 serial port, pin 2 is the Recieve and pin 3 is the Transmit.
    Now for your code...
    1. Move the Configure Serial Port to be before the loop.  You only need to configure the port once.
    2. Close the port after the loop.
    3. Handle your error after the close.
    4. Stop your loop on an error or the stop button was pressed.  You will need an OR in there.
    5. No need for the Flush Buffer function.  Remove it.
    6. Using the Bytes At Port is a dangerous thing.  It introduces all kinds of interesting race conditions.  Instead, tell the VISA Read to read the number of bytes you expect to read.
    6a. Alternatively, be sure to send an End Of Line character at the end of your sent data and set the number of bytes to read to something a lot more than you would ever expect to read.  The VISA Read will stop reading when it a) sees the number of bytes it was told to read, b) sees the termination character (currently enabled and set to a Line Feed, which is part of the End Of Line), or c) the timeout happens.  Whichever happens first.
    7. With 6, the wait is no longer needed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions

  • Problem: Instrument via serial connection

    Hello Forum,
    I am trying to connect my instrument to my laptop via USB through Serial port. I used NIVISAIC and found the Resource name as ASRL3::INSTR. When I was working with Laview I found the following error
    Error 1073807246 occured at property node (arg1) in VISA configure serial port (Instr.). Reason: The resource is valid, but VISA cannot currently access it.
    Using the interactive control one of the attribut is in red (Is Port connected: VI_ATTR_ASRL_CONNECTED: Invalid property value
    Also when I send Identification query using NIVISAIC, it returns the same command.
    I did not understand much of it. However there is a software for the instrument, using which I could connect to the instrument the first time I switch on the system. When I disconnect it and tried once again, it was not connecting.
    I had earlier connected Keithley 2400 via GPIB KUSB 488. Is there any problem in connecting two devices. Or is the driver of the software and NIVISA are conflicting with each other.
    Please find the screen shots.
    Please help.
    Thank you.
    Attachments:
    2.JPG ‏57 KB
    3.JPG ‏80 KB
    4.JPG ‏93 KB

    Hello Dennis,
    It did not help much.
    7: Write Operation (*IDN?)
    Return Count: 5 bytes
    8: Read Operation
    Return Count: 5 bytes
    *IDN?
    I tried to query with \n and \r\n; but did no good. There is only one instrument connected to the PC via Serial port.
    I would like to know if the identification command is same for all instrument or does it change with manufacturers.
    Why does it return the same command that was given to the instrument.
    If I am to ignore this, please find the block diagram and manual of the instrument in the attachment. It was said that the commands should be sent as single characters and not as string.
    In the block diagram I have used VISA Configure Serial Port, VISA Write, VISA Read and VISA Close vi's. Please tell me whether this is correct. The Commands where given in separate lines or should I use separate VISA Write vi for each characters.
    Thank you.
    Attachments:
    interface.JPG ‏130 KB
    block diagram.JPG ‏14 KB
    PR-655 - 670 Manual.pdf ‏4053 KB

  • 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 can i browse FP 2000 via serial port same use Ethernet port(RJ 45)?

    I am a new user for  labview.I develope my program with FP 2000 but I have some problem
      1 How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)? if it can Tell me please.
      2 If  I use GSM/GPRS modem via FP 2000 rs 232 port (I under stand how to send AT command) and leave it stand alone
         Can I dial modem and browse file in FP 2000 same as use Ethernetport?
    Someone please help me.Thank you very much.

    Hi!
        First, I can say that your project involves many things, I cannot describe all features in the forum, and I'm not used with GPRS modems (my modems are base band serial modems...).
        Anyway, I would say that in your project you should proceed like this:
          1) Configure your FP 2000 module via MAX and ethernet connection;
          2) Download an embedded application to your module (build in LabView Real-Time)
          3) In your application, you should build a kind of serial port manager, and by the means of serial port you send/receive commands from PC.
        The commands from PC can include "Tell me the about the FP 2000 file system ", or "switch on line X", or anything you need.
       I think it would be difficult to use Internet exp, because you use IE with TCP/IP, and TCP/IP is over ethernet.
       I know that for Windows you can find some wrappers that make you "see" the serial port as an ethernet, but these wrapper do not exist under filed Point, and you shoul build one yourself!!!(and that's not easy).
        For example, to browse your files, you should build a VI that searches through your file system, and reports, via serial, the files present in a directory (it's an example....).
        About communication between GPRS modems and FP2000, I know nothing.  I suppose that these modems accept serial inputs, so you'll have to configure your serial port on FP 2000 with the correct baud rate, parity, and so on..... and you send your data to the modem.  The modem will transfer data in its way, no matter on how it does.
        To send data to your modem you shoud take a look to some Serial communication examples.  What I suggest you, first, is to connect the serial port of FP2000 to a PC, and test communication between PC and FP2000, without modems. Just direct cable connection!  If you're able to do this, insertion of modems is the next step, and should be quite easy.  If you're not able to make the PC receive strings of data from FP2000, over  RS232, adding modems is a further complication, and you won't come out of this mess!
       So, what I say, is just build, for now, a simple embedded application for FP2000, that, using RS232, sends data to a PC (you should see data sent with use of Hyper terminal).
        To build this application, use Instrument I/O --> VISA commands (VISA open, VISA write, and Property node should be enough, for now).
       Please, let me know if this helps......
        Have a nice (programming) day!
    graziano

  • 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

Maybe you are looking for

  • Master data upload from legacy

    Dear All, We are supposed to upload the master data from legacy system to SAP using LSMW and BDCs. Is it possible to develop an interface between legacy system and SAP ERP for a direct data transfer? Can this be accomplished using XI? Is the scenario

  • Standby Database Creation problem

    Hi, I have setup Standby Database for our Primary DAtabae, I am facing probel while applying redo logs, if somebody nows the solution, Please help me. SQL> startup nomount PFILE='E:\oracle\admin\fno\pfile\init.ora'; ORACLE instance started. Total Sys

  • Question about event handling in JComponents

    I have often found it useful to create a component that acts as an event handler for events the component generates itself. For example, a panel that listens for focus events that effect it and handle these events internally. (See below). My question

  • Creation of Correction Request against Credit memo

    I would like to know if it is possible to create an request of type RK against an Credit billing of type G2? Thanks Lina

  • Yahoo calendar won't sync

    I've searched a couple of forums here and haven't found an answer to my issue.  My BB 8130 no longer syncs with my yahoo calendar.  My appointments remain on the BB, but they will not transfer over to yahoo.  I am connecting directly to my computer u