time − Time Converter
|
loadrt time [count=N|names=name1[,name2...]] |
Cycle Timer
Connect time.n.start to halui.is-running to complete the cycle timer.
|
The pyVCP code to display it might be like: <pyvcp> |
<hbox> |
|||||
|
<label> |
||||||
|
<text>"Cycle Time"</text> |
||||||
|
<font>("Helvetica",14)</font> |
||||||
|
</label> |
||||||
|
<u32> |
||||||
|
<halpin>"time-hours"</halpin> |
||||||
|
<font>("Helvetica",14)</font> |
||||||
|
<format>"2d"</format> |
||||||
|
</u32> |
||||||
|
<label> |
||||||
|
<text>":"</text> |
||||||
|
<font>("Helvetica",14)</font> |
||||||
|
</label> |
||||||
|
<u32> |
||||||
|
<halpin>"time-minutes"</halpin> |
||||||
|
<font>("Helvetica",14)</font> |
||||||
|
<format>"2d"</format> |
||||||
|
</u32> |
||||||
|
<label> |
||||||
|
<text>":"</text> |
||||||
|
<font>("Helvetica",14)</font> |
||||||
|
</label> |
||||||
|
<u32> |
||||||
|
<halpin>"time-seconds"</halpin> |
||||||
|
<font>("Helvetica",14)</font> |
||||||
|
<format>"2d"</format> |
||||||
|
</u32> |
||||||
|
</hbox> </pyvcp> |
In your post-gui.hal file you might use the following to connect it up
loadrt time
addf time.0 servo-thread
net cycle-timer time.0.start <= halui.program.is-running
net cycle-seconds pyvcp.time-seconds <= time.0.seconds
net cycle-minutes pyvcp.time-minutes <= time.0.minutes
net cycle-hours pyvcp.time-hours <= time.0.hours
time.N (requires a floating-point thread)
time.N.start bit in
Run Timer
time.N.seconds u32 out
Seconds
time.N.minutes u32 out
Minutes
time.N.hours u32 out
Hours
John Thornton
GPL