Input Description

../_images/2db4df40e389b0610a33139000eba54e

EN

Data_Type Default_Value Range Unit
BOOL - - -

In order to enable the Function Block processing, input EN has to be continuously set to TRUE. The Function Block is not processed if input EN = FALSE.

When calling the Function Block the first time, the inputs are checked for validity and plausibility. If this is not the case, processing is aborted and corresponding error is displayed at output ERR/ERNO.

CHN_NUM

Data_Type Default_Value Range Unit
WORD - - -

CHN_NUM contains the channel number managed by the Function Block:

  • CHN_NUM = 0: the output O0 is managed
  • CHN_NUM = 1: the output O1 is managed

EN_PWM

Data_Type Default_Value Range Unit
BOOL - - -

If EN_PWM = TRUE, the pulse-width modulator is enabled. If EN_PWM = FALSE, no pulse-width modulation is performed.

Input EN_PWM corresponds to output bit 7 in “control byte”.

FREQ

Data_Type Default_Value Range Unit
DWORD - 1 … 100 KHz

Input FREQ is used to specify the frequency of output. The frequency can be set from 1 to 100 KHz.

The duty cycle is fixed (50 %).

The frequency value is defined with a double word (DWORD), but the internal communication with CD522 is realized with WORD type. For frequencies greater than 65535 Hz (word limitation) an additional bit is internally used as multiplier. Thus, for such frequencies the resolution becomes 10 Hz.

The additional multiplier bit is the bit 0 of “control byte”. If bit 0 of “control byte”=TRUE, the frequency multiplier x10 is enabled.

DUTY_CYCLE

Data_Type Default_Value Range Unit
WORD - 1 … 100 KHz

The input DUTY_CYCLE is used to specify the percentage of time set to TRUE. The duty cycle is from 0.0 to 100.0 (0 % to 100 %); the value is written without dot. That means, for example, for 75.8 % the value written will be 758. The max. value authorized will be 1000 to specify a duty cycle = 100 %.

On fast outputs O0 and O1, the brightness of the yellow LED depends on the value of duty cycle specified (from 0 to 100 %).

If the written value is greater than 1000 or less than 0, an error code will be displayed in ERR and ERNO outputs and the red error LED CH-ERR1 will flash. The last entered valid value will be used or the value ‘0’ if no value has been entered before.

Input DUTY_CYCLE corresponds to output word “PWM Duty cycle/pulse”.

ADR_IN   POINTER \ TO structCD522counterin

At this input, the address of the first input data from the structure of counter input of CD522 should be connected. The use of an ADR operator is needed. If input ADR_IN is not connected, then the outputs DONE=FALSE and ERR= TRUE.

Example (for counter 0):

../_images/88f652fee389abfe0a33139000eba54e

ADR_OUT   POINTER \ TO structCD522counterout

At this input, the address of the first output data from the structure of counter output of CD522 should be connected. The use of an ADR operator is needed. If input ADR_OUT is not connected, then the outputs DONE=FALSE and ERR= TRUE.

Example (for counter 0):

../_images/fb78a117e389ac5b0a33139000eba54e