Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Timer and Counter Accumulated Values

(you are viewing a thread; or go back to list of threads)

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
Tue Feb 9 2010, 15:02:24
(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.
Tue Feb 9 2010, 21:18:09
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
Tue Feb 9 2010, 21:58:15, download attachment resetablecounterstart_stop.ld
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
Thu Nov 18 2010, 11:30:53
(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
Thu Nov 18 2010, 11:36:47
(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.
Thu Nov 18 2010, 11:52:26
thanks again (by Rodrigo Luís Ribeiro)
this program is very good
Sat Nov 20 2010, 12:12:54
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):