chansiuming
New Member
I am using 18F4550 series with C18 to find out the pulse. I got a sensor SRF04 which connected the Trigger to RD6 and Echo to RD7. The RD6 will send 10us pulse to Trigger and Echo will send back the pulse(distance) to RD7. Now my question is how can i count the Echo pulse? i found a post which is similar to my question but i dun understand at allhttps://www.electro-tech-online.com/threads/period-calculation-with-pic18-using-c18.107671/
I have to use Write timer and read timer? i have done the first part for opentimer:
OpenTimer0(Timer_INT_OFF &
T0_8BIT &
T0_source_INT &
T0_PS_1_1);
The Echo pulse will be between 100us to 25ms. And i am using 1MHz internal osc. I am confusing on write timer, read timer after i look through the data sheet and c compiler library... how can it function and how can i get it work to count the pulse?
I have to use Write timer and read timer? i have done the first part for opentimer:
OpenTimer0(Timer_INT_OFF &
T0_8BIT &
T0_source_INT &
T0_PS_1_1);
The Echo pulse will be between 100us to 25ms. And i am using 1MHz internal osc. I am confusing on write timer, read timer after i look through the data sheet and c compiler library... how can it function and how can i get it work to count the pulse?