beautypg.com

Adc function, 8 adc function – Solvline Eddy DK User Manual

Page 120

background image

Eddy DK Programmer Guide

120

6.8 ADC Function

Eddy CPU provides 4 channels of ADC(Analog Digital Converter).
Eddy DK board has temperature and illumination sensor for testing and the status of the sensors can be checked in
real time with ADC.
Sample program ‚

Eddy_Apps/test_adc.c

‛ uses ADC interface so users can refer to this source for developing

programs.

ADCSETCHANNEL

Function

Configures whether to use 4 channels of ADC device or not.

Format

void ioctl(int fd, ADCSETCHANNEL, int *channel);

Parameter

fd

Handle to ADC device(‚/dev/adc‛)

mode

Pointer to the buffer that stores channel configuration

Returns

None

Notice

X X X X X X X X (bits)
| | | |----- channel 1 (temperature sensor)
| | |--------- channel 2 (illumination sensor)
| |------------- channel 3 (future use)
|----------------- channel 4 (future use)

ADCGETVALUE

Function

Reads operation status of 4channels of ADC device

Format

void ioctl(int fd, ADCGETVALUE, struct adc_struct *channels);

Parameter

fd

Handle to ADC device(‚/dev/adc‛)

mode

Pointer to the buffer that will store channel operation
status

Returns

None

Notice

Struct adc_value {
int ch1_value;
int ch2_value;
int ch3_value;
int ch4_value;
};