EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / ok i will chek it

ok i will chek it

|

Microcontroller › 8051 › how to start timer by software and stop by external hardware and then taking resultant value of time? › ok i will chek it

July 21, 2011 at 8:09 pm #6487
ZOBI
Participant

ok i will chek it out

 

basically i want this in my program

 

i want to use 16 bit timer then these steps in my prog.

 

1. pin p1.0 gives high for 10 microsecond then goes LOw, on its falling edge Timer 0 starts to count UP(with the help of INT0 timer start)

 

2. Then Timer will be stopped when pin P1.1 goes from high-to-LOW means on its falling edge(with the help of INT1 timer stop)

 

3. Then the TIMER value at which timer is stop ,will be save on Accumulator “A” or any register

 

4. then i will use that value for to compare between a range of diffrent values , the prog. will check whether the value is in between

166 microsecond to 1660 microsecond         volt 1

1661 microsecond to 3320 microsecond         volt 2

3321 microsecond to 4980 microsecond         volt 3

4981 microsecond to 6640 microsecond         volt 4

                               .                                           

                               .

                               .

                               .

                               .

                               .

                               .

                               .

 

5. Then after a series of comparing/checking TIMEr value from these RANGES ,when TIMEr value comes in these any of range microcontroller will send a CODE to DAC0808 to produce a voltage of respective code like on volt 1 it will send a code to DAC0808 to produce more voltage and on sending a code of volt 2 it will send a code to DAC0808 to produce less voltage as copmared to volt and and so on..

basically i m designing a project Using ultrasonic range finder SRF04,89C51 ,DAC0808

when any object will come in front of sensor it will reflect back a the ultrasound waves which wass emited by sensor on reciving that a pin goes from high to LOw after that controller will calculate the time how much time does the wave has taken in air then it will give code to DAC0808 to produce voltages which will vibrate a motor according to the distance

here is the code which I have made to which makes pin p1.0 high for 10 usec ,start stop the timer 0 and then the VALUE of timer  TL0 & TH0 will be added and will be saved in “A” but I don’t know is this correct or not.plz chek it

org 0000h

ljmp main

ORG 0003H

setb tr0

ORG 0013H

clr a

mov r4,tl0

mov a,th0

add a,r4

ORG 0030H

MAIN:

setb tcon.3

setb tcon.1

mov Ie,#10000101b

mov tmod,#10011001b

mov tl0,#0000

mov th0,#0000

setb p1.0

call delay

delay:

l1:mov r0,#1

djnz r0,l1

nop

nop

clr p1.0

end

 

 

RSS Recent Posts

  • Faulty heat air gun (dc motor) - problem to locate fault due to Intermittent fault July 19, 2025
  • Does US electric code allow branching ? July 19, 2025
  • Fun with AI and swordfish basic July 19, 2025
  • Sump pit water alarm - Kicad 9 July 19, 2025
  • turbo jet fan - feedback appreciated. July 19, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise