DEFINE ANALOG WAVEFORM TO GENERATE

This commit is contained in:
Sanyog Nevase Nevase 2024-10-29 20:34:37 +05:30
parent 598911870c
commit 1d8c5b2a38
1 changed files with 14 additions and 1 deletions

15
main.c
View File

@ -69,7 +69,20 @@ void AOUT(uint16_t ANALOG_SAMPLE)
I2C0_SEND(MCP4725_ADDRESS, ANALOG_SAMPLE_MSB, ANALOG_SAMPLE_LSB); //SEND 12 BIT DATA 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) int main(void)