Table of Contents

ParameterPeriodicAccess

Namespace
ZAux
FUNCTION_BLOCK ParameterPeriodicAccess

This function block can be used to cyclically read or write a parameter with a ParameterChannel. It is useful to poll process parameters like a motor temperature.

The following code is used to read the temperature of a Keba ServoOne drive every 5 seconds into the variable _value.

_motorTemperature : LREAL;
parameter : ParameterPeriodicAccess(parent:=THIS^, channel:=_parameterChannelCan,
                      interval:=5,
                      actionFlags:=ZCore.ParameterChannelActionFlag.Read,
                      parameter:=16#21C900, parameterType:=ZCore.ParameterChannelCanParameterType.Float32, parameterElement:=0,
                      bufferPtr:=ADR(_motorTemperature), buffersize:=SIZEOF(_motorTemperature));

The channel can be overwritten by the Channel property at any time, which is useful if it is not accessible during construction.

Note

The function block relies on the parameter channel for error handling. Even if a parameter is not present on a device (this causes an error in the ParameterChannel), this function block will continue to poll.

Constructor

FB_init

METHOD FB_init (
 [input] bInitRetains : BOOL,
 [input] bInCopyCode : BOOL,
 [input] parent : ZCore.IManagedObject,
 [input] channel : ZCore.IParameterChannel,
 [input] interval : LREAL,
 [input] taskToken : ZCore.ITaskToken,
 [input] actionFlags : ZCore.ParameterChannelActionFlag,
 [input] parameter1 : DWORD,
 [input] parameter2 : DWORD,
 [input] parameterType : INT,
 [input] bufferPtr : ZCore.ZPointer,
 [input] bufferSize : UDINT) : BOOL

The constructor of ManagedObject takes a parent as parameter, which is then notified about the creation of this instance.

Inputs

bInitRetains BOOL

if TRUE, the retain variables are initialized (warm start / cold start)

bInCopyCode BOOL

if TRUE, the instance afterwards gets moved into the copy code (online change)

parent IManagedObject
channel IParameterChannel

ParameterChannel that is used to access the parameter

interval LREAL

in seconds, controls how often a parameter is accessed

taskToken ITaskToken
actionFlags ParameterChannelActionFlag

actions to be performed for the following parameter. This is a flag parameter (several actions are possible)

parameter1 DWORD

i.e. S-Parameter [0-32767, 16#0000 - 16#7FFF] or P-Parameter [32768-65535, 16#8000 - 16#FFFF]

parameter2 DWORD

i.e. ParameterChannelScpParameterElement

parameterType INT

i.e. ParameterChannelScpParameterType or ParameterChannelCanParameterType

bufferPtr ZPointer

Pointer to the location this method writes to or reads from, i.e. ADR(_value)

bufferSize UDINT

Size of the buffer which bufferPtr is pointing to

Returns

BOOL

Properties

Channel

PROPERTY Channel : ZCore.IParameterChannel

This property can be used to return or set the parameter channel. The Parameterchannel is used to access the parameter that is set up during construction of the object by the constructor. The channel can be changed at any time, which causes a read or write access immediately.

Property Value

IParameterChannel

Interval

PROPERTY Interval : LREAL

This property can be used to access the polling interval of the function block. If the interval is changed, a new read/write operation is triggered automatically.

Property Value

LREAL