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.

Counter programing in 8051 using asm language

Status
Not open for further replies.
Re: to count pulses using 8051

just one second..

did you get how i arranged the setup because i guess i didnot explain my setup well to you
 

Re: to count pulses using 8051

I understand how your setup works.... I wanted to know which code you used to operate a LED for 1/4th rotation.
 

Re: to count pulses using 8051

Code on post #14 is for counting & displaying rps values, not for displaying LED for 1/4 rotation. However, did it worked for you??? How much variation on rps it is giving???
 

Re: to count pulses using 8051

ya i didnot get why you asked me about #14 code because that all is done & you code gave a variation of about by 1rps because then i measured by tachometer which showed second speed=16rps & by you code i got 15rps almost same only with third speed it was varying a lot.

- - - Updated - - -

code i have written to display a led at 1/4th rotation using 960rpm motor:
Code:
org 0000h
ljmp main
org 0100h
main:mov p1,#00h
mov p3,#0ffh
mov tmod,#01h
up:
j1:jb p3.3,j1
lcall delay	//15ms delay
setb p1.6
lcall delay1	 //1ms delay
clr p1.6
sjmp up
delay: //15ms delay
mov th0,#0eeh
mov tl0,#09h
setb tr0
l1:jnb tf0,l1
clr tf0
clr tr0
ret
delay1:		  //1ms delay
mov th0,#0feh
mov tl0,#0d2h
setb tr1
l:jnb tf1,l
clr tf1
clr tr1
ret
 

Re: to count pulses using 8051

Your code seems right, except the timer high & low values. How did you calculated it??? When I calculated, for 15ms, TH0 = 0CAH & TL0 = 0CH, and for 1ms, TH0 = 0FCH & TL0 = 067H.
 

Re: to count pulses using 8051

actually 15.3625ms is the exact delay but to set this the code you can see i.e
Code:
lcall delay	//15ms delay
delay:
mov th0,#0eeh
mov tl0,#09h
setb tr0
l1:jnb tf0,l1
clr tf0
clr tr0
ret

here lcall delay=3machine cycle(mc)
mov th0=2mc
mov tl0=2mc
setb tr0=3mc
clrtr0=3mc
clr tf0=3mc
ret=1mc
&jnb=3mcs
total=17mc so 17*1.086us is deducted from 15.325ms and so the to tal calculation goes like this:
15.3125ms=17*1.086us+3(65536-th0tl0value)*1.086us
by this i have calculated the th0,tl0 values.
 
Last edited:

Re: to count pulses using 8051

actually i am able to display all letters(a-z),numbers(0-9) and displayed few images till now.
but i could not display character at 1/4th of the circumference with 15.325ms but rather it displayed with a delay of 61ms so i wanted to know why is it happening like that??
but otherwise everything is working perfectly
 

Re: to count pulses using 8051

I think you need to recheck your timer high & low values. If you consider 17mc in your math, it just contributes to 18.4us. Your TH0 & TL0 values makes a delay of less than 5ms. I want you to use the math shown in post #4.
 

Re: to count pulses using 8051

no i got it wrong actually in my code to dispaly characters from 1/4th of the circumference i have loaded th0=0b8h,tl0=015h which makes approx=20ms.
then there is no such any problem... i had written correct program considering a delay of 15-20ms for 1/4th rotation but interpreted it wrongly.
 

Re: to count pulses using 8051

So now the program works as you wanted with th0=0b8h tl0=015h timer values???
 

Re: to count pulses using 8051

yes i need not be that precise by deducting 17mc's and all it will work good at approx 20ms
 

Re: to count pulses using 8051

yup i wrote the programing without using timer interrupts & external interrupt working awesome thank you once again actually this was my 2nd project in microcontrollers
 
Last edited:

Re: to count pulses using 8051

You welcome.
Just adding something:

When your project is based on timing, it is better to use crystal of standard values, such as 4MHz, 8MHz, 12MHz etc. 11.0592MHz is mostly used for UART communication, because by this value most of the standard baud rates can be generated.

You can make accurate tachometer by running the system slow and counting the time taken for one revolution, instead counting rounds per second. Because in RPS, we leave the decimal values and when converted to RPM, the result varies a lot. Counting the time frame for one round is more accurate & can give fast result updates.




Regards
Genovator
 

Re: to count pulses using 8051

ok i will consider this point.

i am going to my next project that is object follower robot(i mean may be human follower). When my mom goes to market a robot which can carry all the load should follow behind her. so her i will be using ir receiver & transmitter in order to sense the person & follow him/her.
is ir sensor good for this application? then what is the limit that can be kept between the two? If not which sensor i should prefer.
I have googled about ultrasonic sensor but it's quite costly so i have dropped idea of using ultrasonic sensors.
 
Last edited:

Re: to count pulses using 8051

If you use IR there will be some drawbacks, such as, the robot will never understand what is the distance between it and the person it is following, which direction the person is standing or moving, how fast the person is moving, etc. Even if you make it understand the direction, it will never understand what to do when any other person, vehicle, object comes near to it. For that you have to use ultrasonics to measure out distance. The ultimate thing is you have to make it much intelligent and for that you have to add a lot of components, most of them are costly and needed to order online.
 

Re: to count pulses using 8051

but remote controls(which use ir) work at fairly good range that much range is suffecient to detect any movement by the robot right??
i actually wanted to put up a micro antenna and some stuff like that but, have no clear idea i want to make arrangement cheapest but i am still desciding what i have to use
anyway.... if you get some better & good idea do post it.

otherwise how would it be if i try my hands on voice recognised robot but,without using microcontroller i guess,i may require speakers,opamps,some other stuffs those products i may get in local electronic stores...
 
Last edited:

Re: to count pulses using 8051

You cannot do voice recognition without microcontroller.
IR range is enough to work with. But it doesn't tells the distance in between. Also you will need a direct line-of-sight. IR cannot pass opaque objects.
Keep searching google for such existing DIY projects. You will get an idea...
 

Re: to count pulses using 8051

everyones voice depends upon one's unique frequency so that particular frequency will help to recognize anyones voice. so inorder to recognize anyone's voice then i will have to use some methods & sort out the person's voice then pass it through comparator & later recognize whether it the same person's voice or not.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top