The AD8556 is a zero-drift, sensor signal amplifier with digitally programmable gain and output offset.
AD8556.h@0:05eaa16f3327, 2013-09-11 (annotated)
- Committer:
- fblanc
- Date:
- Wed Sep 11 13:30:19 2013 +0000
- Revision:
- 0:05eaa16f3327
OK
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fblanc | 0:05eaa16f3327 | 1 | /** |
fblanc | 0:05eaa16f3327 | 2 | * @brief AD8556: Digitally Programmable Sensor Signal Amplifier with EMI Filters |
fblanc | 0:05eaa16f3327 | 3 | * http://www.analog.com/en/specialty-amplifiers/instrumentation-amplifiers/ad8556/products/product.html |
fblanc | 0:05eaa16f3327 | 4 | * @date 05/09/2013 |
fblanc | 0:05eaa16f3327 | 5 | * @author F.BLANC LAAS-CNRS |
fblanc | 0:05eaa16f3327 | 6 | * http://homepages.laas.fr/fblanc/ |
fblanc | 0:05eaa16f3327 | 7 | */ |
fblanc | 0:05eaa16f3327 | 8 | #ifndef AD8556_H |
fblanc | 0:05eaa16f3327 | 9 | |
fblanc | 0:05eaa16f3327 | 10 | #define AD8556_H |
fblanc | 0:05eaa16f3327 | 11 | |
fblanc | 0:05eaa16f3327 | 12 | #include "mbed.h" |
fblanc | 0:05eaa16f3327 | 13 | enum ADC_MODE { |
fblanc | 0:05eaa16f3327 | 14 | ADC_MODE_SENSE_CURENT = 0x00, |
fblanc | 0:05eaa16f3327 | 15 | ADC_MODE_SIMULATION = 0x01, |
fblanc | 0:05eaa16f3327 | 16 | ADC_MODE_FUSE = 0x02, |
fblanc | 0:05eaa16f3327 | 17 | ADC_MODE_READ = 0x03 |
fblanc | 0:05eaa16f3327 | 18 | }; |
fblanc | 0:05eaa16f3327 | 19 | enum ADC_FUNCTION { |
fblanc | 0:05eaa16f3327 | 20 | ADC_Change_Sense_Current = 0x00, |
fblanc | 0:05eaa16f3327 | 21 | ADC_Simulate_Parameter_Value = 0x01, |
fblanc | 0:05eaa16f3327 | 22 | ADC_Program_Parameter_Value = 0x02, |
fblanc | 0:05eaa16f3327 | 23 | ADC_Read_Parameter_Value = 0x03 |
fblanc | 0:05eaa16f3327 | 24 | }; |
fblanc | 0:05eaa16f3327 | 25 | enum ADC_PARAMETER { |
fblanc | 0:05eaa16f3327 | 26 | ADC_Second_Stage_Gain_Code = 0x00, |
fblanc | 0:05eaa16f3327 | 27 | ADC_First_Stage_Gain_Code = 0x01, |
fblanc | 0:05eaa16f3327 | 28 | ADC_Output_Offset_Code = 0x02, |
fblanc | 0:05eaa16f3327 | 29 | ADC_Other_Functions = 0x03 |
fblanc | 0:05eaa16f3327 | 30 | }; |
fblanc | 0:05eaa16f3327 | 31 | /** AD8556 class. |
fblanc | 0:05eaa16f3327 | 32 | * Used for controlling a AD8556 Instrumentation Amplifiers connected via Single-wire serial interface. |
fblanc | 0:05eaa16f3327 | 33 | * |
fblanc | 0:05eaa16f3327 | 34 | */ |
fblanc | 0:05eaa16f3327 | 35 | class AD8556 |
fblanc | 0:05eaa16f3327 | 36 | { |
fblanc | 0:05eaa16f3327 | 37 | protected: |
fblanc | 0:05eaa16f3327 | 38 | private: |
fblanc | 0:05eaa16f3327 | 39 | /** |
fblanc | 0:05eaa16f3327 | 40 | * @brief write_bit |
fblanc | 0:05eaa16f3327 | 41 | * |
fblanc | 0:05eaa16f3327 | 42 | * @param bit 1 or 0 |
fblanc | 0:05eaa16f3327 | 43 | */ |
fblanc | 0:05eaa16f3327 | 44 | void write_bit(unsigned char bit); |
fblanc | 0:05eaa16f3327 | 45 | /** |
fblanc | 0:05eaa16f3327 | 46 | * @brief read_bit |
fblanc | 0:05eaa16f3327 | 47 | * |
fblanc | 0:05eaa16f3327 | 48 | * @return bit 1 or 0 |
fblanc | 0:05eaa16f3327 | 49 | */ |
fblanc | 0:05eaa16f3327 | 50 | unsigned char read_bit(); |
fblanc | 0:05eaa16f3327 | 51 | /** |
fblanc | 0:05eaa16f3327 | 52 | * @brief trame |
fblanc | 0:05eaa16f3327 | 53 | * @param parameter |
fblanc | 0:05eaa16f3327 | 54 | * @param mode |
fblanc | 0:05eaa16f3327 | 55 | * @param data |
fblanc | 0:05eaa16f3327 | 56 | */ |
fblanc | 0:05eaa16f3327 | 57 | void trame(unsigned char parameter,unsigned char mode,unsigned char data); |
fblanc | 0:05eaa16f3327 | 58 | public: |
fblanc | 0:05eaa16f3327 | 59 | /** |
fblanc | 0:05eaa16f3327 | 60 | * @brief Constructor. |
fblanc | 0:05eaa16f3327 | 61 | * @param dig |
fblanc | 0:05eaa16f3327 | 62 | */ |
fblanc | 0:05eaa16f3327 | 63 | AD8556(PinName dig); |
fblanc | 0:05eaa16f3327 | 64 | DigitalInOut _dig; |
fblanc | 0:05eaa16f3327 | 65 | |
fblanc | 0:05eaa16f3327 | 66 | /** |
fblanc | 0:05eaa16f3327 | 67 | * @brief Destructor. |
fblanc | 0:05eaa16f3327 | 68 | */ |
fblanc | 0:05eaa16f3327 | 69 | ~AD8556(); |
fblanc | 0:05eaa16f3327 | 70 | /** |
fblanc | 0:05eaa16f3327 | 71 | * @brief init |
fblanc | 0:05eaa16f3327 | 72 | * @param First_Stage_Gain_Code |
fblanc | 0:05eaa16f3327 | 73 | * @param Second_Stage_Gain_Code |
fblanc | 0:05eaa16f3327 | 74 | * @param Vdac_Code |
fblanc | 0:05eaa16f3327 | 75 | */ |
fblanc | 0:05eaa16f3327 | 76 | int init(unsigned char mode=ADC_MODE_SIMULATION, unsigned char First_Stage_Gain_Code=0, unsigned char Second_Stage_Gain_Code=0,unsigned char Vdac_Code=0x7F); |
fblanc | 0:05eaa16f3327 | 77 | /** |
fblanc | 0:05eaa16f3327 | 78 | * @brief prog_vdac |
fblanc | 0:05eaa16f3327 | 79 | * @param vdac consigne (volt) |
fblanc | 0:05eaa16f3327 | 80 | * @param vdd positive voltage supply (volt) |
fblanc | 0:05eaa16f3327 | 81 | * @param vss nagative voltage supply (volt) |
fblanc | 0:05eaa16f3327 | 82 | * @param mode |
fblanc | 0:05eaa16f3327 | 83 | */ |
fblanc | 0:05eaa16f3327 | 84 | void prog_vdac(float vdac, float vdd=5.0 ,float vss=0.0, unsigned char mode=ADC_MODE_SIMULATION); |
fblanc | 0:05eaa16f3327 | 85 | /** |
fblanc | 0:05eaa16f3327 | 86 | * @brief prog_gain |
fblanc | 0:05eaa16f3327 | 87 | * @param gain 70 to 1280 |
fblanc | 0:05eaa16f3327 | 88 | |
fblanc | 0:05eaa16f3327 | 89 | * @param mode |
fblanc | 0:05eaa16f3327 | 90 | */ |
fblanc | 0:05eaa16f3327 | 91 | void prog_gain(float gain=70.0, unsigned char mode=ADC_MODE_SIMULATION); |
fblanc | 0:05eaa16f3327 | 92 | |
fblanc | 0:05eaa16f3327 | 93 | }; |
fblanc | 0:05eaa16f3327 | 94 | #endif |