03-02-2016 11:53 PM - edited 03-02-2016 11:54 PM
Hi,
I am working an experiment to read values through USB cable. When i enable highlight mode and it runs fine and gives continuous values when i change the input but when i disable highlight mode it doesn't show any output. Can anyone tell me how to solve this problem. I am Using labview version 10 (academic license). It is showing the error code -1073807339
Thanks
-Vikas
03-03-2016 02:00 AM
Hi Vikas,
this error is the typical timeout error! (You should have read the error explanation before…)
Why is this?
Well you try to read 1000 bytes from the port. At 57600 baud this will take ~1000*10/57600s=174ms. But at InitSerialPort you have set a timeout value of just 10ms. Do you see the problem?
Solution: either read less than 57 bytes or increase the timeout value to reasonable values!
03-27-2016 04:27 AM
Timeout value of 10msec is too small.
I too faced the similar thing when i set the timeout value of 100msec but after changing that everything works fine.
03-27-2016 07:00 AM
I never go below 1 second for a hardware timeout. That should be plenty of time for an instrument to either respond to a command or just send out the next data point. You have to allow enough time for the message to come in.
03-28-2016 08:46 AM
If you know the amount of data you will be receiving or transmitting I will calculate the timeout based on the port settings. Here is the code I use:
03-28-2016 09:01 AM
Why are you converting all of those wires to SGL?
Should you be checking the parity setting as well and adding a bit for that if parity is set?
03-28-2016 09:07 AM
@RavensFan wrote:Why are you converting all of those wires to SGL?
Should you be checking the parity setting as well and adding a bit for that if parity is set?
Simply to avoid the data coericion. Since I am calculating the time required based on the data size and then set the timeout to 110% of the necessary time. I did it more to keep the code "pure" than any other reason. You are correct that the parity bit should probably be included.
03-28-2016 09:18 AM - edited 03-28-2016 09:19 AM
If you want a quick calculation that handles 99% of the serial port settings I have ran into, you could just do this.