32 lines
518 B
C
32 lines
518 B
C
#include "BA45F5250.h"
|
|
#include "stdint.h"
|
|
#include "build-in.h"
|
|
#include "ad_converter.h"
|
|
#include "eeprom_rw.h"
|
|
#include "uart_configuration.h"
|
|
|
|
void adc_config()
|
|
{
|
|
_sadc0 = 0b00000000;
|
|
_sadc1 = 0b01101011;
|
|
_ade = 0;
|
|
}
|
|
|
|
uint8_t read_adc()
|
|
{
|
|
uint8_t temp;
|
|
_adcen = 1;
|
|
GCC_DELAY(12);
|
|
_start = 0;
|
|
_start = 1;
|
|
_start = 0;
|
|
while(_adbz);
|
|
_adcen = 0;
|
|
temp = _sadoh;
|
|
if(_adrfs != 0)
|
|
{
|
|
temp = (temp << 8) | _sadol;
|
|
}
|
|
uart_transmit(temp);
|
|
return temp;
|
|
} |