Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Set and Measure Volts.c
- Set D/A0 to 2.5 V and D/A1 to 1 V, and measure with A/D0 and A/D1.
- */
- #include "simpletools.h" // Include simpletools
- #include "adcDCpropab.h" // Include adcDCpropab
- int main()
- { // main function
- while(1)
- {
- adc_init(21, 20, 19, 18); // CS=21, SCL=20, DO=19, DI=18
- dac_ctr(26, 0, 194); // D/A ch 0 -> 2.5 V to D/A 0
- dac_ctr(27, 1, 100); // D/A ch 1 -> 1 V to D/A 1
- printf("A/D0 = %f\n", adc_volts(0)); // Display A/D0 volts
- printf("A/D1 = %f\n", adc_volts(1)); // Display A/D1 volts
- pause(2000);
- dac_ctr(26, 0, 100);
- dac_ctr(27, 0, 194);
- printf("A/D0 = %f\n", adc_volts(0));
- printf("A/D1 = %f\n", adc_volts(1));
- pause(2000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement