Why is the Real-Time Version of Wait Until Next Multiple Behaving Differently in 8.5 Compared to Previous Versions? Primary Software: LabVIEW Modules>>Real-Time ModulePrimary Software Version: 8.5 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: Why is the Wait Until Next Multiple, found on the Real-Time » Real-Time Timing palette, waiting longer than expected? Solution: In LabVIEW 8.5, a change was made to the behavior of the Wait function, as noted in the ReadMe: "On ETS RT targets, the timing behavior of the Wait (ms) function has changed. The Wait (ms) function uses the millisecond timer of the operating system to determine how long to wait. In the LabVIEW 8.2.1 Real-Time Module and earlier, the ETS RTOS counts the next tick of the millisecond timer as millisecond number 1 when counting the number of milliseconds to wait, so the actual amount of wait time is less than the amount you wire to the milliseconds to wait input, by no more than one millisecond. In the LabVIEW 8.5 Real-Time Module, the Wait (ms) function counts the next tick of the millisecond timer as millisecond number 0 when counting the number of milliseconds to wait, so the actual amount of wait time is more than the amount you wire to the milliseconds to wait input, by no more than one millisecond. If you have an application that relies on precise millisecond timing, test the application carefully to ensure the correct behavior. You might need to reduce the value of milliseconds to wait by 1 to maintain the same behavior as the LabVIEW Real-Time Module 8.2.1 and earlier. If you need wait resolution more precise than one millisecond, use the Wait Express VI on the Real-Time Timing VIs palette and configure the Counter Units to µSec. " For the Wait Until Next Multiple function, when set to ms mode, this behavior still applies and has a different effect: At the end of code execution in a loop containing Wait Until Next... the function calculates how long to wait for the next iteration. As a concrete example, say a loop is set to iterate every 5ms. Imagine that the loop code (all the calculations up to the Wait Until Next...) finishes at 4.25 ms. The Wait Until Next... calculates that a wait of 1ms is necessary. But Wait of 1 ms must now wait at least 1 ms. So the actual wait time will be 1.75 ms. The next iteration then starts at what would be time=1 on our absolute scale. This iteration finishes calculations at time=5.25. Now, Wait Until Next... calculates that the next multiple of 5 is 4.75ms away, and will wait until then. This causes undesired loop behavior. See fig. A attached. The workaround is to use microsecond mode and use a wait time of 5000 microseconds. If the loop took less than 4ms, so that at least 1ms was left over, Wait of 1ms would not cause unexpected behavior. See Fig. B attached. Related Links: Attachments:
Report Date: 09/05/2007 Last Updated: 10/22/2007 Document ID: 4D4CNQXL |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
