diff --git a/main.c b/main.c index ec2a112..a291d8c 100644 --- a/main.c +++ b/main.c @@ -69,7 +69,20 @@ void AOUT(uint16_t ANALOG_SAMPLE) I2C0_SEND(MCP4725_ADDRESS, ANALOG_SAMPLE_MSB, ANALOG_SAMPLE_LSB); //SEND 12 BIT DATA } - +void WAVEFORM(void) // DEFINE ANALOG WAVEFORM TO GENERATE +{ int i; // DEFINE VARIABLE i + while (1) + { + for ( i=0; i< 100; i++) // TAKE EACH SAMPLE OUT OF 100 SAMPLES TO SEND TO PERIPHERAL + { + AOUT(samples[i]); // SEND ith SAMPLE TO PERIPHERAL + if (samples[i] > 4095) // RESET IF SAMPLE VALUE ABOVE MAXIMUM LIMIT + { samples[i] = 0; + } + } + delay(1000); // DELAY TO CONTROL WAVEFORM FREQUENCY + } +} int main(void)