DEFINE ANALOG WAVEFORM TO GENERATE
This commit is contained in:
parent
598911870c
commit
1d8c5b2a38
15
main.c
15
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)
|
||||
|
|
Loading…
Reference in New Issue