ennng
Junior Member level 2
- Joined
- Nov 1, 2012
- Messages
- 20
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,420
I used sine wave with 3Hz, inserted to ADC and detect the maximum values. According to these max values I generated pulse sequences and I would like to measure the time between two pulses with the same pic not use anther one. I used pic16f877a.
Code:
int maximum=0;
void main()
{trisa=1;trisb=0;portb=0;
while(1)
{
while(adc_read(0)> maximum) maximum = adc_read(0);
portb.f0=1;
delay_ms(1);
portb.f0=0;
while(adc_read(0)< maximum && adc_read(0)>=0){}
maximum=0;
}
}