I am stuck on a topic for TAFE and cannot get my head around it.
I need to Write a program to use a D to A converter board to output various signals which can be viewed on an oscilloscope.
I have made the Triangle wave, which works, but am stuck on the sine wave.
Code for sine wave thus far is:
int val;It will not compile and I keep getting errors. I think the problem lies within the last line of while the keyboard is hit, perform a break.
int DCBias = 128;
int steps = 128;
int lp;
double dg = 3.141592654 / (steps/2);
val = sin(lp * dg) * 127 + DCBias;
for (lp = 0; lp <= 128; lp ++)
{ outp (DataPort,val);
delay (20);
}
printf("Press any key to exit Sine Wave output\n");
while (!kbhit()) break();
Thanks in advance for any help.