09-05-2013 09:02 AM
@RavensFan wrote:
It is NOT necessary to add an additional delay in this while loop. The VISA Read will pace itself. You will have 10 seconds between VISA reads if no data comes in. You'll have some unknown amount of time between VISA reads if data is comiing in. That delay will be a function of how frequently the other device is sending data.
But dont you think after first read and before second read there should be some delay but yes you are right about your last line.
09-05-2013 09:08 AM
@Ranjeet_Singh wrote:
@RavensFan wrote:
It is NOT necessary to add an additional delay in this while loop. The VISA Read will pace itself. You will have 10 seconds between VISA reads if no data comes in. You'll have some unknown amount of time between VISA reads if data is comiing in. That delay will be a function of how frequently the other device is sending data.But dont you think after first read and before second read there should be some delay but yes you are right about your last line.
No.
The delay will be there automatically. If you put in an explicit delay that happens to be too long, then you'll run into a problem where your serial buffer will eventually fill up because you are reading the port slower than the device is sending data. If you put in a short delay, then you might as well not even bother because the device's rate of sending data and the VISA read is what controls the pace of the loop.
09-05-2013 09:16 AM
Yes true but if any sender is sending data in 5 sec then after 5th sec while loop will stop and next read starts immediately.Hence next data will come in 5th sec. hence if between two read delay is there then CPU resource will be free for atlease some ms.Isn't it
09-05-2013 09:20 AM
While the VISA read is waiting for the next data to come in 5 seconds later, the CPU WILL BE FREE to do other work.
09-05-2013 09:25 AM
But control will be there if you see the highlight execution.it will wait till timeout or 4 bytes
09-05-2013 09:31 AM
What does highlight execution have to do with this?
I don't even know what point you are trying to argue anymore.
09-05-2013 09:34 AM
If you enable Highlight execution, according to my experience it will wait till timeout or 4 bytes (in this example).
We actually deveiated from question..better we stop it here.
09-05-2013 09:36 AM - edited 09-05-2013 09:38 AM
@Ranjeet_Singh wrote:
But control will be there if you see the highlight execution.it will wait till timeout or 4 bytes
As Raven said, the VISA Read will read at it's own pace. Life goes on while it is waiting for data. IMHO, hard-coded waits = I don't really understand how to communicate with this particular equipment. (Usually, but not always.)
[edit]
Funny, I just put together a VI with parallel loops and the lightbulb on, and the other loop was looping while the VISA read was waiting...
09-05-2013 09:38 AM
what is that particular equipment by the way
09-05-2013 09:41 AM
@Ranjeet_Singh wrote:
what is that particular equipment by the way
Any equipment, actually - except the most dumbest equipment that won't even tell you when it is ready to receive a new command.