08-11-2011 09:36 AM
Hello,
I'm trying to programme serial comm using VISA in Labview and i'm beginner in Labview; never used it before. I' m trying to read serial data for our project. I can read it thourgh hyperterminal using "B01' command. but somehow i can't read in Labview. Can anyone help me please? I have attached the sceenshots of hyperterminal and my labview programme. i've tried all the examples which are included in labview and read all posts. but no luck. Thanks.
08-11-2011 09:49 AM
What happens when you run it? Do you want to send the command on each iteration? It looks like you have the termination enabled. This means that the read will stop after that character is received. Do you know that your device sends this termination character? The next time around you are writing the command again even if there are more lines available. You have to put your read in a loop and stop when you know the device has sent everything it is supposed to send.
08-11-2011 09:50 AM
I'm happy to see that you used Hyperterm to check things out. Very smart.
In the LabVIEW code, in the Write Buffer, be sure you are sending the termination character (LF). You can concatenate it as a constant, or add it as you type.
08-11-2011 09:58 AM
Your VI doesn't have the command saved in it to show what you are writing. You say you are sending B01 in hyperterminal. Are you hitting the enter key? Perhaps you need to send a termination character with the B01 such as a carriage return/line feed, or just a carriage return, or just a linefeed, that you are failing to include in your VI.
08-11-2011 12:03 PM
Steve,
I don't want send command on each iteration. i don't think my device sends termination character. i have put termination char to false now.
I tried with \n and \r termination character. it doesn't work.
Ravens,
the command i send is same way as hyperterminal B01 and hit enter key. After hitting the enter key the device would keep outputing data every 1 seconds until i stop serial connection.
Thank you guys.
08-11-2011 12:18 PM
No No No.
The termination character I'm talking about is the one you send when you send the command to the device. Not the one the device sends to you. If you are hitting an enter key, then you are sending a carriage return/linefeed, so you need to put that into the command you are sending. (Or it could be just a LF, or just a CR).
If you send the command once and the device continues to send data, then you don't want to send the Write command on every iteration of the loop.
I have modified your VI. See how this works.
08-11-2011 12:33 PM - edited 08-11-2011 12:34 PM
Alternatively, the concatenation method (shown below) that I mentioned allows the B01 text to remain as is, making that control easier to change - don't have to remember the other characters.
08-12-2011 03:22 PM
Raven,
I've tried your modifiied VI but no luck. i eve put a delay before reading it. My device needs to be connected to serial port before i power up so i have a delay loop right after VISA port and before write. It would be give couple of seconds to power up the unit . I,m using usb to serial converter then serial to 3 wire. one the wire is ground. i can't see any serial data.
08-12-2011 03:30 PM
You are getting something back,. But it doesn't look like data, but some kind of error flag, "!" It is possible that the serial write should be ending with something other than a CRLF. Have you tried just a carriage return? Just a line feed?
Plus, along with getting something, you are getting a timeout. So perhaps the termination character the device is sending is not a line feed that is the default value for the Serial Configuration VI. Wire up a constant to that input of the configuration VI and try a carriage return (decimal 13, or hex 0D).
Have you read the manual for this device? What does it say? What is the name and model of the device you are trying to communicate with.
08-13-2011 01:43 AM
Do you ever see any data received in your receive count indicator?
@Amit Patel2 wrote:
Raven,
I've tried your modifiied VI but no luck. i eve put a delay before reading it. My device needs to be connected to serial port before i power up so i have a delay loop right after VISA port and before write. It would be give couple of seconds to power up the unit . I,m using usb to serial converter then serial to 3 wire. one the wire is ground. i can't see any serial data.
What do you mean you can't see any serial data? On your fp or are you speaking about the harness? So your using a different port now correct? Port 3 from port 27? I just wanted to clarify.