07-26-2011 09:39 AM
The Bytes at Port would be taken right after the serial write, since you are waiting for data to be returned from the meter. You can use this as a trigger to then read the data from the serial port, testing for your termination character in the process. Broken Arrow suggested this to help with the timing at the serial port and data transfer; otherwise, your port will timeout if it doesn't receive the number of bytes you specified.
07-27-2011 08:23 AM
@MoReese wrote:
[...], your port will timeout if it doesn't receive the number of bytes you specified.
and you said your loop is taking 20 seconds -- 5 seconds too long. You timeout is wired for 5000mS. There's your extra 5 seconds.
07-27-2011 08:43 AM
That makes sense if the device is timing out, however I am not timing out.
07-27-2011 09:00 AM - edited 07-27-2011 09:02 AM
@Dan Stewart wrote:
That makes sense if the device is timing out, however I am not timing out.
Ok, but have you changed your code, following the suggestions, and it still doesn't work? Try sending the command in Hyperterminal and see how long the unit takes to respond. Also try changing your timeout, to say 8 seconds, and see if the loop takes 23 S rather than 20.
In LabVIEW, you might use something like this to read the bytes. This is an easy way to get your own timeout. This will allow ~60mS to get the data. Just change the 5 to a higher number if you're not getting all the data.