Docsity

Using the TExaS Assembler and Simulator: A Lab Guide, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECEN 3213 Spring 2005 Lab 1 January 22, 2005 page 1 of 6
ECEN 3213
Spring 2005
Lab 1
Due in Lab Section, Jan. 24-27
Objective.
To learn to use the TExaS assembler and simulator.
Discussion.
You are encouraged to do as much of the work for each of the labs outside of the lab if you
wish. You must come to the lab during your assigned lab period to demonstrate your pro-
gram and turn in a copy of your program to the lab instructor. The TExaS assembler and
simulator is available in all of the PC labs run by CEAT Labs.
The TExaS program has an extensive help menu. You should be able to find answers to
most of your questions there. The “Getting Started” item contains most of the information
necessary for this assignment. This lab is essentially a simplified version of the “Getting
Started” section.
A purchase of the Valvano text comes with a CD ROM which allows you to install the
TExaS program on your own computer. Put the CD ROM in the drive and then click
start -> run and type “e:/texas/setup” and follow the instructions from the install program.
There is additional information on the CD ROM which can make learning to use the
assembler and simulator much easier. Open your browser window to
file:///E:/assmbly/index.html
The syntax section is particularly good for learning to write assembly code.
Program Code.
Ordinarily, you will write your own assembly code for each lab. The code for this lab is
provided below so that you can concentrate on learning to use the assembler and simulator
rather than worrying about the details of the code. It is a good idea to add plenty of com-
ments as shown in the example. It is very easy to forget what you are doing in assembly
language.
pf3
pf4
pf5

Partial preview of the text

Download Using the TExaS Assembler and Simulator: A Lab Guide and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

ECEN 3213

Spring 2005

Lab 1

Due in Lab Section, Jan. 24-

Objective.

To learn to use the TExaS assembler and simulator.

Discussion.

You are encouraged to do as much of the work for each of the labs outside of the lab if you wish. You must come to the lab during your assigned lab period to demonstrate your pro- gram and turn in a copy of your program to the lab instructor. The TExaS assembler and simulator is available in all of the PC labs run by CEAT Labs.

The TExaS program has an extensive help menu. You should be able to find answers to most of your questions there. The “Getting Started” item contains most of the information necessary for this assignment. This lab is essentially a simplified version of the “Getting Started” section.

A purchase of the Valvano text comes with a CD ROM which allows you to install the TExaS program on your own computer. Put the CD ROM in the drive and then click start -> run and type “e:/texas/setup” and follow the instructions from the install program.

There is additional information on the CD ROM which can make learning to use the assembler and simulator much easier. Open your browser window to file:///E:/assmbly/index.html The syntax section is particularly good for learning to write assembly code.

Program Code.

Ordinarily, you will write your own assembly code for each lab. The code for this lab is provided below so that you can concentrate on learning to use the assembler and simulator rather than worrying about the details of the code. It is a good idea to add plenty of com- ments as shown in the example. It is very easy to forget what you are doing in assembly language.

  • This is a simplified version of tutorial "tut" PORTD equ $ PORTB equ $ PORTC equ $ DDRD equ $ DDRC equ $ org $0 Globals go in Ram Dvar ds 1 Copy of Input from Port D Cvar ds 1 Copy of Input from Port C Bvar ds 1 Copy of Output to Port B org $D000 Object code goes in ROM main ldaa #$ staa DDRD make all pins of Port D input ldaa #$ staa DDRC make all pins of Port C input ; all pins of Port B are always output loop ldaa PORTD Read switch values staa Dvar save a copy in variable Bvar ldab PORTC stab Cvar oraa Cvar Reg A = PORTD|PORTC staa Bvar staa PORTB output to lights bra loop repeat org $FFFE dc.w main Starting address after a RESET end

Procedure.

Starting TExaS

  1. Click on the TExaS icon. If there is no icon, click start -> programs -> “Test Execute and Simulate” -> “Microcomputer Simulator.”
  2. A window should come up asking what new windows you want. If you have previ- ously created a “Microcomputer” for this project, Click cancel. Otherwise, select “Microcomputer” and click OK.
  3. The main simulator window should come up with several sub-windows in it. When first starting a project, it is necessary to specify which microprocessor you will use. For this class, we will be using the 68HC711 microprocessor. You will not need to repeat this step when re-opening a previously created project. Click on mode -> processor. Click on the circle next to the 68HC711E9 microprocessor. Click OK. It is important to have the correct microprocessor specified before doing any work on the project. Entering Assembly Code
  4. If this is the first time you have used the simulator for this project, then click file -> new. Then select “program” in the window that comes up and click OK. If you already have an *.RTF file for this project, then click file -> open and browse to the location of your file.
  5. You should now have a new program sub-window in the TExaS simulator window. The program window is use to enter the assembly language code for the program you wish to run. This is a normal text editor window. You can move the cursor around in the window by left clicking the mouse (or using the arrow keys). Then enter text at the cursor. The delete and backspace keys can be used to eliminate unwanted text. It will

names and their contents appear in the View Box pane in the Microcomputer window. The names and values will also appear in “TheLog” window when running the pro- gram.

11.The contents of any memory location can also be displayed in the Microcomputer win- dow. Type “$1003” in the View Box Address pane and then click enter. The current value of this memory location is displayed in the Data pane and an entry for this mem- ory location appears in the View Box pane. Memory locations can also be displayed using symbolic names. Type “PORTC” in the address pane and then click enter.

12.The Microcomputer window can be used to change the contents of registers and mem- ory. With “PORTC” still in the View Box Address pane, type “$55” in the Data pane and click enter. You should see the entry for PORTC change to $55 in the View Box pane. Note that the entry for address $1003 also changed to $55. This is because your program defined PORTC as a symbol that stands for address $1003. Look in the pro- gram window at the fourth line of code to see where this was done. Note: if there are errors in your program, it is sometimes useful to put correct values in registers and/or memory. Then, you can run the rest of your program to see if it works or try out different values to see if they work.

13.The Microcomputer window allows you to set break points. When you run the simula- tion, it will automatically stop whenever it reaches an address defined as a break point. Type “loop” in the Break/Scan Address pane (not the View Box Address pane), then click Add. Now start the simulation (click Action -> Go or click the green arrow on the top menu bar). The simulation executes the instruction at address $D00A (the address that the symbol loop represents) and then stops.

14.Multiple break points are allowed. Type “$D014” in the Break/Scan Address pane, then click Add. Keep running the simulation and observe that it stops at both points. Select “loop” in the Break/Scan pane. Click Remove in the Break/Scan pane (not the Remove in the View Box pane. Run the simulation and verify that it no longer stops at the loop address.

15.Save your Microcomputer window by clicking file -> save when the Microcomputer window is selected. Make sure that your Microcomputer window is saved as a file type “*.uc”. Remember not to save your files on the hard drive of public accessible comput- ers. The contents of registers, memory and break points will be saved in this file. When you restart TExaS later, the contents of the saved *.uc file will be used to start your simulation. Input/Output Ports

16.Special addresses on the 6811 are wired to I/O ports instead of memory. The simulator uses the Microcomputer window to see inside the microprocessor chip. This is not pos- sible with a real chip. A real chip can only interact with the external world through its I/O ports. One of the unique features of this simulator is that it allows simulation of some typical circuit elements that might be connected to the I/O ports. Click file -> new, select “I/O Device” and click OK. A blank I/O window should appear.

17.To connect I/O devices to your ports, on the top menu bar click IO and then select one of the devices. A new “Attach I/O devices to the 6811” window should appear. Use the tabs in this window to select the particular device that you want. Select Switch and entry panes for 8 switches should appear. Type “PC0” (you must use a valid pin name for the 6811) in one of the port panes. You can put any label or select any color you want to help distinguish the different switches. Click OK. A new switch should appear in the I/O window. Click on the switch icon to toggle the switch open/closed.

18.Repeat the previous step to add switches to PC1, PC2, PC3, PD0, PD1, PD2, PD3. Run the simulation and verify that the bits in PORTC and PORTD change as the corre- sponding switches are open and closed. A closed switch should produce a 1 bit and an open switch should produce a 0 bit.

19.Add LED (light emitting diodes) as output devices to PB0, PB1, PB2, PB3. Run the simulation and verify that the LED lights up when the corresponding bit in PORTB is 1 and the LED is off (grey) when the corresponding bit in PORTB is 0. If your program is running correctly, the LED attached to PB0 should light up whenever the switch attached to PC0 is closed or the switch attached to PD0 is closed. Similarly for the other three bits.

20.Save your I/O window by clicking file -> save when the I/O window is selected. Make sure that your I/O window is saved as a file type “*.io”. Remember not to save your files on the hard drive of public accessible computers. The port connections will be saved in this file. When you restart TExaS later, the contents of the saved *.io file will be used to start your simulation. Scope Traces

21.Many people prefer a plot verses time of circuit outputs rather than looking at a list of numbers. You can add a simulation of an analog oscilloscope/digital logic analyzer by clicking file -> new, select Oscilloscope and click OK. In the Scope window, use the buttons on the lower left to select digital (dark switch toward digital), pan (dark switch toward pan) and run (dark switch toward run). Set the offset to 0 (left click and hold down to drag the switch to the correct position), and set the range to 25. Set the period to 1 us.

22.Attach inputs to the scope by using the menu bar at the top to click Scope -> Attach. An “Attach I/O signals to the scope” window should appear. It allows you to connect a signal to any of 8 channels on the scope. Click on the Channel 0 tab, then click on the circle next to “Port Pin” and type “PC0” in the pane next to it. Attach Channel 1 to PD0 and Channel 2 to PB0 in a similar manner. Click OK.

23.Run the simulator and observe the traces generated in the Scope window. Click on the switches connected to PC0 and PD0 and observe the signal change. Note that the out- put from PB0 is somewhat delayed from when the switches change depending on how many instructions must be executed before the output ports change.

24.You must have a print out of your program code before you demonstrate your program to your lab instructor. Click on the program window, then click on file -> print or click on the printer icon on the top menu bar. The copy of your assembly code is kept as part