02-28-2014 09:19 AM
I have two exes that are reading data over the serial port. One is a test serial that tests the reading of the string. They both are identical in the serial com setup but one works and one does not. the obvious would be to say that they are different but they are identical in the serial write/read respect. They both first write "?" over the port to the main vi that when it is read in it sets a case to true that then writes the data string to the exe on anther PC. Both the exes have an indicator of bytes out and sometimes when I run each of them the value is 0. On one of them it does have the write bytes equal to 1 but on the other it always is zero. Earlier today that very exe did work for a while then failed to write, Any idea of this inconsistent visa write?
02-28-2014 09:24 AM - edited 02-28-2014 09:25 AM
Without posting your code we can only guess. Are you getting any error mesages?
My first guess would be it's a time out or serial port setting issue.
Post your code
02-28-2014 09:50 AM
I just discovered an undefined error;" -1073807339 occurred at Visa Read". The serial write on the larger code is located in the lower right while in the plot vi the code sketch is on the lower left of the BD. The serial test code should be self explanatory.
02-28-2014 10:01 AM
The other code attached.....
02-28-2014 10:03 AM
I just discovered an undefined error;" -1073807339
That is a Time Out Error
(Hex 0xBFFF0015)
Timeout expired before operation completed.
-1073807339(dec) = BFFF0015(hex)
02-28-2014 10:09 AM
Any idea why it would time out and sometimes work?
02-28-2014 10:10 AM - edited 02-28-2014 10:14 AM
Here are some tips for serial reads. This method the serial read will read until it reaches the termination character or times out. You of course will have to deal with the timeout errors properly if you don't want the program to stop on error.
02-28-2014 10:14 AM
One reason for the time out seems to be (when running the Test serial exe) that the visa write does not seem to be sending the "?" over to the main vi so that the main vi would send the data sting. Any idea why this would not work?
02-28-2014 10:27 AM
I am getting data now but, it seems to be hit or miss. Sometimes it sends an empty or partial string and seems to be running slower that 1Hz as set by the delay. Also, if I did not change the values of the term character or the time out would not be the same as using the defaults? Are they not active as default without wiring a constant to them.
02-28-2014 11:08 AM - edited 02-28-2014 11:09 AM
@teslac wrote:
I am getting data now but, it seems to be hit or miss. Sometimes it sends an empty or partial string and seems to be running slower that 1Hz as set by the delay. Also, if I did not change the values of the term character or the time out would not be the same as using the defaults? Are they not active as default without wiring a constant to them.
The defaults will be used if you do not wire them. Also I forgot to check and see what type of flow control you are using. If you are leaving that terminal unwired it will default to NONE.
Wire it to set a reasonable form of flow control. I have found that XON/XOFF is only good up to 9600 baud, anything over that needs a hardware flow control like RTS/CTS to be reliable. Note that hardware flow control requires the hardware lines to be present in your serial cable. Many cheap serial cables only have Rx/Tx and ground.