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 / Topics / Fire Alarm Code Help

Fire Alarm Code Help

|

Microcontroller › 8051 › Fire Alarm Code Help

  • This topic has 1 reply, 2 voices, and was last updated 9 years ago by Ashutosh Bhatt.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 16, 2016 at 4:26 am #4463
    CoolStuffZone
    Participant

    Need help with the following Homework assignment…

    Design a fire alarm system using a 8051 microcontroller. The specs are as follows:

    A) If the alarm is detected (one of the switches is activated) it should start flashing 4 LEDS (4 on the right (LEDS 1-4) and 4 on the left (LEDS 5-8), alternating).

    B) If the alarm is not detected, the display should show only 2 middle LEDS (LEDS 4 & 5) steadily ON (not flashing) indicating NORMAL operation.

    This is the code I’ve come up with so far, but I appear to be stuck. I would appreciate any assistance. Thank you.

    Code…

    ORG 0H                                

                    MOV A, #0                          

                    MOV P2, A         

                    MOV A, #OFFH 

                    MOV P1, A

                   

    INPUT:  MOV A, P1         

                   

    HERE:    JNB A, HERE       

                    MOV P2, #1        

     

    DELAY:

                    MOV R3, #15     

    OUTER:

                    MOV R2, #240   

    INNER:

                    DJNZ R2, INNER               

                    DJNZ R3, OUTER               

                    RET

                   

    SDELAY:

                    MOV R5, #45     

    H3:         MOV R4, #242

    H2:         MOV R3, #255   

    H1:         DJNZ R3, H1

                    DJNZ R4, H2

                    DJNZ R5, H3

                    RET

    END

    May 16, 2016 at 7:29 am #13922
    Ashutosh Bhatt
    Participant

    there are too many mistakes in your program. like u hv written sunroutines for delay but in ur program there is no CALL instructions

    u must first learn assembley language programming.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • An Update On Tarrifs May 16, 2025
  • Trying to use a L9110s motor driver chip May 16, 2025
  • I want to make a CRT with some modifications But i have no Idea where to start May 16, 2025
  • Funny Images Thread! May 16, 2025
  • Need Help Figuring Out the Schematics Of Circuit Board May 16, 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