From 1d8c5b2a388eab0a04415056166dc1d3a8915152 Mon Sep 17 00:00:00 2001 From: Sanyog Date: Tue, 29 Oct 2024 20:34:37 +0530 Subject: [PATCH] DEFINE ANALOG WAVEFORM TO GENERATE --- main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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)