Skip to content

Instantly share code, notes, and snippets.

@snegovick
Created June 25, 2014 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snegovick/94f2078f26ce1c8987e8 to your computer and use it in GitHub Desktop.
Save snegovick/94f2078f26ce1c8987e8 to your computer and use it in GitHub Desktop.
AD8495 ADC values to degrees celsium macros
#ifndef __AD8495_H__
#define __AD8495_H__
/* Adjust these values*/
#define VREF 3300 /* Vref input 3.3V */
#define RES_ADC (1<<12) /* ADC resolution 1<<12 stands for 12bit */
/* These values should be ok without tuning */
#define RES_MV 5 /* 5mv / Deg. Celsium */
#define SCALE 100 /* dont use floats, just scale */
#define RES_MEASUREMENT ((VREF*SCALE)/RES_ADC)
#define ADC_TO_DEG(adc_value) (((adc_value*RES_MEASUREMENT)/RES_MV)/SCALE)
#endif/*__AD8495_H__*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment