02-15-2006 05:16 AM
02-17-2006 04:49 AM
02-17-2006 05:00 AM
02-17-2006 05:53 AM
Thanks for your response.
The while loop in this programme only executes when a queue element is available, so it does not hog resources in the same way a free running while loop would. I don't know why timing is important in this case - I am happy for the while loop to dequeue elements as quickly as possible, that's the point of using asynchronous queue handling after all.
If you can provide a specific answer to this I would be very happy!
02-17-2006 06:01 AM
02-17-2006 06:07 AM
02-17-2006 07:33 AM
Hi,
I've tried running your code but I'm missing the enumerated control "PI-E-816Commands". Could you post that please? Also, what hardware are you using?
Where does the error typically occur? Is it at the same VI each time or is it only in certain cases?
Could you have a look at the following knowledge base that has a section on common serial problems. The "Timing in Program, Hanging" looks similar to the error you're seeing.
Try using the Bytes at Serial Port VI as suggested and see if that makes a difference.
02-17-2006 07:53 AM
The programme hangs after an indeterminate number of loops, typically a few, but it doesn't seem to be repeatable.
I don't think it's a common serial error, I'm familiar with those. I've used the Bytes at Serial Port. When it hangs, there are no bytes at the serial port, apparently because the Serial Write has been corrupted (that's what I meant by the fact that my instrument returns a "syntax error" when it hangs, because it hasn't received a properly constructed query). So it's not the classic of waiting for too many bytes, missing a termination character, etc.
I think it's a subtelty about when visa write returns control. Just guessing though.
02-17-2006 08:24 AM
02-17-2006 09:05 AM
No delay
0.00005392 LabVIEW.exe IRP_MJ_WRITE Serial0 SUCCESS Length 11: MOV A1.000.
0.00000279 LabVIEW.exe IRP_MJ_FLUSH_BUFFERS Serial0 SUCCESS
0.00000670 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00067131 LabVIEW.exe IRP_MJ_WRITE Serial0 SUCCESS Length 7: POS? A.
0.00000279 LabVIEW.exe IRP_MJ_FLUSH_BUFFERS Serial0 SUCCESS
0.00000643 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00000838 LabVIEW.exe IRP_MJ_READ Serial0 SUCCESS Length 0:
I move the device to position 1.000 then query its position. There are no bytes in the input buffer, and the program keeps returning zero bytes until the serial read time out occurs.
50ms delay
0.00004805 LabVIEW.exe IRP_MJ_WRITE Serial0 SUCCESS Length 11: MOV A1.969.
0.00000251 LabVIEW.exe IRP_MJ_FLUSH_BUFFERS Serial0 SUCCESS
0.00001173 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00004498 LabVIEW.exe IRP_MJ_WRITE Serial0 SUCCESS Length 7: POS? A.
0.00000279 LabVIEW.exe IRP_MJ_FLUSH_BUFFERS Serial0 SUCCESS
0.00000615 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00000810 LabVIEW.exe IRP_MJ_READ Serial0 SUCCESS Length 0:
0.00000587 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00000587 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00000643 LabVIEW.exe IRP_MJ_READ Serial0 SUCCESS Length 0:
...
0.00000643 LabVIEW.exe IRP_MJ_READ Serial0 SUCCESS Length 0:
0.00000559 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00000866 LabVIEW.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS
0.00000810 LabVIEW.exe IRP_MJ_READ Serial0 SUCCESS Length 7: 1.9679.
I ask it to move to position 1.969, then I query the position and after a few serial read calls, it eventually gets 7 bytes in the buffer and returns them to my program.
I'm now really confused, it seems to be that the POS? A query works fine with a delay, but not without a delay in which case the buffer is always empty. Any ideas?