LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port read.vi

Solved!
Go to solution
You made another error with the other case statement. Look at the second case statement. The true case around the while loop. This should be the false case. Notice that the case statement is wired to the timeout condition. If there is a timeout, you don't want to do anthing else except pass an error back.
Message 21 of 46
(1,964 Views)

i tried this and it seems to work. but one problem. it only work when i view it in HIGHTLIGHTS. if i dont run it in hightlight. i will get NOTHING for the NUMERIC RESPONSE STRING.

i had to make some cases different in order to stop the 2nd while loop. 

 

Best regards,
Krispiekream
0 Kudos
Message 22 of 46
(1,930 Views)

You are not paying enough attention as to how the example Dennis gave you is laid out.

 

In your first loop, one of those timing functions needs to be inside the loop

Message 23 of 46
(1,917 Views)

oh. i didnt know that leaving it in or outside the loop makes a different. but when you think about it. its race condition. but that didnt solve the issue

 

 

 

this is dennis example.

everytime i run this

my bytes at port value is greater than 0, or it is 0

if my timeout = 0, the Get Time value in the first while loop is greater than 0 making it True. 

that makes TRUE/FALSE case, True and it will timeout

 

Therefore I have to make the Get Time Value to be Less or Equal the Timeout value so that it will be False

and Bytes at Port = 0, making True to stop the first while loop or else it will not stop if Bytes at port =0.

and going into the case structure. if bytes of port = 0, making the case inside the while loop True will be nothing. 

 

 

 

however, i changed those conditions and seems that it will only work in HIGHTLIGHT and not on just the Run button. 

why is that?

 

 

Message Edited by krispiekream on 09-29-2008 12:37 PM
Best regards,
Krispiekream
0 Kudos
Message 24 of 46
(1,910 Views)

Why is your timeout equal to zero?  It should be some kind of value greater than zero, perhaps a couple of seconds!!  Otherwise it is essentially always the timed out case.

 

Make your comparison >= like in Dennis' example.  Make your timeout control have some kind of value besides 0.

 

Try again.

Message 25 of 46
(1,904 Views)

hmmm...how wierd. everything works now..

for this example.

thank you guys. i have to go debug and see if this VISA will work with all the system.

 

Message Edited by krispiekream on 09-29-2008 01:01 PM
Best regards,
Krispiekream
0 Kudos
Message 26 of 46
(1,897 Views)

okay.

when i use VISA. 

I run into this error code.

do you know how to debug that?

 

 

Message Edited by krispiekream on 09-29-2008 01:23 PM
Best regards,
Krispiekream
Download All
0 Kudos
Message 27 of 46
(1,890 Views)

That is warning, not an error.  It indicates that you read all the bytes you requested.  If you terminate a read with a termination character, then the VISA Read assumes that you got all the message because it was terminated.  The warning tells you that the sending device might be sending more characters than the number requested to be read.  

 

Note that the Status boolean is NOT indicating an error.  You can safely ignore the warning.

 

Lynn 

Message 28 of 46
(1,877 Views)
 

That is warning, not an error.  It indicates that you read all the bytes you requested.  If you terminate a read with a termination character, then the VISA Read assumes that you got all the message because it was terminated.  The warning tells you that the sending device might be sending more characters than the number requested to be read.  

 

Note that the Status boolean is NOT indicating an error.  You can safely ignore the warning.

 

Lynn 


Is there a way to not have the warning sign? this warning sign gets carry to another subvi and it causes it not to run or run in error. i tried clearing the error/warning message at the end, but that didnt work. 

i restarted my computer after i got this warning sign, and sometimes i get this error msg.

 

Message Edited by krispiekream on 09-29-2008 01:50 PM
Best regards,
Krispiekream
0 Kudos
Message 29 of 46
(1,875 Views)
Message Edited by krispiekream on 09-29-2008 01:52 PM
Best regards,
Krispiekream
0 Kudos
Message 30 of 46
(1,869 Views)