OBIOPwm
(FB)
FUNCTION_BLOCK OBIOPwm EXTENDS AbbLConCA
Access the PWM functionality for AC500 eco CPU.
- precondition
the respective channel is configured as PWM channel.
|the max allowed time for OnTime or OffTime is 10sec = 10*1000*1000 microseconds
The block accepts OnTime and OffTime in microseconds. The accuracy will be 2.5 us. Pulses will not be shorter, but can be 2.5 us longer.
The block counts the issued pulses. (rising edges are counted)
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
Enable
BOOL
FALSE
A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.
AbbLConCA
Output
Busy
BOOL
FALSE
Operation is running (while output Error is FALSE)
AbbLConCA
Error
BOOL
FALSE
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.
AbbLConCA
Input
Channel
BYTE
0
Channel, 0,1,2,3,4,5,6,7
OnTime
UDINT
time in microseconds to switch the binary output on
OffTime
UDINT
time in microseconds to switch the binary output off
Output
ErrorID
0
Error code
Counter
UDINT
number of pulses which were already issued, 32bit value counting modulo 2EXP32