Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
726 B

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __A2D__INCLUDED__
  2. #define __A2D__INCLUDED__
  3. #include "StdAfx.h"
  4. void ADC0_Init();
  5. void ADC0_Start( BYTE bChannel );
  6. BOOL ADC0_GetValue( PWORD pValue );
  7. WORD ADC0_Convert( BYTE bChannel );
  8. //LONG ADC0_Adc2Temperature( WORD wValue );
  9. //WORD ADC0_Temperature2Adc( LONG lTemperature );
  10. #define V_REF 30L // 3.0V * 10
  11. #define PGAIN 1L // ACC amplifier gain
  12. #define MAX_ADC 4096L
  13. #define ADC0_Adc2Temperature( wValue ) \
  14. ( ( ((LONG)(INT)wValue) * V_REF * 1000L - 7760L * MAX_ADC * PGAIN ) / ( 286L * MAX_ADC * PGAIN / 10L ) )
  15. #define ADC0_Temperature2Adc( lTemperature ) \
  16. ( (lTemperature * ( 286L * MAX_ADC * PGAIN / 10L ) + 7760L * MAX_ADC * PGAIN) / (V_REF * 1000L) )
  17. #endif