Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Rpm meter using at89c51 (minimize % error in Rpm)

Status
Not open for further replies.

blacksnow

Junior Member level 2
Joined
Mar 1, 2010
Messages
20
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,432
Hi, I am learning the 89c51 programming in keil C. Presently i want to read the clock (or pulse train of any frequency form 1 to 1100 Hz using proteus software). But there is some percentage error in the values that are displayed on LCD. e.g if feed 1kHz clock signal thr LCD shows 1001 or 1002, which is not a problem. The problems comes when i multiply these values by 60 to get rpm (rev/min) then it becomes 60060 or 60120. Presently i read the counter after every 1 sec.
Please give me some suggestion (not the c code) to minimize this error.
One other way will be to average the counter values e.g add last 5 counter values and multiply by 12 to get rpm but we will wait for 5 seconds to do so. Hence the pocess becomes slow.
Here is the portion of the code which calulates RPM,

while(1) {
delay();
TR1 = 0;
TR0 = 0;
value = 256*TH1+TL1;

rpm = 60*value ;
Conv2Dec(rpm);


TH1 = 0x00;
TL1 = 0x00;
TH0 = 0xd8;
TL0 = 0xf0;
TR1 = 1;
TR0 = 1;
i = 0;

}
}


void delay(void){

TR0 = 1; // Timer starts here

while(i!=100) { // repeat 100 times i.e 100 x 10,000usec = 1 sec

if(TF0==1) {
TF0 = 0;
TR0 = 0;
TH0 = 0xD8; // for 10000uSec
TL0 = 0xF0;
TR0 = 1;
i = i + 1;
}

}

}
 

Your time-base is 1us, so for 1khz, or 1ms, the count is 1000 +/-1 ..
As soon as you multiply the result by 60  +/-1 becomes +/-60 ..

Is it possible, with the same time base, to have the count of 10000 +/-1, then multiply the result by 6?
The answer is no, unless you increase the clock frequency i.e. the time base becomes 0.1us, 0.01us etc ..
This is a systemic error that, without changing horses, I’m afraid you can’t do much about ..

Rgds,
IanP
 
Thanks IanP for the reply.

You mean to say that i should be happy with my present result.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top