The Motion Capture card comes with a choice of full featured, software drivers that provide a programmatic interface to the functions of the card. The following features apply to all driver types:
C DLL Driver Example
The example shown on the reverse side uses one Motion Capture card set to address 330 Hex to capture the strobed position of encoders attached to channels 0 and 1. Both channels 0 and 1 are programmed to accept RS422 signals with 120 Ohm termination. The inputs are programmed to interpret the input signals as Quadrature 1X signals. 20 two channel samples are acquired at a rate of 1mS per sample. The read function is told to read and return immediately if data is not available (no timeout).
Main() { // Read variables unsigned long samplesRead; TMotionCaptureSample sampleBuffer[40]; // 20 samples PER channel short error, status, dataRateStatus; // Initialize and configure variables unsigned short brdList[2] = { 0, 0 }; unsigned short chanList[2] = { 0, 1 }; unsigned short msrTypeList[2] = { 0, 0 }; unsigned short brdInitList[1] = {0}; unsigned short addrInitList[1] = {0x330}; if( (error = ER_MC_Initialize(brdInitList, addrInitList, 1, ".\\")) ) { printf("Error: %d during initialization()\n",error); return( 0 ); } ER_MC_ConfigureEncoderInputMode( 0, 0, 0 ); // Encoder 0, 1X mode ER_MC_ConfigureEncoderInputMode( 0, 1, 0 ); // Encoder 1, 1X mode ER_MC_ConfigureEncoderInputInterface( 0, 0, 0, 1 ); // Enc 0, RS422, 120 Ohm ER_MC_ConfigureEncoderInputInterface( 0, 1, 0, 1 ); // Enc 1, RS422, 120 Ohm ER_MC_SetMeasurementList( brdList, chanList, msrTypeList, 2 ); // what to measure ER_MC_ConfigureTimebaseSamplingByTimeForSampleCount(0.001, 20 ); // How to sample ER_MC_TimebaseStart(); // Start sampling ER_MC_Read( sampleBuffer, 40, &samplesRead, &status, 0.0, (short *)0, 1, &dataRateStatus); // We have just read samplesRead new samples. Now we can either process the // samples read in sampleBuffer or accumulate the samples for later processing // and call ER_MC_Read() again to read more samples ER_MC_Close(); } |
LabView Example
The LabView driver for the Motion Capture cards adheres to LabView conventions. Below is a simple example that illustrates the measurement of position on encoder 1 using the two position measurement techniques (strobed and armed position) available with the Motion Capture card. Notice how the time and position value pairs of the armed position measurement more accurately predict the behavior of the encoder.
Euclid Research · 2 North 1st Street, 6th Floor · San Jose, CA 95113-1201
Tel: (408) 283-9020 · Fax: (408) 283-9029