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

Info iconThis preview shows pages 1–4. 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
Background image of page 1

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

View Full DocumentRight 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
Background 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/23/2011 for the course ENGINEERIN 102 taught by Professor Pablo during the Spring '11 term at Bilkent University.

Page1 / 17

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

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online