



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




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.
Procedure.
Starting TExaS
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