![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dac subsystem
DAC/DAC.h@1:8056d0c97ee2, 2014-04-01 (annotated)
- Committer:
- dzl5187
- Date:
- Tue Apr 01 04:47:27 2014 +0000
- Revision:
- 1:8056d0c97ee2
- Parent:
- 0:c7adfe979a5b
first commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dzl5187 | 0:c7adfe979a5b | 1 | |
dzl5187 | 0:c7adfe979a5b | 2 | #ifndef DAC_H |
dzl5187 | 0:c7adfe979a5b | 3 | #define DAC_H |
dzl5187 | 0:c7adfe979a5b | 4 | |
dzl5187 | 0:c7adfe979a5b | 5 | #include "mbed.h" |
dzl5187 | 0:c7adfe979a5b | 6 | #include "mcp4725.h" |
dzl5187 | 0:c7adfe979a5b | 7 | |
dzl5187 | 0:c7adfe979a5b | 8 | //pins for connection |
dzl5187 | 0:c7adfe979a5b | 9 | #define PIN_SDA p9 |
dzl5187 | 0:c7adfe979a5b | 10 | #define PIN_SCL p10 |
dzl5187 | 0:c7adfe979a5b | 11 | #define DEVICE_ADDR_BIT 0 |
dzl5187 | 0:c7adfe979a5b | 12 | //ref voltage |
dzl5187 | 0:c7adfe979a5b | 13 | #define VDD_VOLTAGE 5.04 |
dzl5187 | 0:c7adfe979a5b | 14 | |
dzl5187 | 0:c7adfe979a5b | 15 | enum FREQ { FREQ_10HZ, FREQ_1HZ}; |
dzl5187 | 0:c7adfe979a5b | 16 | enum FORM { FORM_SQUARE, FORM_SIN}; |
dzl5187 | 0:c7adfe979a5b | 17 | |
dzl5187 | 0:c7adfe979a5b | 18 | /** |
dzl5187 | 0:c7adfe979a5b | 19 | Funciton: DAC_start |
dzl5187 | 0:c7adfe979a5b | 20 | Description: start generating the analog signal |
dzl5187 | 0:c7adfe979a5b | 21 | */ |
dzl5187 | 0:c7adfe979a5b | 22 | void DAC_start(); |
dzl5187 | 0:c7adfe979a5b | 23 | /** |
dzl5187 | 0:c7adfe979a5b | 24 | Funciton: DAC_stop |
dzl5187 | 0:c7adfe979a5b | 25 | Description: stop generating the analog signal |
dzl5187 | 0:c7adfe979a5b | 26 | */ |
dzl5187 | 0:c7adfe979a5b | 27 | void DAC_stop(); |
dzl5187 | 0:c7adfe979a5b | 28 | /** |
dzl5187 | 0:c7adfe979a5b | 29 | Funciton: DAC_generate |
dzl5187 | 0:c7adfe979a5b | 30 | Description: calculate the Vout accoding to the configuration and send command to DAC chip |
dzl5187 | 0:c7adfe979a5b | 31 | */ |
dzl5187 | 0:c7adfe979a5b | 32 | void DAC_generate(); |
dzl5187 | 0:c7adfe979a5b | 33 | /** |
dzl5187 | 0:c7adfe979a5b | 34 | Funciton: DAC_set |
dzl5187 | 0:c7adfe979a5b | 35 | Description: set the configuration( amplitude, frequency and form of the signal) |
dzl5187 | 0:c7adfe979a5b | 36 | */ |
dzl5187 | 0:c7adfe979a5b | 37 | void DAC_set(float range, enum FREQ freq, enum FORM form); |
dzl5187 | 0:c7adfe979a5b | 38 | |
dzl5187 | 0:c7adfe979a5b | 39 | #endif |