MeasurementEngine
 
Component MeasurementEngine
MeasurementEngine
Component Level: Low
Typical Usage:
(Examples of a typical usage of the component in user code. For more information please see the page Component Code Typical Usage.)

Typical usage examples:

(1) - Software triggering of PDB module
This example implies using SW triggerring fired after signal level change on the selected input pin. The input pin is encapsulated by ExtInt component which invokes OnInterrupt event after selected signal level change, and MeasurementEngine's method PDB_SWtrigger is invoked in the event code. This example requires two components in a user project:

ExtInt with Component name EInt1,

MeasurementEngine with the following configuration:

EVENTS.C

void EInt1_OnInterrupt(void) { ME1_PDB_SWtrigger(); }

(2) - Sofwtare triggering of ADC module (ADC_Start_SingleConversion), with interrupt service
This example implies how to properly obtain measured data from appropriate result register within OnConvComplete event when SW triggering of ADC module (ADC_StartSingleConversion) is used.

Required settings of Measurement engine component:


ME1_TTrgSettingType My_struct = { 0, // Trigger Delay (considered as zero for using within ADC_StartSingleConversion method) 0, // Channel number 0 0, // Differential mode disabled 1 // ADC interrupt enabled (from first result register) };
MAIN.C
ME1_ADC_StartSingleConversion(0,&My_struct);
EVENTS.C

word Data;
void ME1_OnConvComplete(void) { if (ME1_ADC_GetConvCompleteStatus(ME1_TRIGGER_0A)) { ME1_ADC_GetMeasuredValue(ME1_TRIGGER_0A, &Data); } else { // data not ready } }