Assignment 2: 68HC11 Boot Lab

Similar documents
ASSIGNMENT 4: INTRODUCTION TO THE 68HC11. Out: Monday, Sep 29, 2003 Due Monday, Oct 6, 2003

ASSIGNMENT 3: PLAYING WITH THE 68HC11. Due Wednesday, Oct 9, 2002

ASSIGNMENT 4: THE 68HC11

1/Build a Mintronics: MintDuino

PROTO BOARD SETUP Here is a schematic of the circuit we will build.

Introduction to Microcontrollers

PUSH BUTTON. Revision Class. Instructor / Professor LICENSE

Lab 8: Debugging Embedded Devices and Software

Professional Radio GM Series. Controlhead Service Information

Digital Circuits. Page 1 of 5. I. Before coming to lab. II. Learning Objectives. III. Materials

COS 116 The Computational Universe Laboratory 7: Digital Logic I

EE 354 August 1, 2017 Assembly of the AT89C51CC03 board

Input and Output Ports. How do you get data into a computer from the outside?

Physics 120/220 Lab Equipment, Hints & Tips

TEMPERATURE SENSOR. Revision Class. Instructor / Professor LICENSE

POTENTIOMETER. Revision Class. Instructor / Professor LICENSE

Building the FlipChip Tester

7 8 9 C. PRELAB REQUIREMENTS You must adhere to the Lab Rules and Policies document for every lab.

CMS-8GP32. A Motorola MC68HC908GP32 Microcontroller Board. xiom anufacturing

The Freescale MC908JL16 Microcontroller

Pre-Lab: Part 1 Using The Development Environment. Purpose: Minimum Parts Required: References: Handouts:

PARTS LIST 1 x PC Board 36 x 5mm Red LED 36 x 12mm LED Standoff 36 x NPN Transistor 36 x 10kΩ Resistor OTHER PARTS YOU MAY NEED

ECE 2036 Lab 4 Setup and Test mbed I/O Hardware Check-Off Deadline: Thursday, March 17, Name:

MegaAVR-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN (317) (317) FAX

WORDSYNC ADDENDUM to the SupraDrive Operator s Manual

University of Hull Department of Computer Science C4DI Interfacing with Arduinos

CMD711-EX Development Board

AN-HK-32. In-Circuit Programming of FLASH Memory in the MC68HC908GP32. nc... Freescale Semiconductor, I. PART 1 Introduction

Supplement for module D061 incl. ATMega128 Prozessor

Gooligum Electronics 2015

University of Florida EEL 4744 Drs. Eric M. Schwartz, Karl Gugel & Tao Li Department of Electrical and Computer Engineering

AN ELNEC EN ISP-HC08. Application note for In-System Programming of Motorola/Freescale HC08 microcontrollers

MC68HC12 Parallel I/O

Supplement for module D041 incl. ATMega8 Prozessor

USB Type A Female Breakout Hookup Guide

Developing HC11 systems for RAM memory areas:

AN1239. HC05 MCU Keypad Decoding Techniques Using the MC68HC705J1A. Introduction

LAB #1: The CSM12C32 Module and PBMCUSLK Project Board

PIC Dev 14 Through hole PCB Assembly and Test Lab 1

TA0139 USER MANUAL ARDUINO 2 WHEEL DRIVE WIRELESS BLUETOOTH ROBOT KIT

AN231K04-DVLP3 AnadigmApex Development Board

Nov. 07, 2013 p. 5 - changed the B axis unit value to from Changed by Randy per Frank s request.

TuBbika SMR-4-PLUS voicecard

Lab 0: Wire Wrapping Project: Counter Board

Example Programs for 6502 Microprocessor Kit

I2C and SPI Foundation

3. The MC6802 MICROPROCESSOR

Alesis MMT8 16x Memory Expansion Modification (all grey model MMT8 s)

Assembly Instructions for 128x64 Graphics Display Unit

LED Knight Rider. Yanbu College of Applied Technology. Project Description

Laboratory 10. Programming a PIC Microcontroller - Part II

PropIO V2 User Guide. Wayne Warthen RetroBrew Computers

Figure 1. JTAGAVRU1 application The JTAGAVRU1 is supported by AVR Studio. Updated versions of AVR Studio is found on

REQUIRED MATERIALS Epiphany-DAQ board Wire Jumpers Switch LED Resistors Breadboard Multimeter (if needed)

Drexel University Electrical and Computer Engineering Department ECE 200 Intelligent Systems Spring Lab 1. Pencilbox Logic Designer

CSC 258 lab notes, Fall 2003

Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics

Bar Code Scanner Specifications for XL200 Controllers

Chapter 19. Floppy Disk Controller Discussion. Floppy Disk Controller 127

ECE 3120 Lab 1 Code Entry, Assembly, and Execution

The 9S12 in Expanded Mode - How to get into expanded mode Huang Chapter 14

Assembly Instructions (8/14/2014) Your kit should contain the following items. If you find a part missing, please contact NeoLoch for a replacement.

University of Florida EEL 3701 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering Revision 0 12-Jun-16

CSCI 6907 PROJECT PROPOSAL LIGHTS OUT MANAGEMENT

Bill of Materials: Programming Interface for AVR PART NO

USING THE ACOM2 ASYCHRONOUS COMMUNICATION ADAPTER WITH MOTOROLA MICROCONTROLLERS

_ V1.3. Motorola 68HC11 AE/AS POD rev. F. POD Hardware Reference

Mega128-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN (317) (317) FAX

type : Title : 1 / Page : Version : Date : User s guide MNTload TECHNICAL DEPARTMENT User s guide MNTload

Using the stack and the stack pointer

Stand-alone programming AVRs using CircuitPython

Programming Book for 6809 Microprocessor Kit

Serial Board May 31, 2015

PIC Dev 14 Surface Mount PCB Assembly and Test Lab 1

melabs Serial LCD Firmware Version 1.1 3/5/07

RMV ELECTRONICS INC. Application Note

APP-II PIC Development Kit by AWC

Teaching and Curriculum Development of Microprocessor Classes

Electronics Construction Manual

Roberto Muscedere Images and Text Portions 2003 Prentice Hall 1

Finite State Machine Lab

Computer Organization I. Lecture 28: Architecture of M68HC11

Preassembled 40-pin Pi Wedge Hookup Guide

Lab 2.2 Ohm s Law and Introduction to Arduinos

Note that FLIP is an Atmel program supplied by Crossware with Atmel s permission.

Introduction to MATLABs Data Acquisition Toolbox, the USB DAQ, and accelerometers

Installation/assembly manual for DCC/Power shield

Create moving images in forward and reverse with your Arduino when you connect a motor to an H-bridge and some still images BATTERY POTENTIOMETER

um-fpu Application Note 9 Adding a Serial Connection to um-fpu V2

1. Memory Mapped Systems 2. Adding Unsigned Numbers

EASY219 / IEC CANopen Master / Slave

Go Gators! Relax! May the Schwartz be with you!

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

USBG-8COM-PRO 8-Port USB to RS-232, 422, 485 Auto Setup Adapter Manual. Features & Specifications. Specifications

Chapter Operation Pinout Operation 35

Rapid28iXL PIC Prototyping PCB User Manual

The purpose of this course is to provide an introduction to the RL78's flash features and archectecture including security features, code and data

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Introductory Digital Systems Laboratory

Discharge by touching: BNC coax shield, outlet metal cover plate, wire connected to GND

Parallax Serial LCD 2 rows x 16 characters Non-backlit (#27976) 2 rows x 16 characters Backlit (#27977) 4 rows x 20 characters Backlit (#27979)

Transcription:

ASSIGNMENT 2: 68HC11 Boot Lab Introduction In this assignment, you will: construct a 68HC11 system on your breadboard, and use the serial port of a computer to load programs into it. load a known-working program into the HC11 to verify that your wiring setup and serial line configuration is working. modify and write new programs for the HC11 and use your setup to load them into the HC11 for testing and debugging. Longer Introduction More specifically, here s what will be involved. You can use this section as a reference when you get going. 1. Software install the tools for getting code onto the HC11 are written in Java. So the first order of business is to get the Java runtime (and serial port drivers) onto your machine. download Java 1.1.8 system install javax.comm extensions Detailed instruction for this are on the course web site (javasetup). 2. Hardware First will be building the HC11 circuit, and downloading a known working program into it. The test program uses the HC11 to generate a square wave beep tone. build the circuit run the test download: java BeepTest COM1 3. Development setup next you need the tools to assemble HC11 source code into object code, and then load that object code onto the HC11. download 68HC11 assembler: as6811.exe assemble the test program: as6811 -ol beep.s download the test program object code into the HC11: java HC11EELoader beep COM1 [gets it running on your board] 4. Assignment A the first coding challenge is to read the state of a switch and use it to control an LED. connect wire from port A, bit 0 (pin 8) to sw1 connect wire from port A, bit 6 (pin 2) to led1 modify starter file ledsw.s so that when sw1 is 1, led1 turns on (as6811 -ol ledsw.s; java HC11EELoader ledsw COM1) 5. Assignment B the other coding challenge is to control the beeping with the switch. 11. modify beepsw.s so that it beeps when sw1 is pressed and not when it's released (as6811 -ol beepsw.s; java HC11EELoader beepsw COM1) http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 1

SOFTWARE INSTALL From the course web site, visit the page http://www.cs.uml.edu/~fredm/courses/91.305-fall04/javasetup.shtml This page explains how to download and configure Java for use with the HC11. Go as far as the point where you run the BeepTest program to discover the serial ports, and get that working. The program should find COM1 and/or COM2 (or ports with different names if you are running on an OS other than Windows). HARDWARE SETUP This section explains how to build the circuit. Please also refer to the color photo of the fully built system. The Breadboard The diagram below illustrates a piece of the solderless breadboard used to build circuits. Each of the four columns is fully connected from top to bottom. Each short row of five holes is connected. Integrated circuits may be pressed down into the breadboard, straddling the groups of 5. To make a connection, strip about 1/4 off both ends of a wire, and insert it down into the holes. Note: please use the wire provided or other 22 gauge wire. Do not use wire thicker than 22 gauge (20 or less) because it will damage the breadboard. + red blue + red blue <-please forgive the lousy diagram; these should all be round circles Hardware Setup: Power Wiring The first order of business is to set up the power (+5v) and ground (0v) busses. As a convention, please use red wires for +5v and black wires for ground. Of course, the electrons don t care what color wire they are travelling on, but red=+5 and black=gnd is a community standard and it makes it a lot easier to see what s going on in your circuit. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 2

red + + black Your breadboard should have a pair of power lines on either edge (2 pairs total). The lines in red should be used for +5v and the lines in black or blue should be used for ground. Use a red wire to connect from any of the 305DEV board s four +5 outputs to the left-side red column. Then jumper from this red column to the right-side red one. Next use black wire to jumper from the 305DEV board s ground to the left-side blue/black column, and jumper to the right-side blue/black one. Finally, insert one 0.1µF capacitor (they re marked 104 ) into each power-ground bus. The diagram above illustrates this. The purpose of these capacitors is to smooth out fluctuations in the power supply, making sure the HC11 operates properly. Now, you ve got +5v from either red column, and ground at either blue/black one. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 3

Insert the 68HC11 The diagram below show the 68HC11. Note the scoop-shaped cut along the top edge. To the left of it is pin 1; to the right of it is pin 48. Also, on the chip itself, there is a dot next to pin 1. Insert the HC11 into the breadboard midway down, so that pin 1 is along the row numbered 20. Arrange it so that there are 2 holes available along the left column of HC11 pins, and 3 holes available on the right side. Please do it carefully. You don t want any pins bending and breaking off because you were in a rush. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 4

Hardware Setup: HC11 Wiring The drawing below shows how the 68HC11 chip should be wired. Here are a few notes of interest: Power is applied via Vdd (pin 48); ground is applied at Vss (pin 23). Use red wires for power and black for ground. The pins ~RESET, ~XIRQ, and ~IRQ must all be tied high. (That is, connected to +5v.) The analog input references should be connected: VRL to ground, and VRH to +5v. The MODA (pin 25) and MODB (pin 24) lines must be tied to ground. This put the HC11 into the serial bootstrap mode when it is powered on or reset. There is a 1K pullup resistor on the HC11 s TxD output. This is necessary because when the HC11 starts up in bootstrap, the pin can only assert ground, and must be pulled high to produce a logic one ( wired OR mode ). This TxD output goes to two places: The 305DEV board s xmt input, and the 305DEV board s LED8. Please see the wiring photograph for guidance. Please observe the following notes on the ceramic resonator: The ceramic resonator has 3 pins, and is connected to the XTAL, EXTAL, and ground. Mount the resonator near to the XTAL and EXTAL lines, and keep all wires to the resonator as short as possible. The outer two pins of the resonator go to XTAL and EXTAL (either way there s no polarity). Wire the center pin of the resonator directly to Vss (ground) of the microprocessor. Then run a wire from the processor Vss to the ground bus. You must add a 10K resistor in parallel with the outer two pins of the resonator to get the oscillation frequency to stabilize. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 5

68HC11 WIRING DIAGRAM All set? OK, now we ll try to talk to the HC11 from the serial line! http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 6

BOOT YOUR 68HC11 When run, the BeepTest program puts a program into the 68HC11E's 512 bytes of internal memory using the chip's bootstrap download feature. The distribution version of the file installs program that creates a beep on bit 4 of the Port A register (pin 4 of the HC11). Now we are ready to download this program to the 68HC11. OK, you've got a valid serial port, probably COM1 or COM2 since you're on a PC. Plug your assembled 68HC11 system into the serial port using your DB9 cable. Type at the MS-DOS prompt: java BeepTest COM1 replacing COM1 with whichever serial port you are using, of course. The program should prompt you to turn on the HC11, and check that LED8, which should be hooked up to the 6811's TxD, is off. This indicates that the 6811 is correctly in the bootstrap mode (power on but TxD LED off). Press Return, and the LED8 HC11 TxD indicator will flash as the 6811 replies to the host computer while the bootstrap download is happening. When the flashing is done and the BeepTest program has finished, you should hear a loud clear beep coming from the piezo on the 305DEV board! A square wave is being generated by the HC11 and the piezo is transducing it into sound. If all this works, congratulations! Your 68HC11 system is up and running. If you get an odd Java error that causes the program to crash before it gets any work done, try disconnecting the wire that goes to the 305DEV board s xmt input. Then try again. If it then works, then later (when downloading to the HC11 s EEPROM),you ll have to leave this wire disconnected until you are prompted to put it back. If you don't get the beep, check your wiring and then come to lab. We have more advanced tools for debugging the set-up. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 7

DEVELOPMENT SETUP The BeepTest program loads and runs from the HC11 s internal RAM, so once the chip is powered down, the program is lost. Here, we ll learn how to assemble and download programs into the HC11 s internal EEPROM. This memory is persistent through power-cycles and is only erased when it is overwritten. The steps are: Download the HC11 assembler program, as6811 Assemble beep.s test program Download the resulting beep.rel object file to the HC11 From the course web site, download both the hc11-bootlab.zip project files and the as6811.exe assembler. You ll be working from a command prompt in the hc11-bootlab directory, so it would make sense to put the as6811 executable there. The beep.s Test Program Take a look at the beep.s test program: ;;; beep.s ;;; toggles Port A4 with delay loops between each toggle, ;;; creating an oscillation in the audible range..area SYS (ABS).org 0xb600 clra loop: ldab 0x1000 orab #0x10 stab 0x1000 declp1: deca bne declp1 ldab 0x1000 andb #0xef stab 0x1000 declp2: deca bne declp2 bra loop After the comments at the beginning of the file, the.area directive tells the assembler that this is system code that is located at an absolute address in the HC11 s memory. The.org command tells it where: address 0xb600. This is the beginning of the HC11 s EEPROM program memory. So, when the assembler creates object code, that object code will be targeted beginning at address 0xb600. The program itself causes an oscillation by setting and clearing bit 4 (the 0x10 bit) of PORTA (which is at address 0x1000 of the HC11). The block of code loop: ldab 0x1000 orab #0x10 stab 0x1000 http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 8

reads PORTA into register B, and then ORs it with the immediate value 0x10. This sets bit 4. Then register B is stored by to PORTA, thus causing the physical pin PORTA bit 4 to go high. The next chunk of code causes a delay: declp1: deca bne declp1 The A register is decremented, and if it s not zero (BNE) then it s decremented again. Since the A register is an 8-bit register, it will take 256 times to decrement it from 0 to 255 to 254 etc. and down to 0 again. The next chunk of code clears the bit of PORTA that was set earlier: ldab 0x1000 andb #0xef stab 0x1000 Here, the PORTA value is AND ed with 0xef, which in binary is 11101111. Thus bit 4 is forced to be a 0 while the other 7 bits are left unchanged. The program concludes with another delay block and then branching to the beginning to repeat the process all over again. Assembling beep.s Let s assemble this file now. Type at the command prompt: as6811 -ol beep.s This invokes the assembler and tells it to make an object file (-o), which has a suffix of.rel, as well as a listing file (-l), which has a suffix of.lst. The Listing File Check out the resulting listing file: h toggle,. 4 5.area SYS (ABS) B600 6.org 0xb600 7 B600 4F 8 clra B601 F6 10 00 9 loop: ldab 0x1000 B604 CA 10 10 orab #0x10 B606 F7 10 00 11 stab 0x1000 B609 4A 12 declp1: deca B60A 26 FD 13 bne declp1 1 ;;; beep.s 2 ;;; toggles Port A4 with delay loops between eac 3 ;;; creating an oscillation in the audible range http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 9

B60C F6 10 00 14 ldab 0x1000 B60F C4 EF 15 andb #0xef B611 F7 10 00 16 stab 0x1000 B614 4A 17 declp2: deca B615 26 FD 18 bne declp2 B617 20 E8 19 bra loop Notice all the new information in the listing. The first column, starting with B600, shows where the code is targeted in memory. The second column area shows the actual machine code for each instruction. For example, on line 9, the instruction is ldab 0x1000 and the machine code for this is F6 10 00. Thus F6 is the opcode for LDAB, and 10 00 is the address from which register B is loaded (address 0x1000, which is the hardware PORTA register). If your program is not working, it s a really good idea to look at the listing file and make sure the assembler is doing what you want it to. Downloading beep.rel into the HC11 The assembler also produced a file with a.rel suffix. This file contains just the bytes and where they should go. Here it is: XH2 H 2 areas 1 global symbols S..ABS. Def0000 A _CODE size 0 flags 0 A SYS size FFFFB619 flags C T B6 00 R 00 00 00 01 T B6 00 4F F6 10 00 CA 10 F7 10 00 4A 26 FD F6 R 00 00 00 01 T B6 0D 10 00 C4 EF F7 10 00 4A 26 FD 20 E8 R 00 00 00 01 Notice the lines beginning with a T, for target. These lines contain 2 bytes of absolute address, followed by the data that go there. The first T line has no data, but the second and third ones have the assembled code we saw in the listing file. The Java program HC11EELoader is used to install one of the.rel files into the HC11 s internal EEPROM. Try it now to download the beep program: java HC11EELoader beep COM1 The program assumes a.rel suffix for beep, so you don t have to type it. The program will prompt you through turning on the HC11 at the right time. Also, if you had to disconnect the xmt wire earlier the program will prompt you to put it back in. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 10

If everything works, you ll see a console transcript like this: Opened serial port COM1 at 1200 baud. Read 251 bytes of code from file eeboot20.rel Preparing to load talker into RAM. Turn on HC11 and make sure TxD/LED8 is *off*. Then press <ENTER> to continue... Writing HC11 talker to serial line... Done loading talker. TxD/LED8 should be full on now.. Opened serial port COM1 at 9600 baud. Connect HC11 TxD wire and press <ENTER> to continue... Synchronizing with board... OK. Checking that HC11 CONFIG register is 0x0d...OK. Starting to load the EEPROM addresses... Addr b600: loading 13 bytes. Addr b60d: loading 12 bytes. File download succeeded! At this point, the beep code is in the HC11. Now we just have to get it to run. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 11

Running Code That s Loaded into the HC11 To get the HC11 to run the code in its EEPROM, its TxD and RxD pins must be jumpered together. Get a short piece of wire and bend it into a U-shape, and then plug it into the open breadboard holes,connecting TxD (HC11 pin 43) and RxD (HC11 pin 42). See diagram below. You must use the following sequence to get the HC11 to run the downloaded code: 1. 2. 3. 4. Unplug the serial cable going to the PC. Turn the board off. Turn the board on. Insert the jumper. Try this. Your board should beep! The HC11 is now running the program loaded into its memory. Note to download new code you MUST REMOVE THE JUMPER! http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 12

PROBLEM A Get a switch to control an LED. Your task is to have bit 0 of PORTA (which is an input) control the state of bit 6 of PORTA (which is an output). Set up your hardware by running two wires: 1. From the UML305 dev board SW4 output to pin 8 of the HC11. This is the PORTA, bit 0 digital input. 2. From the UML305 dev board LED1 input to pin 2 of the HC11. This is the PORTA, bit 6 digital output. In the hc11-bootlab code distribution, there is a file named ledsw.s. It contains the following: ;;; ledsw.s ;;; ;;; create a program that tests bit 0 of PORTA: ;;; --> if it's 0, then it should clear bit 6 of PORTA ;;; --> otherwise, it should set bit 6 of PORTA ;;; then the program should loop endlessly doing this..area SYS (ABS).org 0xb600 loop: ldab 0x1000 andb #1 beq clearit setit: ldab 0x1000 orab #0x40 stab 0x1000 bra loop ;;; you do the rest! clearit: To finish the problem, you need to write the code that will clear the bit 6. Then you need to go through the assemble-download-run sequence that was done earlier for the beep example. When it s working, when you press SW4 on the 305DEV board, LED1 should light up. When you release SW4, LED1 should go out. Turn In: The listing file ledsw.lst (include your name in the comments). Demo to TA: You must demonstrate to the TA either this program or the next one working to receive credit for this assignment. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 13

PROBLEM B Get a switch to the beeping. Your task is to have bit 0 of PORTA (which is an input) control the beeping on bit 4 of PORTA (which is an output). Your hardware should already be set up from the previous problem. Use SW4 as the control switch. In the hc11-bootlab code distribution, there is a file named beepsw.s. It contains the following: ;;; beepsw.s ;;; toggles Port A4 with delay loops between each toggle, ;;; creating an oscillation in the audible range..area SYS (ABS).org 0xb600 ;;; modify this program so it only beeps when bit 0 of PORTA ;;; is 1 clra loop: ldab 0x1000 orab #0x10 stab 0x1000 declp1: deca bne declp1 ldab 0x1000 andb #0xef stab 0x1000 declp2: deca bne declp2 bra loop To finish the problem, you need to write the insert code so that the beeping only occurs when bit 0 of PORTA is 1. Turn In: The assembled listing file beepsw.lst (include your name in the comments). Demo to TA: You must demonstrate to the TA either this program or the previous one working to receive credit for this assignment. http://www.cs.uml.edu/~fredm/courses/91.305-fall04/files/hc11-bootlab.pdf page 14