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