<< Click to Display Table of Contents >> Example |
The "Arbitrary Waveform Generator" generates a sin waveform with amplitude 2 and frequency 1 Hz. The output of the generator is of type float. Values less equal 0 are converted to false. Value greater 0 are converted to true (see type conversion). The counter counts on rising edge, i.e. when the input changes from false to true. This happens exactly once per second at the beginning of the sine wave. The counter values represents therefore the time in seconds since sub-program start.
The following example shows how to use the initial value input to count over sub-program boundaries. The main program executes Step1 and Step2 sequentially. After Step2 is finished, we restart with Step1.
Hauptprogramm
Step1
The Counter writes its result into the global variable "count". After restart of Step1 the global variable count is used as inital value for the Counter. Step1 is active until the second "Arbitrary Waveform Generator" generates a value greater 9. This happens after 10s.
Step2
Step2 is also 10s active.