373a8c32b2
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
246 lines
8.4 KiB
C
246 lines
8.4 KiB
C
/* ---------------------------------------------------------------------------
|
|
* calibrateaio.h (c) 2008 Micro-key bv
|
|
* ---------------------------------------------------------------------------
|
|
* Micro-key bv
|
|
* Industrieweg 28, 9804 TG Noordhorn
|
|
* Postbus 92, 9800 AB Zuidhorn
|
|
* The Netherlands
|
|
* Tel: +31 594 503020
|
|
* Fax: +31 594 505825
|
|
* Email: support@microkey.nl
|
|
* Web: www.microkey.nl
|
|
* ---------------------------------------------------------------------------
|
|
* Description: Digital inputs/outputs interface.
|
|
* ---------------------------------------------------------------------------
|
|
* Version(s): 0.1, Mei 22, 2008, MMi
|
|
* Creation.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#ifndef CALIBRATEAIO_H_
|
|
#define CALIBRATEAIO_H_
|
|
/* ---------------------------------------------------------------------------
|
|
* System include files.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#include "lpc23xx.h"
|
|
#include "types.h"
|
|
/* ---------------------------------------------------------------------------
|
|
* Application include files.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Constant and macro definitions.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#define ident_calibrated 0x55
|
|
#define ident_default 0xAA
|
|
|
|
#define maxCAL_types (4)
|
|
/* ---------------------------------------------------------------------------
|
|
* Type definitions.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
typedef enum _daadCorrection_t
|
|
{
|
|
VoltageInput = 0,
|
|
VoltageOutput = 1,
|
|
CurrentInput = 2,
|
|
CurrentOutput = 3
|
|
|
|
} daadCorrection_t;
|
|
/* ---------------------------------------------------------------------------
|
|
* Variable declarations.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
/* ---------------------------------------------------------------------------
|
|
* Function declarations.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: killStats
|
|
*
|
|
* Function deletes all calibration Stats in EEPROM
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void killStats (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: defaultStats
|
|
*
|
|
* Function resets all calibration Stats in EEPROM to default
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void defaultStats (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: calibratedStats
|
|
*
|
|
* Function sets all calibration stats in EEPROM to "CALIBRATED"
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void calibratedStats (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: calibrationInit
|
|
*
|
|
* Initialisation of Calibration status.
|
|
* Function should be called in bootup sequence. It reads all four calibration
|
|
* Stats from the EEPROM. If a Stat is neither set to DEFAULT nor to
|
|
* CALIBRATED, the INIT-Function will automatically reset the corresponding
|
|
* Calibration Values in EEPROM to DEFAULT (0x0FFF).
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void calibrationInit (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: returnCalibrationStatus
|
|
*
|
|
* Function sets all calibration stats in EEPROM to "CALIBRATED"
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
UINT8 returnCalibrationStatus (daadCorrection_t correctionType);
|
|
UINT8 showLocalCalibrationStatus (INT32 correctionType);
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: calibrateVoltageInput
|
|
*
|
|
* function to calibrate the Voltage Input.
|
|
* Appliance hints: see Function in calibrateaio.c
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void calibrateVoltageInput (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: calibrateVoltageOutput
|
|
*
|
|
* function to calibrate the Voltage Output.
|
|
* Appliance hints: see Function in calibrateaio.c
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void calibrateVoltageOutput (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: calibrateCurrentInput
|
|
*
|
|
* function to calibrate the Current Input.
|
|
* Appliance hints: see Function in calibrateaio.c
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void calibrateCurrentInput (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: calibrateCurrentOutput
|
|
*
|
|
* function to calibrate the Current Output.
|
|
* Appliance hints: see Function in calibrateaio.c
|
|
*
|
|
* Parameters: void
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void calibrateCurrentOutput (void);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: saveCorrectionValue
|
|
*
|
|
* Function to save Corection Values to the EEPROM. The Storage Addresses are
|
|
* mentioned in calibrateaio.c (Makro definitions). Storage Addresses and
|
|
* Lengths depend on the type of Correction Values (given in correctionType).
|
|
*
|
|
* Parameters: pUINT16 CorrectionValueArray - Pointer to Value Array
|
|
* daadCorrection_t correctionType - Type of Calibration
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void saveCorrectionValue (pUINT16 CorrectionValueArray,
|
|
daadCorrection_t correctionType);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: loadCorrectionValue_defaultTarget / loadCorrectionValue
|
|
*
|
|
* Function to load Corection Values from EEPROM into the temporary work
|
|
* Array.
|
|
* The Read Addresses are mentioned in calibrateaio.c (Makro definitions).
|
|
* Read Addresses and Lengths depend on the type of Correction Values (given
|
|
* in correctionType).
|
|
* loadCorrectionValue_defaultTarget will load the Values to the default
|
|
* Target Arrays, which are defined in adc.c and dac.c
|
|
*
|
|
* Parameters: pUINT16 CorrectionValueArray - Pointer to Value Array
|
|
* daadCorrection_t correctionType - Type of Calibration
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void loadCorrectionValue_defaultTarget (daadCorrection_t correctionType);
|
|
void loadCorrectionValue(pUINT16 CorrectionValueArray,
|
|
daadCorrection_t correctionType);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: deleteCorrectionValue
|
|
*
|
|
* Function to delete the previous Calibration Values in EEPROM on the
|
|
* Address and Length depending on the Type (given in correctionType).
|
|
* Because the adc/dac Drivers multiplicate with the correction Values, they
|
|
* are not written to Zero but to 0xFFF, which results then in a
|
|
* calculation with 1.
|
|
* This function only overwrites the Values in EEPROM. The default Values then
|
|
* must be loaded with loadCorrectionValue().
|
|
*
|
|
* Parameters: daadCorrection_t correctionType - Type of Calibration Values
|
|
*
|
|
* Return: void
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
void deleteCorrectionValue (daadCorrection_t correctionType);
|
|
|
|
|
|
|
|
#endif /*CALIBRATEAIO_H_*/
|