Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lab 2 - Microcomputer Principles and Applications | ECEN 3213, Lab Reports of Electrical and Electronics Engineering

Material Type: Lab; Subject: Electrical and Computer Engineering ; University: Oklahoma State University - Stillwater; Term: Spring 2005;

Typology: Lab Reports

Pre 2010

Uploaded on 03/19/2009

koofers-user-2k9
koofers-user-2k9 🇺🇸

10 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Lab 2 - Microcomputer Principles and Applications | ECEN 3213 and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity! ECEN 3213 Spring 2005 Lab 2 Due in Lab Section, Jan. 31, Feb. 2 Objective. Gain familiarity with 6811 arithmetic and logic instructions and binary number represen- tation. Discussion. If we were using a real microcomputer chip, we would only be able to see what comes in and goes out through the microcomputer I/O ports. We will study I/O in much more detail later. Instead, we will use the microcomputer window in the TExaS simulator to look inside the microcomputer chip to understand how the microcomputer works. The arithmetic and logical instructions modify certain flag bits inside the microcomputer. You can see the values of these flag bits by clicking on registers in the microcomputer window. You should see a line that looks like NZVC = %0000 in the View Box pane. The N bit is set whenever the last arithmetic/logic instruction gave a negative result (most sig- nificant bit 1). The Z bit is set whenever the last instructions gave a zero result (all bits 0). The V bit is set when an overflow occurs for signed numbers. The C bit is set when an overflow occurs for unsigned numbers. There are two kinds of data in assembly language, constants and variables. Constants have values that never change as the program runs. Variables have values that can be changed. Since constants can only be read, not written, constants should be assigned loca- tions in ROM along with the instruction codes. Variables, on the other hand, should be assigned locations in RAM so that new values can be written to them. There are three ways to create names for variables and constants. 1. The equ pseudo-op is used to assign an address to a name. It does not reserve any space for storing a value, and therefore, is not usually suitable for variables and constants. It is usually used for special memory locations like I/O ports, interrupt vectors, etc. 2. The ds pseudo-op assigns an address to a name (in the label field) and reserves the number of bytes specified in the operand field, but does not specify a value. This is appropriate for volatile memory (RAM) where initial values cannot be provided when the microcomputer is first turned on. It is usually used to assign space for variables in RAM.ECEN 3213 Spring 2005 Lab 2 January 27, 2005 page 1 of 4 3. The db, dw pseudo-ops assign 1 byte, 2 bytes (1 word) respectively to a name (in the label field) and assign the value specified in the operand field to the memory location. This is necessary for non-volatile memory (ROM), but is inappropriate for RAM since there is no way to guarantee that the value specified will be there when the microcom- puter is first turned on. It is usually used to assign space and values for constants in ROM. Ordinarily, an embedded microcomputer should never stop. Once started, it should keep responding to its external environment and keep providing control signals for whatever application it is used. During program development, it is often convenient to stop a pro- gram after it finishes rather than letting it run forever. You can use a “stop” instruction as your last instruction to stop your simulation without creating error messages. The reset button in the simulator is actually creating an interrupt. We will cover interrupts in more detail later. Interrupts look in a special location (the interrupt vector) to find where the next instruction should be fetched. The interrupt vector for reset is in $FFFE in the 6811. You should load the starting address of your program in this location in order for the reset button to work correctly. The following code was used to do this in lab 1, org $FFFE dw main where main is the label of the first instruction in your program Program Specifications. Reserve space in RAM for single byte variables UU, ZZ and word (2-byte) variable DZZ. Write code that goes in program ROM that makes UU = VV & WW ZZ = XX + YY DZZ = DXX + DYY where VV, WW, XX, YY are single byte constants and DXX, DYY are word (2-byte) con- stants. Initial values for the constants can be any byte or word you like. Procedure. 1. Enter your program in the program window and assemble it. Remember that you must open a microcomputer window in order to assemble your code. 2. In the microcomputer window, click on registers and then add the variables UU, ZZ, DZZ and constants VV, WW, XX, YY, DXX, DYY to the display. Use “h” format for the byte variables and constants and “H” (default) format for the word variable and constants. 3. Run your program and make sure it stops without getting any error messages. 4. Click reset and repeat 3. 5. Add breakpoints after the and and the two add instructions so that you can view the state of the machine after each of these operations.ECEN 3213 Spring 2005 Lab 2 January 27, 2005 page 2 of 4
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved