Using Zebra Rapixo CoF data latches
Zebra Rapixo CoF has data latches to store signal state information, the quadrature decoder's counter value, or a timestamp at a specific point during a grab. Data latches are reset at every end of grabbed frame event. Data latches do not suffer the delays typical to hooking a hook-handler function to these specific points during the grab and inquiring and storing related information using software.
[Image: radient_data_latches_hardaware_concept.png]
Note: Data latches are only available when using an Aurora Imaging Library digitizer allocated using
MdigAllocwithM_DEV0. Zebra Rapixo CoF has 16 data latches for use with a digitizer allocated withM_DEV0.
You can specify the data latch trigger source and the data to record upon the trigger using MdigControl with the M_DATA_LATCH... control types.
To retrieve data from a data latch, use MdigGetHookInfowith M_DATA_LATCH....
Steps to configure and retrieve data from a data latch
The following steps provide a basic methodology for configuring and retrieving data from a data latch:
- Specify what triggers storing the specified information to the specified data latch, using
MdigControlwithM_DATA_LATCH_TRIGGER_SOURCE+M_LATCHn. The trigger can be a specific auxiliary signal, a quadrature decoder's counter value, a timer active event, or one of a limited number of grab events (such as a start of frame event or at every line of the image). - If necessary, specify the trigger signal transition upon which to store the information, using
M_DATA_LATCH_TRIGGER_ACTIVATION+M_LATCHn. Note that this is only useful whenM_DATA_LATCH_TRIGGER_SOURCE+M_LATCHnis set toM_AUX_IOnorM_TIMER_ACTIVE. - Specify the type of information to store, using
M_DATA_LATCH_TYPE+M_LATCHn. Note that a data latch can store only one type of information, and each type of information can only be associated with one data latch, except for timestamp, which can be associated with up to four data latches. Aurora Imaging Library returns an error when this limitation is not respected. - To latch data before the start of the first grabbed frame, set
M_DATA_LATCH_MODE+M_LATCHntoM_PREFETCH. Otherwise, if the data latch is triggered before the start of the first grabbed frame, no information is stored. To latch data only once the grab has started (that is, as of the start of the first grabbed frame), setM_DATA_LATCH_MODEtoM_DEFAULT; this is the default value. - Enable the data latch using
M_DATA_LATCH_STATE+M_LATCHnset toM_ENABLE. - If necessary, repeat steps 1 to 5 for each data latch used.
- Perform the grab. You can use
MdigProcessto grab an image; in the hook-handler function, retrieve and make use of the information stored in the data latch, usingMdigGetHookInfowithM_DATA_LATCH_VALUE. Alternatively, hook a hook-handler function to the end of grab frame event (M_GRAB_FRAME_END) usingMdigHookFunction, and callMdigGrabto grab an image; then, to retrieve and make use of the information stored in the data latch, callMdigGetHookInfowithM_DATA_LATCH_VALUE. - When done, disable the data latches using
MdigControlwithM_DATA_LATCH_STATE+M_LATCHnset toM_DISABLE.
Triggering a data latch
Data latches can store data at several different points during a grab. Below are a few events that can trigger a data latch.
[Image: radient_data_latches.png]
| Callout # | MdigControl with M_DATA_LATCH_TRIGGER_SOURCE | MdigControl with M_DATA_LATCH_TRIGGER_ACTIVATION |
| 1, 4, and 8 | M_AUX_IOn | M_EDGE_RISING |
| 2, 5, and 9 | M_TIMER_ACTIVE | M_EDGE_RISING or M_EDGE_FALLING |
| 3 and 7 | M_GRAB_FRAME_START | |
| 6 and 10 | M_GRAB_FRAME_END | |
| 3 to 6 and 7 to 10 | M_GRAB_LINE |
Events that occur before the start of the first grabbed frame of queued grabs or a grab sequence (such as, any auxiliary I/O change event, rotary decoder position change, or timer active event) can only trigger a data latch if the data latch has its mode set to prefetch (using MdigControl with M_DATA_LATCH_MODE set to M_PREFETCH).
In the above image, if the data latch mode is set to prefetch (using M_DATA_LATCH_MODEset to M_PREFETCH), reading the data latch at the end of frame 1 could return the information latched at captions 1 through 6, depending on which event triggers the data latch. However, if the data latch mode is set to default (M_DATA_LATCH_MODEto M_DEFAULT), reading the data latch at the end of frame 1 could only return captions 3 through 6. In both cases, reading the data latch at the end of frame 2 could return captions 7 though 10. Captions 5 and 6 are returned at the end of frame 1, even though they relate to frame 2 because the data of all enabled data latches is returned at the end of every grabbed frame end event (that is, at the end of each grabbed frame).
If calls to MdigGraboccur while no other grab is currently being performed and M_DATA_LATCH_MODE is set to M_PREFETCH, events that occur from the moment the grab command is issued until the start of the grabbed frame can also trigger a data latch and be retrieved at the end of the grabbed frame, for each MdigGrab call.
[Image: radient_data_latches_monoshot.png]
| Callout # | MdigControl with M_DATA_LATCH_TRIGGER_SOURCE | MdigControl with M_DATA_LATCH_TRIGGER_ACTIVATION |
| A and F | M_AUX_IOn | M_EDGE_RISING |
| B and G | M_TIMER_ACTIVE | M_EDGE_RISING or M_EDGE_FALLING |
| C and H | M_GRAB_FRAME_START | |
| D and I | M_GRAB_FRAME_END | |
| C to D and H to I | M_GRAB_LINE | |
| E | No data can be latched during this period |
In the above image, if the data latch mode is set to M_PREFETCH, reading the data latch at the end of frame 1 could return the information latched at captions A through D, depending on which event triggers the data latch. In this example, no data latch can return information relating to events during caption E. Frame 2 could return the information latched at captions F through I. Note that, when using MdigProcess or when queuing grabs using MdigGrab in asynchronous mode, there is no dead zone.
Data latch limitations
To set the type of data that a data latch should store, use M_DATA_LATCH_TYPE. In most cases, you can set up only one data latch to record a specific type of data (for example, only one data latch can store the status of all I/O signals). The exceptions to this are data latches that store timestamps; you can set up four data latches to store timestamps. Aurora Imaging Library returns an error when this limitation is not respected.
Retrieving data latch information
Aurora Imaging Library allows each data latch to store multiple instances of the same type of data. You can retrieve a specific instance using the combination value M_VALUE_INDEX(). For example, when latching the timestamp at the end of each grabbed line of a frame with 1024 lines, to retrieve the 1024th timestamp, use MdigGetHookInfo with M_DATA_LATCH_VALUE + M_LATCHn+ M_VALUE_INDEX(1023), where n is the number associated with the data latch.
To retrieve all the stored information associated with a specific data latch, use M_DATA_LATCH_VALUE_ALL + M_LATCHn. Using the previous example, this would return 1024 timestamps.
To inquire how many pieces of information are stored inside a data latch, use M_DATA_LATCH_VALUE_COUNT.
To convert a timestamp from clock ticks to seconds, use the following equation: _Timestamp_ * (TimestampFrequencyInHz). To inquire the clock frequency, use MdigInquire with M_DATA_LATCH_CLOCK_FREQUENCY.
Data latch example
For an example of how to use the Zebra Rapixo CoF family data latches, refer to the DataLatch.cpp example.