Difference between revisions of "Component: Timer (Storage)"

From Flowcode Help
Jump to navigationJump to search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.1
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Storage
 
| Storage
 
|}
 
|}
  
  
 +
==Timer component==
 +
Allows you to measure the passage of time via the use of a hardware timer peripheral. Works like a stopwatch with macros to start, stop and reset the timer counter. Returns time as integer Seconds, Milliseconds, Microseconds and also Floating Point and String.
  
==[[File:Component Icon 24ad2718_c70b_4088_aeda_3949dfdba740.png|Image]] Timer component==
+
==Component Pack==
Allows you to measure the passage of time via the use of a hardware timer peripheral.
 
Works like a stopwatch with macros to start and stop the timer counter.
 
Returns time as integer Seconds, Milliseconds, Microseconds and also Floating Point and String.
 
  
==Examples==
+
STORAGE
  
Here is a basic example showing the operation of the timer component used to time a section of code or the duration of a specific event.
+
==Detailed description==
  
{{Fcfile|TimerExample.fcfx|Timer Example}}
 
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>GetCountSeconds</tt></u></span>===
 
Returns the count value as a number of whole seconds, rounded down to the nearest second
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:[[Variable Types|ULONG]]
 
  
  
===<span style="font-weight: normal;"><u><tt>StartCounter</tt></u></span>===
 
Starts the timer counting.
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
 +
''No detailed description exists yet for this component''
  
'''Return value'''
+
==Examples==
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>GetCountString</tt></u></span>===
 
Returns the count value as a floating point string in seconds.
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:[[Variable Types|STRING]]
 
  
  
===<span style="font-weight: normal;"><u><tt>GetCountMicroSeconds</tt></u></span>===
 
Returns the count value as a number of whole microseconds, rounded down to the nearest microsecond
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:[[Variable Types|ULONG]]
+
Here is a basic example showing the operation of the timer component used to time a section of code or the duration of a specific event.
  
 +
{{Fcfile|TimerExample.fcfx|Timer Example}}
  
===<span style="font-weight: normal;"><u><tt>GetCountMilliseconds</tt></u></span>===
+
==Downloadable macro reference==
Returns the count value as a number of whole milliseconds, rounded down to the nearest millisecond
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetCountSeconds'''
 +
|-
 +
| colspan="2" | Returns the count value as a number of whole seconds, rounded down to the nearest second&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''StartCounter'''
 +
|-
 +
| colspan="2" | Starts the timer counting.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 +
| width="90%" | ResetCounters
 +
|-
 +
| colspan="2" | Range: 0-1 where 0=Do Not Reset and 1=Reset&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|ULONG]]
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetCountString'''
 +
|-
 +
| colspan="2" | Returns the count value as a floating point string in seconds.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Precision
 +
|-
 +
| colspan="2" | Number of decimal places to display in string&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>StopCounter</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Stops the timer counting.
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetCountMicroSeconds'''
 +
|-
 +
| colspan="2" | Returns the count value as a number of whole microseconds, rounded down to the nearest microsecond&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetCountMilliseconds'''
 +
|-
 +
| colspan="2" | Returns the count value as a number of whole milliseconds, rounded down to the nearest millisecond&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''StopCounter'''
 +
|-
 +
| colspan="2" | Stops the timer counting.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This call does not return a value''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ResetCounter'''
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>GetCountReal</tt></u></span>===
 
Returns the count value as a floating point value in seconds.
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
:''This macro has no parameters''
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetCountReal'''
 
+
|-
'''Return value'''
+
| colspan="2" | Returns the count value as a floating point value in seconds.&nbsp;
 
+
|-
:[[Variable Types|FLOAT]]
+
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetRawCount'''
 +
|-
 +
| colspan="2" | Efficient command to collect the integer number of instructions since the timer was started.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
==Simulation macro reference==
 
  
''This component does not contain any simulation macros''
 
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Timer</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Timer''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
Timer Peripheral to use to monitor the passage of time.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
<span style="font-weight: normal;"><u>Bit Depth</u></span>
+
|-
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''BitDepth''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Timer
Number of bits in the timer peripheral.
+
|-
 
+
| colspan="2" | Timer Peripheral to use to monitor the passage of time.&nbsp;
8-bit timers can count from 0-255 before overflowing.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
16-bit timers can count from 0 to 65535 before overflowing.
+
| width="90%" | Bit Depth
 
+
|-
<span style="font-weight: normal;"><u>Instruction Rate</u></span>
+
| colspan="2" | Number of bits in the timer peripheral. 8-bit timers can count from 0-255 before overflowing. 16-bit timers can count from 0 to 65535 before overflowing.&nbsp;
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''InstructionRate''.
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Instruction Rate
''<span style="color:red;">No additional information</span>''
+
|-
 
+
| colspan="2" | &nbsp;
 
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
<span style="font-weight: normal;"><u>Rollover Frequency</u></span>
+
| width="90%" | Rollover Frequency
 
+
|-
This property is of type ''Floating point'' and can be referenced with the variable name ''RolloverFreq''.
+
| colspan="2" | &nbsp;
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
+
| width="90%" | Rollover Time
 
+
|-
 
+
| colspan="2" | &nbsp;
<span style="font-weight: normal;"><u>Rollover Time</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
This property is of type ''Floating point'' and can be referenced with the variable name ''RolloverTime''.
+
| width="90%" | Max Time Measurement
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| colspan="2" | Max time in seconds that we can measure before rolling over and starting again.&nbsp;
 
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
<span style="font-weight: normal;"><u>Max Time Measurement</u></span>
+
|-
 
+
|-
This property is of type ''Floating point'' and can be referenced with the variable name ''MaxTimeMeasurement''.
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Timer Delay (ms)
Max time in seconds that we can measure before rolling over and starting again.
+
|-
 +
| colspan="2" | Number of milliseconds between timer events which increment the simulated timer counter variable. 10ms will yield the highest resolution. Values less than this will likely just increase the error and making the timer run slow. Higher delays will yield greater accuracy.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Decimal Points
 +
|-
 +
| colspan="2" | &nbsp;
 +
|}

Latest revision as of 17:24, 9 November 2022

Author Matrix TSL
Version 1.1
Category Storage


Timer component

Allows you to measure the passage of time via the use of a hardware timer peripheral. Works like a stopwatch with macros to start, stop and reset the timer counter. Returns time as integer Seconds, Milliseconds, Microseconds and also Floating Point and String.

Component Pack

STORAGE

Detailed description

No detailed description exists yet for this component

Examples

Here is a basic example showing the operation of the timer component used to time a section of code or the duration of a specific event.

FC6 Icon.png Timer Example

Downloadable macro reference

Fc9-comp-macro.png GetCountSeconds
Returns the count value as a number of whole seconds, rounded down to the nearest second 
Fc9-u32-icon.png - ULONG Return


Fc9-comp-macro.png StartCounter
Starts the timer counting. 
Fc9-bool-icon.png - BOOL ResetCounters
Range: 0-1 where 0=Do Not Reset and 1=Reset 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetCountString
Returns the count value as a floating point string in seconds. 
Fc9-u8-icon.png - BYTE Precision
Number of decimal places to display in string 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png GetCountMicroSeconds
Returns the count value as a number of whole microseconds, rounded down to the nearest microsecond 
Fc9-u32-icon.png - ULONG Return


Fc9-comp-macro.png GetCountMilliseconds
Returns the count value as a number of whole milliseconds, rounded down to the nearest millisecond 
Fc9-u32-icon.png - ULONG Return


Fc9-comp-macro.png StopCounter
Stops the timer counting. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ResetCounter
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetCountReal
Returns the count value as a floating point value in seconds. 
Fc9-f32-icon.png - FLOAT Return


Fc9-comp-macro.png GetRawCount
Efficient command to collect the integer number of instructions since the timer was started. 
Fc9-u32-icon.png - ULONG Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Timer
Timer Peripheral to use to monitor the passage of time. 
Fc9-type-21-icon.png Bit Depth
Number of bits in the timer peripheral. 8-bit timers can count from 0-255 before overflowing. 16-bit timers can count from 0 to 65535 before overflowing. 
Fc9-type-21-icon.png Instruction Rate
 
Fc9-type-15-icon.png Rollover Frequency
 
Fc9-type-15-icon.png Rollover Time
 
Fc9-type-15-icon.png Max Time Measurement
Max time in seconds that we can measure before rolling over and starting again. 
Fc9-conn-icon.png Simulation
Fc9-type-21-icon.png Timer Delay (ms)
Number of milliseconds between timer events which increment the simulated timer counter variable. 10ms will yield the highest resolution. Values less than this will likely just increase the error and making the timer run slow. Higher delays will yield greater accuracy. 
Fc9-type-21-icon.png Decimal Points