1. Generating a tone of certain frequency (using C program statements)
2. Generating a tone of certain frequency continuously for a certain duration (using C program statements)
3.Generating different frequency tones(using C program statements)
#include <p18f4520.h>
#include <delays.h>
void main ()
{
char i = 0; //declarations
ADCON1 = 0x0f;
TRISE = 11100000;
PORTE = 0;
for (i=0;i<500;i++)
{
PORTEbits.RE2 =~ PORTEbits.RE2 // toggled wave
Delay10TCYx(10); //?????
PORTEbits.RE2 = 0;
Delay10TCYx(1);
}
for (i=0;i<250;i++)
{
PORTEbits.RE2 = 1;
Delay10TCYx(1);
PORTEbits.RE2 = 0;
Delay10TCYx(4);
}
}
this is a program made and i am suppose to explain number 1,2,3 . how do we generate a tone of certain frequency and with duration ? i have no idea how to explain my program and every step written. can someone please enlighten me ? your help is greatly appreciated . it would help me understand and score in my schoolwork