Unit 2 Project 3: Flash LEDs in One Hz Frequency using LOOP

 

Project: Please read Chapter 3 of your textbook for writing subroutines and Chapter 4 of your textbook; then, write assembly programs to do the following:

  1. The clock frequency is Dragon 12 board 24MHz.
    Flash all LEDs in one Hz frequency when running your program.
  2. You must complete the given delay subroutine using LOOP to time approximately one second.
    You need to turn on all the LEDs, then, call this subroutine, turn off all LEDs, and then, call this subroutine.

    Note:
    NOP consumes 1 Clk Cycle
    DEC consumes 4 Clk Cycles
    BNE consumes 3 Clk Cycles

    Delay subroutine template
    L2         LDAA    #240
                 STAA    R1
    L1         NOP                 ;1 Clk Cycle
                 NOP                 ;1 Clk Cycle
                 NOP                 ;1 Clk Cycle
                 DEC     R1        ;4 Clk Cycles
                 BNE     L1         ;3 Clk Cycles
    Total number clock is that 10 Clk x 240 times = 2400 Clk = 0.1ms