Close

Organization and Flow Improved

A project log for Elevator Simulation

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

nate-bowenNate Bowen 04/06/2016 at 02:450 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:

;***************
;Header....
;
;***************
...
   INCLUDE 'newText.inc'
...
   Code

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:

MAIN
        
    ;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
    
B2 JSR     CLOSE_DOOR
    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.

Discussions