free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
TB
Sat Aug 09 2008, 10:14AM
 User Offline
Registered Member #8175
Joined: Sat May 31 2008, 04:27PM

Posts: 38
Thanked 2 times in 2 posts
I'm using a DS89C450

I need to monitor a +7V input with variable frequency - is it possible to sample the frequency on a 8051 without additional hardware?

I need this to log revolutions of an engine. Output is as said +7V, when the engine is idling output is 26Hz (approx. 750rpm). So basically I need to translate the frequency of the input to a given value. Is it possible?

EDIT: Can I use the external interrrupt and a counter to solve this? eg a timer that resets a counter every one second, and then the external interrupt incrementing the counter? So the value of the counter equals the frequency when reset?



[ Edited Sat Aug 09 2008, 10:17AM ]
Back to top

frequency conversion   variable frequency   revolutions   timer   


pdi33
Sat Aug 09 2008, 10:33AM

 User Offline
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 770
Thanked 185 times in 180 posts
hi TB,
u would need only two timers for the task. use the first timer as a counter and connect the input to the corresponding counter input pin( e.g. if u are using timer0 as the counter , connect the input to the T0 pin of the uC. The second timer can be used to create the fixed time interval and just read the counter value when the timer overflows (i,e when the second timer interrupt occurs.
As for the +7V, better check the datasheet of the uC whether this level ( which is greater than the usual +5V level) can be safely used as the input directly to the uC . Else, u can always use a voltage divider/5.1V zener to reduce the level to required +5V level.

P.S. using the internal counter doesnot interrupt ur program flow so it is recommended. Ur idea of using external iterrupt also holds good but would affect other tasks of ur uC , as ur frequency of input increases generating an interrupt on every input transition which might reduce the efficiency/timing of ur other coding.


[ Edited Sat Aug 09 2008, 10:38AM ]

* inspired to develop,developing to inspire *
Back to top

voltage divider   two timers   first timer   time interval   input pin   


TB
Sat Aug 09 2008, 11:03AM
 User Offline
Registered Member #8175
Joined: Sat May 31 2008, 04:27PM

Posts: 38
Thanked 2 times in 2 posts
Ahh good point on the external interrupt - just didn't think that thought to an end
There is absolutely no need to run an interrupt handler every single time.

I'l look at that diode - I guess it's better than using a resistor?
Back to top

resistor   diode   


pdi33
Sat Aug 09 2008, 12:16PM

 User Offline
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 770
Thanked 185 times in 180 posts
definitely TB, a zener is always preferred to a simple voltage divider because it would clamp the input to a max. voltage to 5V even if ur signal voltage accidentally rises a few volts above above 7V during measurement.

* inspired to develop,developing to inspire *
Back to top

simple voltage divider   signal voltage   max voltage   zener   volts   


Arun Kumar V
Sat Aug 09 2008, 08:31PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 522
Thanked 219 times in 186 posts

Hi TB,

As our friend pdi33 has put it rightly, you are basically building a freq.counter/meter.

i would suggest to go with 1 sec sampling period, which gives accuracy of 1 Hz.

also what is the max freq./rpm of the engine ?

you can also use a normal NPN transistor like BC547 for connecting the input voltage,
feed the +7V to the base of transitor via a suitable value resistor (4k7/10k) and the collector is connected to the micro's pin( with a pullup) and emitter to Gnd


one more thing ( i think you already know this), you have to common the Gnd of the Micro circuit with the Gnd of engine circuit



all the best !


Arun
Back to top

npn transistor   sampling period   bc547   micro circuit   suitable value   


sashijoseph
Sun Aug 10 2008, 04:24AM

 User Offline
Registered Member #5870
Joined: Mon Feb 04 2008, 06:26PM

Posts: 650
Thanked 141 times in 134 posts
If it's an inductive pickup being used to derive the rpm pulses,a Schmitt trigger before the micro would be helpful,else there could be lots of false triggers for the counter.

Tb,what are you using for the input signal .. magnet-coil,Hall effect sensor,...?

Let there be music........
Back to top

magnet coil   inductive pickup   hall effect sensor   schmitt trigger   input signal   



This post has been thanked 1 time
 pdi33 
Arun Kumar V
Sun Aug 10 2008, 07:04AM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 522
Thanked 219 times in 186 posts


Hi TB,

are a attempting a tachometer, to know the RPM of engine ?


Arun
Back to top

tachometer   rpm   tb   


pdi33
Sun Aug 10 2008, 10:53AM

 User Offline
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 770
Thanked 185 times in 180 posts
@ TB,
as shashi bhai so rightly pointed out ( a very critical point in RPM measurement which i forgot to mention),a schmitt trigger would be highly useful especially when ur signal is not purely digital.


* inspired to develop,developing to inspire *
Back to top

schmitt trigger   bhai   critical point   rpm   measurement   


 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems