Discussion in "Project Doubts" started by    aa6864    Jan 30, 2010.
Sat Jan 30 2010, 11:54 AM
can anyone explain the idea behind codes?at the begining its easy but further it gets hard i dont get the concept!

Sat Jan 30 2010, 03:15 PM
you can quote the part of code you find hard to understand. I will make it easy to understand. I hope you have read the theory of operation in download section.

Theory of Operation
As we all know frequency of a signal is number of cycle per second. I made use of this logic to calculate frequency of the input signal.
8051 has two timers, Timer 0 is configured for 1 second delay to sample the input signal and Timer 1 is used as a counter to calculate number of cycles in that 1 second. If timer1 overflows then the overflow is counter in another register which is considered as the high byte of Frequency. Input signal is provided at P3.5/T1 which is input for Timer 1 in counter mode. LCD is connected to microcontroller port 1 in 4-bit mode. Currently program is using 2 Line LCD but it can be used for 1 line LCD too.

Program initializes the Timer0 in 16-bit mode with 50mS delay value, a tick value of 20 is loaded to have total delay of 1s (50 x 20 = 1000 mS). Timer 1 is configured in 16-bit counter mode. After a sample of 1 sec, we get the number of cycles hence the frequency of input signal from timer1 registers (TH1:TL1) and high byte of Frequency. So total 3 byte value is then converted to a decimal equivalent represented in hex. This decimal value is then updated to LCD. The whole process repeats again.

Sat Jan 30 2010, 03:16 PM
[Topic moved to Project Doubts forum]
Sun Jan 31 2010, 05:22 AM
i read this at download section.i understand that .you explained the first part of program(in download section) but from disp_num i dont get how it counts frequencyup to 16.5MHZ?(which part shows that it counts from 1HZ to 16.5MHZ?).can you explain the process?for example the purpose of each subroutine.another thing what is the role of XX,YY,ZZ?
another thing i have 89c51 what changes i have to do in assembley code and shematic?

thank you

[ Edited Mon Feb 01 2010, 01:31 AM ]
Tue Feb 02 2010, 07:23 AM
xx yy zz are used in X2D routine which is 4 byte hex to decimal conversion routine.

XX0,XX1,XX2,XX3 is input 4 byte number, YY0,YY1,YY2,YY3 is temporary number used inside X2D routine, and lastly ZZ0,ZZ1,ZZ2,ZZ3 is the o/p BCD number of X2D routine.

TMR0_ISR is used as interrupt service routine for 1 sec timer.
TMR1_ISR is interrupt routine for counting incoming signal frequency.
disp_num to display a number on LCD.
lcd_reset soft reset for LCD.
lcd_init 4-bit lcd initialization routine.
lcd_wait busy flag wait routine.
lcd_cmd to send command to LCD in 4-bit mode.
lcd_dat to send data to LCD in 4-bit mode.
delayms is routine for delay in miliseconds. uses delay variable which tells how much delay needed.
X2D 4-byte hex to BCD conversion.
Tags Frequency Counter using AT89C2051 and LCDFrequency Counter using 8051
Tue Feb 02 2010, 11:06 AM
another thing when i send frequency more than 500KHZ(the frequency is right until 500KHZ), the LCD shows 300KHZ or something like that and incorrect but in download section you wrote 16.5MHZ. is something wrong in my circuit?

[ Edited Tue Feb 02 2010, 10:46 PM ]
Thu Feb 04 2010, 03:41 PM
hmm.. strange, are you sending square wave i/p?

Get Social


Powered by e107 Forum System


Wed May 20 2020, 03:59 AM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sun May 03 2020, 01:08 AM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 07:09 PM
Sir kindly send the code file i2c for 8051
Sat Mar 14 2020, 04:06 AM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 06:25 PM
how can get hadwere of this project
Sat Mar 07 2020, 09:41 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 09:28 PM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 02:42 PM
Pearl Olin
Wed Jan 22 2020, 10:46 PM
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.
Tue Jan 14 2020, 11:38 AM
shubham kharade
when i am trying to simulate the program in Proteus 8 professional, I am getting some errors as cannot find module file dhtxx.md can u help me



Thu May 21 2020, 08:44 AM
Wed May 20 2020, 09:28 PM
Wed May 20 2020, 03:05 PM
Wed May 20 2020, 07:52 AM
Wed May 20 2020, 03:15 AM
Tue May 19 2020, 06:08 PM
Tue May 19 2020, 02:22 PM
Mon May 18 2020, 09:50 PM


Guests: 36, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 01:37 AM

Members: 38211
Newest member: Davidthils
Forum Activity
xrxx Avatar
Posted By xrxx
Thu Apr 30 2020, 06:59 AM
BCD MULTIPLICATIONAssume that you have to 2 BCD nu...
liqian Avatar
Posted By liqian
Tue Apr 28 2020, 05:26 AM
I happened to see your post and I got many useful ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 28 2020, 04:21 AM
The code is hard to read.Please zip it and attach ...
rogermado Avatar
Posted By rogermado
Sun Apr 26 2020, 01:53 AM
@ExperimenterUK, thanks for your reply. You'll fin...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Apr 25 2020, 05:42 PM
Some simulators handle displays better than others...
rogermado Avatar
Posted By rogermado
Sat Apr 25 2020, 03:59 PM
Hello everyone, sorry in advance if i'm not in the...
PHANTOM28 Avatar
Posted By PHANTOM28
Fri Feb 28 2020, 10:25 AM
Hi.I hope you all can help me. I am relatively ne...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Feb 21 2020, 05:05 PM
ajay_bhargav Avatar
Posted By ajay_bhargav
Fri Feb 21 2020, 04:45 AM
Yes you can do that.1. Create a channel @Thingspea...
ananyagupta Avatar
Posted By ananyagupta
Thu Feb 20 2020, 03:58 AM
With regards to the particular characters sent to ...