OBIOMotionPwm
(FB)
FUNCTION_BLOCK OBIOMotionPwm EXTENDS AbbLConCA
Single axis point-to-point or velocity movement, utilizing the PWM functionality for AC500 eco CPU.
- precondition
the respective channel is configured as PWM channel.
- basic input parameters
- OpenLoop
- MaxFrequency
Used as a reference value to calculate the acceleration and deceleration. The axis will run from MinFrequency to MaxFrequency in RefAcceleration[ms] time.
- MinFrequency
The movement will start and end with MinFrequency. The value should not be too small: 1Hz would mean the first/last step needs 1s.
- Cycle
cycle time for the PLC program [ms]. A wrong setting for “Cycle” will result in wrong acceleration/deceleration ramps
- p2p
provides the positioning method. It can either be of type OBIOBasicPoint2Point, which will use trapezoidal ramps, or of type OBIOSineSquaePoint2Point, which will use sinesquare ramps.
- velocity movement
A continuous velocity movement is started with a rising edge at ExecuteVel.
The parameters used are RefFrequency, RefDirection, RefAcceleration and RefDeceleration.
These paremeters can be changed during the movement and will be used immediately.
The output InVelocity indicates that the required velocity is reached.
The movement can be stopped with input Stop.
- positioning movement
A positioning movement can be started with a rising edge at ExecutePos. It is an absolute positioning.
The parameters used are RefFrequency, RefAcceleration, RefDeceleration and RefPosition. No new values will be accepted during the movement.
The output InPosition indicates that the movement is completed.
The movement can be stopped with input Stop.
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
PWM channel, 0..7, requires according configuration
OpenLoop
BOOL
TRUE
do not use the ActPosition as input if OpenLoop=TRUE is set. Instead, the number of pulses send to PWM will be written on ActPosition
ResetPos
BOOL
Reset the position on rising edge to “0”, just allowed when Busy=FALSE
ExecutePos
BOOL
start the algorithm with a rising edge, absolute positioning, just allowed with Busy=FALSE
ExecuteVel
BOOL
start a continuous movement with a rising edge,just allowed with Busy=FALSE
Stop
BOOL
Stop using RefDeceleration. Stop will overrule ExecutePos and ExecuteVel
RefPosition
DINT
absolute position, where to move with rising edge at ExecutePos
RefFrequency
DWORD
Reference Frequency in Hz, can be continuously changed for velocity movement
RefDirection
BOOL
direction, used for velocity movement
RefAcceleration
TIME
TIME#1s0ms
Acceleration as time in ms to run from MinFrequency to MaxFrequency
RefDeceleration
TIME
TIME#1s0ms
Deceleration as time in ms to run from MinFrequency to MaxFrequency
MaxFrequency
DWORD
100000
maximum frequency for frequency output, new value just used with Enable=FALSE
MinFrequency
DWORD
500
minimum for frequency output, new value just used with Enable=FALSE
Cycle
INT
1
Cycle time of the PLC-Program in ms, new value just used with Enable=FALSE
Inout
ActPosition
DINT
Actual position
Output
ErrorID
Error Code
Active
BOOL
positioning is completed A new movement can just be started with Active=FALSE. Active is mutually exclusive with InPosition. A ExecutePos for the current position might result in InPosition without showing Active.
InPosition
BOOL
positioning is completed
InVelocity
BOOL
RefFrequency=ActFrequency
ActFrequency
DWORD
moving frequency for the drive in inc/s. This value is send to the PWM channel (FB (INTERNAL)).
ActDirection
BOOL
TRUE means: move forward. This output has to be connected to a binary output, to send the direction information to the stepper drive.
Inout
p2p
OBIOPoint2Point
provide interpolation method