View Full Version : Hardware capture on 16F876
MaxiBoost
- 4th April 2007, 09:22
hi people ,
if I use
count PORTB.0,100,rpm
the result is poor quality ,
if I use
count PORTB.0,1000,rpm
the result is very slowly ,
if I use hardware capture resolve all that problems ?
how can I use this ?
any body trying ?
regards
skimask
- 4th April 2007, 14:06
COUNT is dependant on the oscillator speed. I don't know what speed you're running, but might help one of those cases if you bumped up the clock speed until you get what you want (maybe)...
Acetronics2
- 4th April 2007, 14:28
Hi, Miniboost
Real world rpm happen in a ... minute !!! ( Mr de la Pallice )
if you want to count in a 1/10 of a second you count ... 15 counts for 9000 rpm ( let's be VERY optimistic !!! ) as tey are INTEGER counts ... you do with 14,15 or 16 .... never 15.238656
Ok ... let's try other methods ...
measure the period ... ahhh, better !!!
with a 4 Mhz clock, using the CAPTURE module of a pic ( 16F628 or 876 i.e ) ... you can have a 1µS resolution ... say 65535 µS period to the max.
Boooo ... can't measure less than 915 rpm !!!
sooo ... let's look at TMR1 prescaler values ... 2 will fit ( 457 rpm ... ok ) also have 4 ...
max rpm resolution ???
9000 rpm is 6.7 ms period ... 3350 TMR1 counts ( W/ prescaler of 2 ) ... say better accuracy than 0.1 %
Now, let's read something clear !!! ... you'll have to use a mean value over a reading period of .5 to 1 sec ... if you do not want the display to flicker too much !!!
but you can also add a fast + mean bargraph ....
Will be another story !!!
Alain
PS: no hardware capture function in PbP ... have to write it yourself ...
MaxiBoost
- 4th April 2007, 16:16
hello again friends ,
I want make a fast rpm meter ,you understand me ofcourse ,
now I just trying on my car ,its my first dynamic test for this.
Im connect pic`s (portc.2) to car ecu rpm out .
(its same to dash board tacho in )
pic is 16F876-20
osc is 4 mhz ,I can easly rise up but I thing its not enough ..
when I use count 1000 command ,I can read on the lcd "35" every second .
then I change setting ..
35*60/2=1050 rpm ..
its near real rpm ..
I read on the tacho 1000 rpm ..
1000/60 =16.6
16.6*2 =~33.2 I think
So ,count command is very slow .
@skimask ,
Its very easy for me ,
I can try with 20 mhz osc .
Can I try ?
@Acetronics ,
Yes ,
I must write my hardware capture command ,
but question is HOW :)
I understand your comment ,
if I write that codes and If I use 4mhz osc ,
I can easly and faster read on my lcd 1000 to 9000 rpm ?
Tonight Im read 16F876 pdf file and work some new codes .
http://img116.imageshack.us/img116/2946/rpm1tm9.jpg
Acetronics2
- 4th April 2007, 17:57
[QUOTE=MaxiBoost;Yes ,
I must write my hardware capture command ,
but question is HOW :)
I understand your comment ,
if I write that codes and If I use 4mhz osc ,
I can easly and faster read on my lcd 1000 to 9000 rpm ?
[/QUOTE]
How ...
Take 876 Datasheet on $ 8.0, 8.1 ... CCP modules ...
an see which registers you have to deal with ...
For a first trial ... i suggest you to poll the interrupt flag rather than use an interrupt ...
for speed ... Haha ... the time is that of 1 rotation or time between two sparks ( half a rotation ...if i'm right !!! )
Alain
skimask
- 4th April 2007, 18:04
the time is that of 1 rotation or time between two sparks
Alain
What if I've got a diesel?
Acetronics2
- 4th April 2007, 19:19
Hi Skimask
You get the right to come back for 2nd week challenge !!! ...
1 rotation ... fits Diesel ALSO !!!
Ok ... can try to get the 3 phases from alternator ... but I read somewhere in this thread : ECU rpm output ...
France : 2 more points !!!
LOL !!!
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.