PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Examples
Circuits
Set Volts.c
1
/*
2
Set Volts.c
3
4
Set voltages at D/A 0 with P26 and at D/A 1 with P27.
5
V(D/A) = daVal * 3.3 V / 256.
6
7
Examples:
8
78 * 3.3 V / 256 -> 1 V
9
233 * 3.3 V / 256 -> 3 V.
10
11
For more options and channels, use:
12
Learn\Simple Libraries\Convert\libdacctr
13
14
Additional info:
15
http://learn.parallax.com/propeller-c-simple-circuits/set-volts
16
*/
17
18
#include "simpletools.h"
// Include simpletools
19
20
int
main
()
// main function
21
{
22
dac_ctr(26, 0, 194);
// 2.5 V to D/A0
23
dac_ctr(27, 1, 78);
// 1 V to D/A1
24
pause(2000);
// Pause 2 seconds
25
dac_ctr(26, 0, 78);
// 1 V to D/A0
26
dac_ctr(27, 1, 194);
// 1.5 V to D/A1
27
pause(2000);
// Pause 2 seconds
28
dac_ctr_stop();
// Stop D/A cog
29
}
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12