bananasiong
New Member
Hi,
It should be 10 us per count, but not degree. It's different for different input signal frequency.
It should be 10 us per count, but not degree. It's different for different input signal frequency.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
vili.chaudhary said:So am I right in assuming that we have a resolution of 3.6 deg per count?
Hence for every 1 count the error will be 3.6 deg??
Main
[COLOR="Blue"] clrf CountLo
clrf CountHi[/COLOR]
WaitSignal0
btfsc PORTA,0 ;wait for signal 1 to be low
goto WaitSignal0
WaitSignal1
btfss PORTA,0 ;wait for signal 1 to go high
goto WaitSignal1
TimeSignal0
btfss PORTA,1 ;is signal 2 low
goto WaitEdge ;yes, go wait for rising edge
incf Count[COLOR="blue"]Lo[/COLOR],f ;no so count
btfsc STATUS,Z ;is there a carry
incf Count[COLOR="blue"]Hi[/COLOR],f ;yes, inc high byte
nop ;waste 1 cycle
goto $+1 ;waste 2 cycles
goto TimeSignal0 ;loop arnd - total time = 10 cycles
WaitEdge
btfsc PORTA,1 ;is signal 2 high
goto GotTime ;yes, so were done
incf Count[COLOR="blue"]Lo[/COLOR],f ;as above
btfsc STATUS,Z
incf Count[COLOR="blue"]Hi[/COLOR],f
nop
goto $+1
goto WaitEdge
GotTime
movf CountHi,W
movwf PORTC
movf CountLo,W
movwf PORTD
goto Main
bananasiong said:Hi Pommie,
He has the registers cleared in his code