Aguijón Software Libraries  1.0
Documentation for the included Libraries
 All Files Functions Variables Typedefs Enumerations Enumerator Macros
analog.c File Reference
#include <p24FJ128GB106.h>
#include "definitions.h"
#include "analog.h"

Go to the source code of this file.

Macros

#define ADC_MAX_VALUE   1023
 Since the ADC is 10bits, the max value is 1023.
 
#define ADC_MIN_VALUE   0
 Min value must be zero.
 

Functions

void initADC (void)
 
int readADC (void)
 
int normalize_ADCReading (unsigned char inferiorLimit, unsigned char superiorLimit)
 

Macro Definition Documentation

#define ADC_MAX_VALUE   1023

Since the ADC is 10bits, the max value is 1023.

Definition at line 28 of file analog.c.

#define ADC_MIN_VALUE   0

Min value must be zero.

Definition at line 30 of file analog.c.

Function Documentation

void initADC ( void  )

Function: initADC

Preconditions: None.

Overview: Initializes the internal ADC module.

Arguments: None.

Returns: None.

Definition at line 43 of file analog.c.

int normalize_ADCReading ( unsigned char  inferiorLimit,
unsigned char  superiorLimit 
)

Function: normalize_ADCReading

Preconditions: ADC initialized.

Overview: Normalizes the ADC reading to a specified range.

Arguments: inferiorLimit, superiorLimit.

Returns: Normalized result.

Definition at line 83 of file analog.c.

int readADC ( void  )

Function: readADC

Preconditions: ADC initialized.

Overview: Reads the digital value of the input.

Arguments: None.

Returns: Current ADC value (integer).

Definition at line 64 of file analog.c.