STM32 library for the 24bits ADC Analog Device AD7799
- Conversion mode : Continous
- PGA Gain : 128
- Channel : AIN1P-AIN1M
- Polarity : Bipolar
- Sample Rate : 16.7 Hz
- Continous Conversion
- Data Size : 8bits
- First Bit : MSB First
- Baud Rate : up to 5 MBits
- Clock Polarity : High (Mode 3)
- Clock Phase : 2 Edge (Mode 3)
#include "AD7799.h"
AD7799 adc;
int main(void) {
adc.adcspi = &hspi3; //Your SPI Handler
adc.CSPort = ADC_CS_GPIO_Port; // Your CS Port
adc.CSPin = ADC_CS_Pin; // Your CS Pin
adc.vref = 3.0; // Your Voltage reference
AD7799_Reset(&adc);
if (AD7799_Init(&adc) != HAL_OK) {
Error_Handler();
}
AD7799_SetGain(&adc, AD7799_GAIN_64);
AD7799_SetPolarity(&adc, AD7799_UNIPOLAR);
if (AD7799_SingleConversion(&adc) != HAL_OK) {
Error_Handler();
}
printf("Raw value : %ld - Voltage Value : %f\r\n", adc.rawConversion, adc.voltConversion);
}
👤 Axel Chabot
- Github: @axoulc
Give a ⭐️ if this project helped you!
Copyright © 2021 Axel Chabot.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator