I have to program an Eprom to contain 16 different waveforms using C++. Examples of these waveforms are an AC square wave, positive going 10% duty cycle pulse (0 - +V) and symmetrical AC triangular waveform(+V--V)
I have been given an example of a sinewave in C++, but I have no experience with C++, could you please explain simply each line and how to manipulate it to create the different waveforms. Any advice is appreciated.
Sine wave example.
// sine wave
for (n=0 ; n<256 ;n++)
{
angle = (n/256.0)*360;
angle = angle*PI/180.0;
sine = 127*sin(angle) + 128;
fwrite(&sine,sizeof(sine),1,fp);
Thankyou
I have been given an example of a sinewave in C++, but I have no experience with C++, could you please explain simply each line and how to manipulate it to create the different waveforms. Any advice is appreciated.
Sine wave example.
// sine wave
for (n=0 ; n<256 ;n++)
{
angle = (n/256.0)*360;
angle = angle*PI/180.0;
sine = 127*sin(angle) + 128;
fwrite(&sine,sizeof(sine),1,fp);
Thankyou