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
nischay kumar
Wed Jul 30 2008, 10:49AM
 User Offline
Registered Member #8311
Joined: Sat Jun 07 2008, 11:09AM

Posts: 31
Thanked 3 times in 3 posts
Hello Forum,

i am making a Freq.meter/counter using 8051, i have no problem in coding and the methodology but i am stuck at the thought of Max freq. that can be measured by 8051.

i know the limitation of F/24 ( crystal freq divided by 24) i am using 12 Mhz crystal and that would give me 500 Khz max freq limit. with 24Mhz Crystal the max freq. is 1 Mhz

but the Timer in counter mode or in timer mode can only count up to 65,536D (FFFFH) after which it gets reset, so how is it possible to count 500 KHz or 1Mhz.

i am using a gate interval of 1 Sec with timer1.


i hope you folks can clear my confusion

Back to top


pdi33
Wed Jul 30 2008, 08:14PM

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

Posts: 770
Thanked 185 times in 180 posts
hi nischay,
use the corresponding timer/counter overflow interrupt to increment a software counter by one each time the counter overflows. this will be ur MSB and the THX/TLX will be ur LSB. So, even if u increment a single bytein the service routine, the combination will count upto FFFFFFH which is more than sufficient for ur application.

P.S. : do not worry about losing any input pulse counts while u are incrementing the MSB in the overflow interrupt as the internal counter will continue counting even when ur service routine is being executed and will only stop when u disable it by changing the TMOD/TCON registers.

[ Edited Wed Jul 30 2008, 08:23PM ]

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



This post has been thanked 1 time
nischay kumar
Wed Jul 30 2008, 11:44PM
 User Offline
Registered Member #8311
Joined: Sat Jun 07 2008, 11:09AM

Posts: 31
Thanked 3 times in 3 posts

Thank you pdi33,

in my timer0 ISR ( set as counter) if the count reaches FFFF, i am reseting TL0 & TH0 to 00h ( i know it automatically resets to 00H).

but you are advising to INC a 8 bit register or a variable for each time the counter overflows. so total maximum count would be FF of 8 bit register and FFFF of 16 bit couner/timer.


so i need a 3 byte hex to BCD conversion routine


thanks for your suggestion
Back to top


 

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