Here are the function blocks for a pulser. There are two of these, one gives out a pulse with a duration of 3 seconds (PulseThreeSeconds) and the other for 4 seconds (PulseFourSeconds). The times in these are hardcoded because they were used a couple of times in the program, and it would have been more work to add a variable to control the pulse length than to make two different ones.

This works so that if it gets a boolean value in, it gives out a pulse that lasts for 3 seconds or 4 seconds respectively. This is regardless if you turn off the input or let it stay on. When the pulse is finished, the function block needs a new rising edge input to send a new pulse.

INPUT - (Example PulseFourSeconds)

  • In → BOOL

OUTPUT- (Example PulseFourSeconds)

  • Out → BOOL

Intern Variables - (ExamplePulseFourSeconds)

  • Timer → TOF
  • Prev_in → BOOL
  • Rising_edge → BOOL


CODED SOLUTION 

Variable Decleration - (Example PulseFourSeconds)

CODE - (Example PulseFourSeconds)






  • No labels