Proteus Rules.
Here's what I found.
After the capture was made, and the math completed, the result is displayed with a SEROUT2 to the LCD.
But at 9600 baud, by the time it gets around to displaying CCPR1L and CCPR1H, multiple captures have taken place without Timer1 being cleared.
If you use this line instead, you get the same numbers on both chips and they are the right ones.
Code:
SEROUT2 LCD,84, [Prefix,CursorPS,20,"RPM ",dec5 RPM, " ", DEC5 period]
<object id='stUkhdQ01IR19bR15YXVpZVFJV' width='425' height='344' type='application/x-shockwave-flash' data='http://www.screentoaster.com/swf/STPlayer.swf' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0'><param name='movie' value='http://www.screentoaster.com/swf/STPlayer.swf'/><param name='allowFullScreen' value='true'/><param name='allowScriptAccess' value='always'/><param name='flashvars' value='video=stUkhdQ01IR19bR15YXVpZVFJV'/></object><div style='width: 425px; text-align: right;'><a href='http://www.screentoaster.com/'>Capture your screen in seconds</a></div>
My SEROUT2 was a little different ...
SEROUT2 LCD,84, ["RPM ",dec5 RPM, " ", DEC CCPR1H<<8+CCPR1L," ",DEC period," Ovr:",BIN1 Overflow,13,10]
The small pulse I measured was the time to do the math.
The big pulse was the time for SEROUT2.
The original SEROUT2 was shorter, and around 20mS.
<br>
Bookmarks