Elevator Simulation

Final laboratory project for ECE2510 Intro to Microprocessors at Western Michigan University

Similar projects worth following
As a final project in ECE2510 Intro to Microprocessors, we are required to complete a comprehensive program that simulates the behavior of an elevator. There are 4 floors, each with a "call elevator" button and LED. The elevator also has buttons and LEDs inside of it to choose destination floor and open/close the door.

This project will be completed using an assembly code program on the Dragon12 development board for the HCS12 microcontroller. We will be interfacing with the LCD display, the 16 button keypad, the buzzer, and LEDs on the board.

For full project requirements, see file: Lab_FinalProject.pdf


This is the final copy (I think) of the CodeWarrior project. The source assembly is in a sub-folder.

x-zip-compressed - 195.57 kB - 04/09/2016 at 21:11



Project description and requirements. Source: Mauro Pereira and Ayaz Akram of Western Michigan University

Adobe Portable Document Format - 317.13 kB - 04/02/2016 at 04:44



Lab manual for LCD and Keypad interfacing. Source: Mauro Pereira and Ayaz Akram of Western Michigan University

Adobe Portable Document Format - 682.92 kB - 04/02/2016 at 04:41



ASM file to interface with Keypad on Dragon12 board. Source:

plain - 9.21 kB - 04/02/2016 at 04:41



ASM file to interface with LCD display on Dragon12 board. Source:

plain - 3.84 kB - 04/02/2016 at 04:41


  • 1 × Dragon12-Plus2 Trainer Development board for HCS12
  • 1 × CodeWarrior IDE
  • 1 × The HCS12 / 9S12: An Introduction to Software and Hardware Interfacing Textbook

  • Finished (Enough)

    Nate Bowen04/09/2016 at 21:07 0 comments

    I came to school this morning (Saturday, 4/9/16) hoping that someone might be able to let me into the Microprocessors lab at some point today. After working on some other homework near the entrance for about an hour, I spotted my TA walking in. Praise God!

    So I worked on the project for about 5 hours and I think I've got it to a good place to call finished. There are some points I'm not going to get, but the complexity of those requirements is something I'm not about to spend another 10 hours on.

    What I completed today:

    • Incorporated the Buzzer with an additional "include" file.
    • Floors numbers displaying correctly on LCD, no matter which floor they are called from.
    • LEDs are all mapped and turning on and off when they should.
    • Added a second version of the "Readkeys" subroutine that loops finitely rather than in-finitely so that a keypress can interrupt the delay routine.
    • Macro to write a blank line to the LCD.
    • "Arrive" subroutine that fills in a gap in the logical of arriving at a floor (convenient, eh?).

    Added a video to the details section! Enjoy!

  • LCD Troubles, Flow, Due Date, and Todos

    Nate Bowen04/08/2016 at 13:12 0 comments

    Yesterday, Thursday 4/7/16, I was in the lab from 12:00-2:30. It was not exceedingly successful in terms of getting closer to the finished project. I spent a lot of time trying to make the LCD display the correct floor number, regardless of which floor form which the user is starting the motion. Unfortunately, I ran out of time as I was getting close - I think ;). I actually think that I have the flow of the program complete. All of the major loops and subroutines (and returns) appear to be functioning as I intend them to.

    I still don't know if this thing is supposed to be done by Tuesday, 4/12/16, but I can't imagine anyone in class is going to be finished if the lab isn't opened between now and then.


    • Correct floor displayed on LCD
    • Incorporate buzzer
    • Write open/close door routine
      • The skeleton and calls to these subroutines already exist.
      • I need to add a call to WRT_STRING in each
    • Turn on correct LEDs at the correct time

  • Organization and Flow Improved

    Nate Bowen04/06/2016 at 02:45 0 comments

    I was in the lab today from 11:30-4:00. Made quite a bit of progress on the logical flow and organization of the project.

    One of the big milestones was learning how to use additional files as libraries. I broke the code up into 4 or 5 separate files based on functionality. This was as simple as creating a text document with the .inc suffix, right-clicking on the "Sources" directory in the project tree, and adding the text document. The code was modified as such:

       INCLUDE ''

    I also worked out a lot of the logical flow. There is essentially a forever loop in the main function. In its ready state, it is waiting for keypad input. A series of compare instructions test which subroutine to jump to based on which key is pressed. The current draft of this loop is shown below:

        ;Waiting for Input
        JSR     READKEYS
        STAA    LAST_KY        
        CMPA    #OPEN
        BEQ     B1
        CMPA    #CLOSE
        BEQ     B2
        CMPA    #EXT_1
        BGE     B3
        CMPA    #INT_1
        BEQ     B4
        CMPA    #INT_2
        BEQ     B4
        CMPA    #INT_3
        BEQ     B4
        CMPA    #INT_4
        BEQ     B4
    B1 JSR     OPEN_DOOR
        BRA     MAIN
        BRA     MAIN    
    B3 JSR     COME
        BRA     MAIN   
    B4  JSR     GOTO    
        BRA     MAIN

    This thing is supposed to be done by next Tuesday, but with only one more lab day available to us before then, I'm not sure how far we are going to get. I plan on working in the lab on Thursday, 4/7/16, 12:00-2:00.

  • Writing string to LCD in ASM

    Nate Bowen04/02/2016 at 05:07 0 comments

    To write a string to the LCD on the HCS12, I wrote the following bit of assembly:

    ;main bit of program running up here
    ;               ....  ........              
    ;               ....  ........
                    LDX   #NEX_FLR        ;load X with string pointer
                    LDY   #NEX_LEN        ;load Y with string length
                    JSR   WRT_STRING      ;jump to WRT_STRING sub
    		LDAA  X               ;put the value at X in A
    		JSR   DATWRT4         ;sub to write the character
    		JSR   DELAY           ;required delay for LCD
    		INX                   ;next letter in the string
    		DBNE  Y, DISP         ;decrement string count and repeat
    		RTS                   ;once string is all printed, return
    NEX_LEN EQU     11                    ;string length
    NEX_FLR FCB     'Next Floor '         ;string contents

  • Project creation, source notes, to-dos.

    Nate Bowen04/02/2016 at 04:58 0 comments

    I have uploaded a number of files associated with this project. We have been given source assembly code to get us going with interfacing the HCS12 with the LCD and keypad on the Dragon12 board.

    I spent some time in the lab on Thursday, 3/31/16 during Ayaz's office hours. I was able to get the LCD to display keypad digits and characters. I am working on better merging the LCD and keypad source code. I hope to work some sort of library structure into the mix to improve the organization of the project.

    My next opportunity for lab time will be Tuesday, 4/5/16, 11:30-4:00.


    • Define memory structure
    • Explore library organization
    • Define LED and keypad assignments
    • Create all necessary strings for LCD display

View all 5 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates