MARWEN007
Junior Member level 2
I am willing calculated the time of a width of a square wave of frequency 50Hz and amplitude 5V basis of a 16F877, my algorithm
capture rising edge
falling edge capture
/ / for the 1st time catching front just to take them as reference / /
loading timer
capture rising edge
countdown timer
until the falling edge
read timer (if I work with 16-bit timer1 model and I read it to say 0AFF Xtemps = FFFF-0AFF
This gives time = (180 * Xtemps) / 4096
{FOR 4096 that correspond to 180 °
I just work with the timer 1 MODE not pre-divided internal clock with the CCP1 module in Capture Mode and authorize those corresponding interrupt
I want to translate it in C language or if there are examples of code?or if there is another idea
I need your help because it was about my pfe is urgent
capture rising edge
falling edge capture
/ / for the 1st time catching front just to take them as reference / /
loading timer
capture rising edge
countdown timer
until the falling edge
read timer (if I work with 16-bit timer1 model and I read it to say 0AFF Xtemps = FFFF-0AFF
This gives time = (180 * Xtemps) / 4096
{FOR 4096 that correspond to 180 °
I just work with the timer 1 MODE not pre-divided internal clock with the CCP1 module in Capture Mode and authorize those corresponding interrupt
I want to translate it in C language or if there are examples of code?or if there is another idea
I need your help because it was about my pfe is urgent
Last edited: