Timer and Counter Accumulated Values (by Jp Jones)
I am trying to create a simple timing circuit that will start a timer from an event and stop the same timer from a different event.
I understand the logic, but I cannot find where I can take a sample of the Timer Accumulated Values. And use those bits in another instruction.
For instanance
Switch one starts the timer and at the same time I take the accumulated value at switch one
and then Switch 2 stops the timer and I take the accumulated value from that same timer.
I wish to be able to use that data. I want to use the accumulated values not the preset.
Thank You
Jp Jones
(no subject) (by Jonathan Westhues)
If you treat the timer variable ('Txxx') as an ordinary 16-bit integer variable, then you will get the accumulated count, in units of cycle times.
For example, let's say that the timer 'Tabc' has been counting for 150 ms. You then set the variable 'x' equal to 'Tabc'. If the cycle time is 10 ms, then 'x' is now equal to 15.
store&reset a counter (by kendhill)
this file attacked is a counter you can set rate and it will store value in a var and reset the timer
how do I change the value contained in readcount for real time? (by Rodrigo)
hello, I used this example to count the resetablecounterstart_stop.ld SHARINGTIME an event with an instruction cycle of 0.3 ms and can not convert it to real-time, compared with a stopwatch and is very different, if you can enlighten me thank you.
Ouvir
Ler foneticamente
Dicionário - Ver dicionário detalhadointerjeição0.hello0.hi0.hoy
(no subject) (by Rodrigo)
example: 1043 = readcount
instruction cycle 0.3 ms
real time = 15.51 s
I tried some calculations, but could not get close to real time
(no subject) (by Jonathan Westhues)
The counter should advance every 10 ms. So 1043 counts should correspond to 10.43 seconds. (In fact, the timings are not quite exact, due to propagation delays in the logic around the timers. You can count cycles while single-stepping in the simulator if you need to get things perfect.)
I'm guessing that you tried the program in the simulator. With very fast cycle times (like the 0.3 ms specified here), the simulator may not be able to keep up. In that case, the program will still run correctly, but the timing will be off.