18 #include <avr/pgmspace.h> 23 uint16_t V_CHG_1_mess = 0, I_CHG_1_mess = 0, V_CHG_2_mess = 0, I_CHG_2_mess = 0, V_BAT_mess = 0, I_BAT_mess = 0;
24 int16_t I_CHG_1 = 0, I_CHG_2 = 0, I_BAT = 0;
25 float V_CHG_1 = 0, V_CHG_2 = 0, V_BAT = 0, CHARGE_1 = 0, CHARGE_2 = 0, CHARGE_BAT = 0;
38 ADCA.CTRLB = ADC_RESOLUTION_12BIT_gc;
40 ADCA.REFCTRL = ADC_REFSEL_INTVCC_gc | ADC_BANDGAP_bm;
41 ADCA.PRESCALER = ADC_PRESCALER_DIV256_gc;
42 ADCA.CTRLA = ADC_ENABLE_bm;
57 PORTB.DIRCLR = PIN0_bm | PIN1_bm | PIN2_bm;
68 Channel->CTRL = ADC_CH_INPUTMODE_SINGLEENDED_gc;
69 Channel->MUXCTRL = (Pin << 3);
70 Channel->CTRL |= ADC_CH_START_bm;
72 while ( !Channel->INTFLAGS )
74 Channel->INTFLAGS = ADC_CH_CHIF_bm;
97 NVM_CMD = NVM_CMD_READ_CALIB_ROW_gc;
98 result = pgm_read_byte ( Index );
99 NVM_CMD = NVM_CMD_NO_OPERATION_gc;
uint16_t ADCA_Conversion(ADC_CH_t *Channel, char Pin)
Konvertiert die Spannung über Channel, die an Pin anliegt.
void ADCA_init(void)
ADC A wird eingestellt.
int LeseKalibrationsbyte(int Index)
Liest Kalibrierungsinformationen aus dem EEPROM des XMEGA.
void ADCA_Cal(void)
Kalibrierung des ADCA mit den Kalibrierungsinformationen aus dem EEPROM des XMEGA.
void I_sgn_init(void)
Stromrichtung aus den Strommesssensoren TS1101.