Navigation:  Equipments (Devices) > PLC200 > Program > Hardware >

PULSES

Previous pageReturn to chapter overviewNext page

Block that generates a certain number of pulses at the specified output.

 

Ladder Representation

 

PULSES_G0

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

EN

BOOL

Block enabling

OutputNumber

CONST

Selected output

NumberOfPulses

DWORD

Total number of pulses of the block execution

Frequency

DWORD DINT

Pulse frequency

VAR_OUTPUT

DONE

BOOL

Output enabling

Active

BOOL

Indicates that the block is active

Busy

BOOL

Indicates that another block is using the selected output

Error

BOOL

Indicates that an error occurred when calling the block

ErrorID

BYTE

Indicates the error generated

VAR

PULSES_INST_0

PULSES

Instance of access to block structure

 

Operation

 

When the EN input is TRUE, the block generates a PWM signal at the output (outputNumber) with the desired frequency (between 0 and 300 kHz) and a constant duty cycle at 50%.

 

The PWM signal is interrupted when the total number of pulses (Pulses) has been generated.

 

As long as the number of generated pulses does not reach the Pulses value, the "Active" output remains at high level.

 

When the Pulses value is reached, the ENO output changes to TRUE.

 

If the EN input goes to FALSE before reaching the number of Pulses, the PWM generation stops immediately.

 

The minimum number of pulses that can be generated is two. However, if the number of pulses to be generated is zero, the block will return success.

 

If this limitation is not observed, no pulse is generated.

 

wpshelp_common_fig_note

NOTE!

If other PWM blocks running use the same output, the one called first will have priority and the "Busy" output is set.

 

Example in Ladder

 

PULSES_example01

 

PULSES_example02

The above example enables a PWM signal in DO1 output with initial frequency 200 Hz and duty cycle of 50%. No type of frequency ramp is performed. In total executing the block, 1000 pulses will be sent to the output. If the block is successfully completed, the DONE output is activated.

 

Example in ST

 

 The example below displays instructions for applying the example above in ST language.

 

 

VAR

   start : BOOL := 0 ;

   coil : BOOL := 0 ;

   pulses : DWORD := 1000;

   freq : DWORD := 200;

   PULSES_INST_0 : FB_PULSES;

END_VAR

 

PULSES_INST_0.EN := start;

PULSES_INST_0(

  OutputNumber:=1,

   numberOfPulses:=pulses,

   Frequency:= freq);

coil := PULSES_INST_0.DONE;