| Customize Help

Controlling your lighting device indirectly



The auxiliary output signals of your Matrox Iris GTR can be linked to the exposure signal to control a lighting device that illuminates an object when the camera takes a picture.

To indirectly control a lighting device with the timer strobe signal, perform the following:

  1. Connect a lighting controller to an auxiliary output signal.

  2. Set the source of the auxiliary output signal to the timer strobe, using MsysControl() with M_IO_SOURCE set to M_TIMER_STROBE.

  3. To control the timer strobe, use MdigControl() with M_TIMER... + M_TIMER_STROBE.

For more information about setting up a strobe timer, refer to the Timers and coordinating events section of Chapter 41: I/O signals and communicating with external devices.

Using either a grab trigger or a continuous grab to start your lighting device

Whenever using a lighting device, it will always start cold (that is, completely discharged) and take a certain amount of time to reach the specified intensity.

How you account for this cold period when setting up the strobe timer, depends on how you are grabbing:

  • Continuous (or almost continuous) grabs. If you are grabbing a sequence of images with a negligible amount of delay between one image and the next, you only have to deal with the lighting device being cold at the very beginning of the grab sequence. In this case, you can trigger the strobe timer when the camera starts exposing its sensor (using M_TIMER_TRIGGER_SOURCE set to M_EXPOSURE_START).

  • Triggered grabs. If you are grabbing images based on a trigger that might arrive after a non-negligible delay, you will have to account for the lighting device recharging before reaching the specified intensity for each grab. In this case, you should trigger the strobe timer upon the grab trigger signal (using M_TIMER_TRIGGER_SOURCE set to M_GRAB_TRIGGER).

Typically, the lighting device should be illuminated for the duration of the camera's exposure time. Unlike with other products, when using the grab trigger signal to trigger the strobe timer, the specified duration of the strobe timer's output signal (set using M_TIMER_DURATION + M_TIMER_STROBE) specifies how long the timer should remain active during the exposure period (and therefore how long the lighting device should remain active during the exposure period). The active period of the strobe timer's output will actually start after the specified delay, but the count for how long it should remain active only starts when the camera starts exposing its image sensor. Once counting begins, the signal will typically be active for the specified duration. If the duration of the strobe timer is greater than the exposure time, the strobe timer's output signal will end when the exposure time ends (set using M_EXPOSURE_TIME).

This allows for hardware-specific variances to occur between when the grab trigger signal arrives and when the exposure of the camera's sensor actually starts.

The maximum amount of time it takes for your lighting device to arrive at the required intensity must be probed. This is because the amount of time is hardware-specific, and can vary greatly based on the type of lighting device, the period of the lighting device's reduced activity (caused by significant delays between grab triggers, or long processing delays during MdigProcess()) or inactivity (such as, between individual grabs with MdigGrab()).

When the exposure ends and the strobe timer's stops outputting an active signal, the lighting device begins to discharge and grow cold.

Controlling your lighting controller and/or the LED lighting device

The following is an example of how to configure a grab using the camera's exposure and the strobe timer.

MIL_ID MilApplication,  /* Application identifier.  */
       MilSystem,       /* System identifier.       */
       MilDisplay,      /* Display identifier.      */
       MilDigitizer,    /* Digitizer identifier.    */ 
       MilImage;        /* Image buffer identifier. */

MIL_DOUBLE ExposureTime = 9000 * 1000;
MIL_DOUBLE ExposureTimeDelay = ExposureTime / 3;
MIL_DOUBLE StrobeLength = ExposureTime + ExposureTimeDelay;
MIL_DOUBLE StrobeTimeDelay = 0;
MIL_DOUBLE StrobeLevel = 128;

//Allocate defaults.
MappAllocDefault(M_DEFAULT, &MilApplication, &MilSystem, &MilDisplay, 
                 &MilDigitizer, &MilImage);
//Set the grab trigger source to be an external signal.
MdigControl(MilDigitizer, M_GRAB_TRIGGER_SOURCE, M_AUX_IO8);

//Specify to trigger the grab on the falling edge of the grab trigger signal. 
//Note that this could be set to the default, which is the same as M_EDGE_RISING.
MdigControl(MilDigitizer, M_GRAB_TRIGGER_ACTIVATION, M_EDGE_FALLING);

//Setup the exposure settings (in nanoseconds)
MdigControl(MilDigitizer, M_EXPOSURE_TIME, ExposureTime); 
MdigControl(MilDigitizer, M_EXPOSURE_DELAY, ExposureTimeDelay); 

//Invert the timer output.
MdigControl(MilDigitizer, M_TIMER_OUTPUT_INVERTER+M_TIMER_STROBE, M_ENABLE);

//Sets the grab trigger source signal as the trigger source.
MdigControl(MilDigitizer, M_TIMER_TRIGGER_SOURCE+M_TIMER_STROBE, M_GRAB_TRIGGER);

//Sets a delay before the active portion of the stobe (in nanoseconds).
MdigControl(MilDigitizer, M_TIMER_DELAY+M_TIMER_STROBE, StrobeTimeDelay);

//Sets the duration of the active portion of the strobe (in nanoseconds) during the exposure period.
//If set to M_INFINITE, the signal will always be ON.
MdigControl(MilDigitizer, M_TIMER_DURATION+M_TIMER_STROBE, StrobeLength);

//Enable timer 2 to output a pulse-train strobe signal and CCS output.
MdigControl(MilDigitizer, M_TIMER_STATE+M_TIMER_STROBE, M_ENABLE);

//Enable the strobe signal on M_AUX_IO4.
MsysControl(MilSystem, M_IO_SOURCE + M_AUX_IO4, M_TIMER_STROBE);

//Enable the grab trigger.
MdigControl(MilDigitizer, M_GRAB_TRIGGER_STATE, M_ENABLE);

//Grab continuously.
MdigGrabContinuous(MilDigitizer, MilImage);

//Wait.
MosGetch();

//Stop continuous grab.
MdigHalt(MilDigitizer);

//Disable the timer.
MdigControl(MilDigitizer, M_TIMER_STATE+M_TIMER_STROBE, M_DISABLE);

//Disable the grab trigger.
MdigControl(MilDigitizer, M_GRAB_TRIGGER_STATE, M_DISABLE);

//Free the defaults.
MappFreeDefault(MilApplication, MilSystem, MilDisplay, MilDigitizer, MilImage);