SZSPTP ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
ADC10 sensors reading

ADC10 sensors reading. More...

+ Collaboration diagram for ADC10 sensors reading:

Modules

 Flags indicating ADC10 done reading
 

Files

file  adc.h
 ADC10 connected sensors reading interface.
 

Functions

void adc_init ()
 This function initializes the ADC variables. More...
 
UInt16 adc_proccess ()
 This function processes the tasks of the ADC. More...
 
void adc_getTemp (UInt16 *temp, clock_timeStamp *tempTime)
 This function get current stored temperature. More...
 
void adc_getVolt (UInt16 *volt, clock_timeStamp *voltTime)
 This function get current stored voltage. More...
 
void adc_getLux (UInt16 *lux, clock_timeStamp *luxTime)
 This function get current stored luminescence. More...
 
void ADC10_ISR ()
 ADC10 Interrupt Service Request. More...
 

Detailed Description

ADC10 sensors reading.

Reading of ADC10 sensors is done regularly and can be retrieved any time. The last registered value will be returned.

Function Documentation

void ADC10_ISR ( )

ADC10 Interrupt Service Request.

The value read from the ADC10 is stored on a variable depending on the adc_currentState, and the corresponding flag of reading done is set. If adc_currentState is not a reading state, the ISR is ignored

Definition at line 340 of file adc.c.

References adc_currentState, ADC_FLAGLUXDONE, adc_flags, ADC_FLAGTEMPDONE, ADC_FLAGVOLTDONE, adc_lux, ADC_S_READING_L, ADC_S_READING_T, ADC_S_READING_V, adc_temp, adc_voltage, and clock_getTime().

+ Here is the call graph for this function:

void adc_getLux ( UInt16 *  lux,
clock_timeStamp luxTime 
)

This function get current stored luminescence.

Parameters
[out]luxPointer to destination address for illuminance value.
[out]luxTimePointer to destination address for timestamp.

Definition at line 324 of file adc.c.

References adc_lux.

Referenced by rep_proccess().

+ Here is the caller graph for this function:

void adc_getTemp ( UInt16 *  temp,
clock_timeStamp tempTime 
)

This function get current stored temperature.

Parameters
[out]tempPointer to destination address for temperature value.
[out]tempTimePointer to destination address for timestamp.

Definition at line 294 of file adc.c.

References adc_temp.

Referenced by rep_proccess().

+ Here is the caller graph for this function:

void adc_getVolt ( UInt16 *  volt,
clock_timeStamp voltTime 
)

This function get current stored voltage.

Parameters
[out]voltPointer to destination address for voltage value.
[out]voltTimePointer to destination address for timestamp.

Definition at line 309 of file adc.c.

References adc_voltage.

Referenced by rep_proccess().

+ Here is the caller graph for this function:

void adc_init ( )

This function initializes the ADC variables.

The value of luminance sensor feed is set to 1, so it is turned on/off by the direction of the bit, in or out. All values and time stamps of readings are set to 0.

Definition at line 171 of file adc.c.

References adc_currentState, adc_flags, adc_lux, ADC_LUXSENSFEEDBIT, ADC_S_IDLE, adc_temp, and adc_voltage.

Referenced by main().

+ Here is the caller graph for this function:

UInt16 adc_proccess ( )

This function processes the tasks of the ADC.

The tasks are based on the value of adc_currentState variable. On ech state a check is done, if state have to change, actions are executed and the state changes. The actions of each task on changing to the next are:

  • ADC_S_IDLE: Charge ADC for temperature reading, set state to ADC_S_CHARGING_T;
  • ADC_S_CHARGING_T: Enable conversion for temperature;
  • ADC_S_READING_T: If temperature was read, charge ADC for Voltage, set state to ADC_S_CHARGING_V;
  • ADC_S_CHARGING_V: Enable conversion for voltage;
  • ADC_S_READING_V: If voltage was read, charge ADC for Voltage, set state to ADC_S_CHARGING_L;
  • ADC_S_CHARGING_L: Enable conversion for luminescence;
  • ADC_S_READING_L: If luminescence was read, charge ADC for Voltage, set state to ADC_S_IDLE.

The return value depends on current state, when state changes to charging for any sensor, the return value is 10ms, when it goes to IDLE, the return value is 955ms, all others are 5ms this gives 1s for each measurement cycle if no delay occurs and ADC10 stays read under 5ms after the reading is requested.

Returns
Time to run again (ms); 0 means 65536ms.

Definition at line 218 of file adc.c.

References adc_currentState, ADC_FLAGLUXDONE, adc_flags, ADC_FLAGTEMPDONE, ADC_FLAGVOLTDONE, ADC_LUXSENSFEEDBIT, ADC_S_CHARGING_L, ADC_S_CHARGING_T, ADC_S_CHARGING_V, ADC_S_IDLE, ADC_S_READING_L, ADC_S_READING_T, and ADC_S_READING_V.

Referenced by main().

+ Here is the caller graph for this function: