PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
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
}
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
main
int main(void)
Definition:
GraphicsTest.c:20
dac_ctr_stop
void dac_ctr_stop(void)
Stop the cog that's transmitting the DAC signal(s).
Definition:
dac.c:96
dac_ctr
void dac_ctr(int pin, int channel, int dacVal)
Set D/A voltage.
Definition:
dac.c:36
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17