OBIOFreqOut (FB)
FUNCTION_BLOCK OBIOFreqOut EXTENDS AbbLConC3
Access the PWM functionality for AC500 eco CPU and issue an adjustable frequency
- precondition
the respective channel is configured as PWM channel.
Note
the onboard “12DI/6DO-R/2DC” (e.g. PM5052-R) will allow 2 PWM configuration with the 2DC. They are channel 6/7. This configuration will support OBIOFreqOut
Up to 8 PWM channel are possible. The max possible frequency is determined by hardware delay times.
Maximum possible frequency for channel 0..3 is 5kHz.
Maximum possible frequency for channel 4..7 is 100 kHz. Recommended is to use <50kHz
The block accepts Frequency in Hz. The frequency will be measured and adjusted, so that the average value meets the correct frequency, but single pulses can be longer or shorter.
The block counts the issued pulses. (rising edges are counted)
Note
the onboard “12DI/6DO-R/2DC” (e.g. PM5052-R) will allow 2 PWM configuration with the 2DC. They are channel 6/7. This will support OBIOPwm
Note
This block should just be called once per cycle otherwise inconsistent values could be send to PRU, if send twice in short time.
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
EnableBOOLFALSE
A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. Execution will continue forever until a falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.
AbbLConC3
Output
BusyBOOLFALSE
Operation is running (while output Error is FALSE)
AbbLConC3
ErrorBOOLFALSE
Operation is stopped with error (while output Busy is FALSE). This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ErrorID gives more details about the error.
AbbLConC3
Input
ChannelBYTE0
Channel, 0,1,2,3,4,5,6,7
FrequencyLREAL[Hz] 0,05Hz..100kHz to switch the binary output on/off
Output
ErrorID0
Error code
CounterUDINTnumber of pulses which were already issued, 32bit value counting modulo 2EXP32