download (2) - Bilkent University EEE 212 Microprocessors...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Bilkent University EEE 212: Microprocessors 2011 Spring Semester LABORATORY PROJECT FINAL REPORT BÜŞRA ÖZBAY DERYA YEŞİLYURT GİZEM SARIKAYA OKAN POLATKAN
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 1. Functional Description The program begins with the definitions of the constants that will be used inside the program. Below you can see that part of the code: RD BIT P2.7 ;READ PIN OF ADC WR BIT P2.6 ;WRITE PIN OF ADC INTR BIT P2.5 ;INTERRUPT PIN OF ADC CD BIT 00 ;CD=1->COUNTDOWN MODE, CD=0->FREERUN MODE MSET BIT 02 ;MINUTE IS SET BIT (TO USE DEFAULT MINUTE) TSET BIT 03 ;TEMPERATURE IS SET BIT ;CURRENT TEMPERATURE IS BETWEEN (25,60) CTEMPH EQU 30H ;TEMPERATURE FIRST DIGIT CTEMPL EQU 31H ;TEMPERATURE SECOND DIGIT ;MINUTES IS BETWEEN (0,999) MINH EQU 32H ;MINUTES FIRST DIGIT MINM EQU 33H ;MINUTES SECOND DIGIT MINL EQU 34H ;MINUTES THIRD DIGIT ;SECONDS IS BETWEEN (0,59) SECH EQU 35H ;SECONDS FIRST DIGIT SECL EQU 36H ;SECONDS SECOND DIGIT ;TARGET TEMPERATURE IS BETWEEN (25,60) TTEMPH EQU 37H ;TEMPERATURE FIRST DIGIT TTEMPL EQU 38H ;TEMPERATURE SECOND DIGIT TEMP_SET EQU 39H ;TO COUNT 5 (TO UPDATE TEMP EVERY 5 SEC) After this part, interrupt vector tables for serial and external interrupts can be seen. And main program begins with a loop. The system stays in that loop until an interrupt occurs. LJMP MAIN ORG 3h LJMP RUSH_MODE_INTERRUPT ORG 23h LJMP SERIAL_INTERRUPT ORG 50H ;main loop MAIN: MOV SP,#50H ;MOVE STACK POINTER ACALL INITIALIZE AGAIN: ACALL UPDATE ;update continously SJMP AGAIN ;UPDATE ;updates temperature ;switches heater on or off ;refreshes lcd ;if in countdown mode updates time remaining
Image of page 2
3 UPDATE: DJNZ TEMP_SET, UPDATE_CONT ;CHECK FOR 5 SECONDS TO UPDATE TEMP. MOV TEMP_SET, #5 ACALL UPDATE_TEMP UPDATE_CONT: ACALL SWITCH_HEATER ACALL REFRESH_LCD ACALL DELAY_SEC JNB CD, END_UPDATE ;IF SYSTEM IS IN COUNTDOWN MODE ;UPDATE REMAINING TIME ACALL UPDATE_MIN END_UPDATE: RET ;THIS SUBROUTINE IS USED TO LOAD INITIAL VALUES TO TARGET TEMP AND COUNTDOWN ;TIME TO BE USED IN FREE RUN MODE DEFAULT_VALUES: ;DEFAULT CTEMP 0 (WILL GET FROM ADC) MOV CTEMPH, #'0' MOV CTEMPL, #'0' ;DEFAULT TTEMP 0 MOV TTEMPH, #'0' MOV TTEMPL, #'0' ;DEFAULT MIN 0 MOV MINH, #'0' MOV MINM, #'0' MOV MINL, #'0' ;DEFAULT SEC 0 MOV SECH, #'0' MOV SECL, #'0' RET A. LCD Module This module consists of the subroutines INITIALIZE_LCD, REFRESH_LCD, COMNWRT, DATAWRT, DELAY, and UPDATE_MIN. The subroutine UPDATE_MIN whose duty is to update the remaining time that is used in both Countdown Mode and Rush Mode is put here as stated, since we do that part outside the Timer ISR. Information about each subroutine can be seen as comments on top of them. ;THIS SUBROUTINE SENDS THE INITIALIZATION COMMANDS TO THE LCD INITIALIZE_LCD: MOV A,#38H ;TWO LINES, 5X7 MATRIX ACALL COMNWRT ;WHEN SENDING A COMMAND, USE COMNWRT SUBR. MOV A,#0FH ;DISPLAY ON, CURSOR BLINKING ACALL COMNWRT MOV A,#01H ;CLEAR DISPLAY SCREEN ACALL COMNWRT MOV A,#06H ;INCREMENT CURSOR (SHIFT CURSOR TO RIGHT) ACALL COMNWRT RET ; THIS SUBROUTINE IS USED TO REFRESH LCD EVERY SECOND REFRESH_LCD: MOV A,#80h ;FORCE CURSOR TO BEGINNING OF THE FIRST LINE
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 ACALL COMNWRT ACALL DELAY ;GIVE LCD SOME TIME ;CURRENT LABEL MOV A, #"C"
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern