I'm missing something- using either the template CLD timer or one from the forums I can't get them to work in applications. Generally either the elapsed time doesn't update, or when it does it is a huge number or at least doesn't start at zero.
I know it's not the timer itself, as even with the NI solution timer code I can't get it to work in my applications. But i can't place exactly what's being done differently in the solutions that means theirs work and mine don't. Presumably I'm missing something fundamental about how FGVs work/how threading works which is preventing me from implementing them correctly, but I'm at a loss for what it is.
2 examples. CLD 9 with diagram disabled structure including the three different timers. Works perfectly using the time elapsed express vi. But when I use the ni timer or my own timer it behaves strangely. I suspect think this has something to do with them needing to be reset to begin with?
CLD13 I thought it was me wiring the error in to the timer that was somehow upholding updating of the time elapsed, but since disconnecting it again nothing seems to have changed and the elapsed time isnt being updated. I'm requeuing 'check timer' so I feel the elapsed time should be updating each time this is called, but it's not. My code is quite different to the solution (misunderstood the reqs) so I've found it hard to compare what's going on with the timer.
Any advice would be much appreciated
Are you planning to take CLD certification exam? if you do, I wish you good luck!
Since I am most familiar with the NI Timer, I will give some advice on that VI. From the NI Timer, you shared, I noticed there may be a problem with the Pause, and Unpause cases. For the Pause case, you will need to calculate a new initial time so that the elapsed time won't uphold the time elapsed or update you with a huge number instead of continuing the elapsed time before you paused it.
You will need to subtract the elapsed time from the current time to get the new start time as shown below in a the pause case:
I tried running the CLD 9 NI Timer and one thing I noticed that may become an issue is if you un-paused the timer and there's a gap before you read the timer again. The problem is when you un-paused the timer, the elapsed time became 0 after 1 loop so when you read the timer, the elapsed time will start back from 0 because of that.