SPC  Version 0.9.5
 All Files Functions Groups Pages
ex_DAC0ToA3.spc

This is an example of how to use the DAC0Mode, DAC0Frequency, DAC0Voltage, and ADChannel3 system constants as well as the Wait and printf functions.

task main()
{
int A3;
int i, c;
// Set up Analog 0 output to output a sine wave at 1 Hz
DAC0Voltage = 1023;
// Sample Analog input A3 every 1/10 second
// and output value
while(true)
{
A3 = ADChannel3;
printf("Time: %d ", SystemClock);
printf("A3: %d ", A3);
// Display an '*' sine wave on terminal
c = A3 / 20;
for (i=0;i<c;i++) {
printf(" ");
}
printf("*\n");
}
}