EasyManua.ls Logo

Balluff MATRIX VISION mvBlueNAOS - Generating a Pulse Width Modulation (PWM)

Balluff MATRIX VISION mvBlueNAOS
292 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
162
1.18.3.2 Generating a pulse width modulation (PWM)
1.18.3.2.1 Basics
To dim a laser line generator, for example, you have to generate a pulse width modulation (PWM).
For this, you will need
• 2 timers and
• the active signal of the second timer at an output line
1.18.3.2.2 Programming the pulse width modulation
You will need two timers and you have to set a trigger.
• Timer1 defines the interval between two triggers.
• Timer2 generates the trigger pulse at the end of Timer1.
The following sample shows a trigger
• which is generated every second and
• the pulse width is 10 ms:
#include <mvIMPACT_CPP/mvIMPACT_acquire.h>
#include <mvIMPACT_CPP/mvIMPACT_acquire_GenICam.h>
...
// Master: Set timers to trig image: Start after queue is filled
GenICam::CounterAndTimerControl catcMaster(pDev);
catcMaster.timerSelector.writeS( "Timer1" );
catcMaster.timerDelay.write( 0. );
catcMaster.timerDuration.write( 1000000. );
catcMaster.timerTriggerSource.writeS( "Timer1End" );
catcMaster.timerSelector.writeS( "Timer2" );
catcMaster.timerDelay.write( 0. );
catcMaster.timerDuration.write( 10000. );
catcMaster.timerTriggerSource.writeS( "Timer1End" );
See also
Counter And Timer Control (p. 73)
Note
Make sure the Timer1 interval must be larger than the processing time. Otherwise, the images are lost.
Now, the two timers will work like the following figure illustrates, which means
• Timer1 is the trigger event and
• Timer2 the trigger pulse width:
MATRIX VISION GmbH

Table of Contents