GithubHelp home page GithubHelp logo

ad7799-stm32's Introduction

Welcome to AD7799-STM32 ๐Ÿ‘‹

License: MIT License

STM32 library for the 24bits ADC Analog Device AD7799

Default Configuration (on startup or after reset)

  • Conversion mode : Continous
  • PGA Gain : 128
  • Channel : AIN1P-AIN1M
  • Polarity : Bipolar
  • Sample Rate : 16.7 Hz

What is not implemented ?

  • Continous Conversion

SPI Configuration

  • Data Size : 8bits
  • First Bit : MSB First
  • Baud Rate : up to 5 MBits
  • Clock Polarity : High (Mode 3)
  • Clock Phase : 2 Edge (Mode 3)

Usage

#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);
}

Author

๐Ÿ‘ค Axel Chabot

Show your support

Give a โญ๏ธ if this project helped you!

๐Ÿ“ License

Copyright ยฉ 2021 Axel Chabot.
This project is MIT licensed.


This README was generated with โค๏ธ by readme-md-generator

ad7799-stm32's People

Contributors

axoulc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hfauto nmyzer

ad7799-stm32's Issues

Possible bug in AD7799_SingleConversion?

Axel

First I'd like to say it's a great library and has got me up and running quickly with the AD7799.

I was having a few issues with AD7799_SingleConversion timing out. I thing you may have missed out some brackets in the line:

if (HAL_GetTick() - startTime
> (uint32_t) 1.5 * settle_time_ms[(uint8_t) ad7799->rate]) {

I think basically you are casting 1.5 to a uint32_t and so multiplying the settle time by 1 instead of 1.5. Looks like you need this instead:

(uint32_t) (1.5 * settle_time_ms[(uint8_t) ad7799->rate]))

This gave me the expected 180ms timeout for the value 120ms in the array.

Regards
Alan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.