LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS 232 read

I'm using the RS 232 port and VI in the attechment. I write a command to RS 232 port succesfully but I can't read the port and the error message is "Error 85 occured at Scan from string". Could you help me?
 
 
Thank you
0 Kudos
Message 1 of 29
(4,637 Views)
Hi behluls,
the error message says, that the "scan from string"- function could not interpret the string which you got from VISA Read. It is not a string containing a floating point number. Place a probe on the string wire output from VISA Read and execute your VI highlighted (with the little light bulb on). Then you can see where the error occurs and you can watch the data. If you need assistance doing this, don't hesitate to write back.
Greets, Dave

P.S. It is not clear to me, why the length of the string you want to read in the second step is transmitted as a float. It would be more convenient to do this with an integer since there can only  entire bytes be transmitted .

Message Edited by daveTW on 01-22-2007 11:04 AM

Greets, Dave
Message 2 of 29
(4,611 Views)

Hello Dave,

It is a interesting event. I used a probe at VISA read and I sent a "down" command". I read the " down" command from buffer help with probe. (Sometimes I read the random data) I think I should add the delay between write and read buffer. Am I right? If your answer is OK how can I success this?

Thank you very much.

0 Kudos
Message 3 of 29
(4,605 Views)
Hi behluls,
if you execute your VI highlighted there should be enough time time between the VISA Write and VISA Read for the attached device to answer the right string. If you receive random data, there could be a problem with the baud rate or the number of Stop bits. Make sure your serial settings correspond to the device's settings.
When you send the Command "down" to the device, exactly what string do you receive with the first VISA Read? And to answer your question, place a "time delay" express VI into the error wire between VISA Write and VISA Read. Consider the time is in seconds, not ms as the other timing VIs. You can find "time delay" in the "timing"- palette.
 
Greets, Dave
Greets, Dave
Message 4 of 29
(4,599 Views)
Hi behluls,
instead of wait you can also use the "Bytes at port" property to see when bytes are available to read at the serial port. See this thread or this diagram. The code in the diagram will wait for bytes to be available, read them and add them to a string. It finishes once it receives a line feed character.
Hope this helps
Daniel

Message 5 of 29
(4,591 Views)
Hello friends,
 
My application is working as:
 
I sent the "down" command from RS 232 port. And in my application the line comes down the lower line and it works succesfully(as you understand if I sent the "up" command the line comes down the upper line)  I sent you a screen in attechment. Have you an idea?
 
Thanks a lot
0 Kudos
Message 6 of 29
(4,586 Views)

Excuse me.I forgot to explain the my application.

This is test menu on DVB. After I sent the down or up command. I should receive "Front Key Test"  string.

 

0 Kudos
Message 7 of 29
(4,582 Views)
I don't fully understand what you're trying to accomplish or what you expect to read from the serial port. But anyway, if you're expecting a string then why do you convert it to a floating point number? This throws an error so the second VISA read operation won't be executed.
Also, if you expect the return string to be "Front Key Test", why do you read 8 bytes?

Message 8 of 29
(4,577 Views)

There is the automatic test menu in my aplication. For example : 1-Front key Test

                                                                                                         2-R/C Test

                                                                                                         3-Display Test......

 

After I sent the "down" command and I will receive the test menu name. So I will understand the menu which testing.

Fistly I receive the string is "Front". This is enough and this is why 8 bytes.

when I write the  "scan from string" in my VI the screen is : (in attechment) (broken wire on scan from string)

0 Kudos
Message 9 of 29
(4,572 Views)
OK, you read 8 bytes from the serial port. But if these 8 bytes aren't the size of the full string then why do you wire it to the number of characters to read in the 2nd read operation? What do you want/expect to read in the 2nd read operation?
In the 1st read operation you expect something like "1-Front ". If you convert that to a floating point number you'll get 1. So you'll read 1 more byte in the 2nd read operation, which should then be "k" (9th byte from "1-Front key Test").
In your attached device, do you see anything happen when you send a string? Are you sure you're using the correct COM port?
If you think this is correct, then you could try to read all available bytes (using the "Bytes at Port" property as suggested above) to see whether something else than just the sent string is returned.

Message 10 of 29
(4,564 Views)