Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fundamentals of Computer Engineering

Similar presentations


Presentation on theme: "Fundamentals of Computer Engineering"— Presentation transcript:

1 Fundamentals of Computer Engineering
Lab # EGR 270 – Fundamentals of Computer Engineering EGR 270 Fundamentals of Computer Engineering Presentation for Lab #8 Introduction to the MicroStamp11 and 68HC11 Assembly Language Programming Instructor: Paul Gordy Office: H-115 Phone:

2 Lab #8 EGR 270 – Fundamentals of Computer Engineering
MicroStamp11 The MicroStamp11 is a microcontroller or microprocessor. It is built by Technological Arts and is based on the Motorola 68HC11 microcontroller. Technological Arts states that the MicroStamp11 is the world’s smallest microcontroller module. The MicroStamp11 is about the size of a postage stamp!

3 USB-to-MCU Interface Module
Lab # EGR 270 – Fundamentals of Computer Engineering MicroStamp11 Breadboard Setup The MicroStamp 11 is easily used on a breadboard with two modules: MicroStamp11 Module – fitted with a 20-pin connector that plugs into a breadboard USB-to-MCU Interface Module – allows for serial communication using a USB port on a computer. The USB connection can also be used to provide power (5V) to the breadboard. A few wires are required as shown below. MicroStamp11 Module USB-to-MCU Interface Module

4 Lab #8 EGR 270 – Fundamentals of Computer Engineering
MicroStamp11 Features (reference:

5 The MicroStamp11 used in EGR 262 is the Turbo version with 32k of ROM
Lab # EGR 270 – Fundamentals of Computer Engineering Memory There are two types of memory: ROM (Read-Only Memory) – used to store permanent programs and data. Data stored in ROM is not erased when the MicroStamp11 is powered down, so programs that you save will still be in memory the next time you use the device. The MicroStamp11 has either 8k, 32k, or 64k of ROM, depending on the version of the MicroStamp11 purchased. RAM (Random Access Memory) – used as a scratchpad to store variables during the execution of a program. Data stored in RAM is lost when the MicroStamp11 is powered down. The MicroStamp11 has only 256 bytes of RAM. Clock and Data Transfer Rate The MicroStamp11 is a digital synchronous device, meaning that all instructions are executed in synchronization with a hardware clock. The MicroStamp11 is available with either 8MHz or MHz (Turbo version) clock. Data can be transferred to the MicroStamp11 via the serial cable at either 9600 baud (bytes/second) or baud (Turbo version). The MicroStamp11 used in EGR 262 is the Turbo version with 32k of ROM

6 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Power Source The 68HC11 is powered by a 5V DC source. If a voltage of greater than 5V was connected to the microcontroller, it might be destroyed. The MicroStamp11 has a voltage regulator on the board to protect it. Operational Modes (sliding switches) The MicroStamp11 has two modes of operation. The modes are selecting by using the sliding switches on the side of the MicroStamp11 module. The modes are: Boot mode – used when programs are downloaded to the MicroStamp11. Slide the two switches together to place the MicroStamp11 in boot mode. Run mode – used when programs are run by the MicroStamp11. Slide the two switches apart to place the MicroStamp11 in run mode.

7 Lab #8 EGR 270 – Fundamentals of Computer Engineering
MicroStamp11 Module Slide switches used to put the MicroStamp11 into boot mode or run mode 68HC11 microcontroller 5V regulator Crystal - 8MHz or MHz (looks like a silver cylinder) 20 pins connected to the breadboard via the ribbon cable Assembler and Simulator We will program the MicroStamp11 using 68HC11 assembly language. Refer to class notes for details on assembly language programming. We will assemble programs using the Mini IDE assembler. We can also simulator programs using the Wookie simulator. Refer to the handout “Example: Mini IDE Assembler and Wookie Simulator” available on the instructor’s web page.

8 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Downloader A program named MicroLoad is provided with the MicroStamp11 in order to download compiled C programs (S19 files) into the MicroStamp11.

9 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Input/Output Ports on the MicroStamp11 The majority of the pins on the MicroStamp11 (see diagram below) are used for input and output so that we can communicate with the microcontroller. The input/output pins are arranged into two ports with the names: PORTA (8 pins: PA0 through PA7 corresponding to pins 1-8) PORTD (6 pins: PD0 through PD5 corresponding to pins 15-20)

10 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Logical Value and Direction The pins on each port have two distinct states: Logical State Logical 0 or LOW (0V) Logical 1 or HIGH (5V) Direction (the pin might be used as an input or as an output) IN (0) OUT (1) If a pin is configured as an output, then it acts like a 0V or 5V source (depending on the logical state) that can be applied to external circuits or devices connected to the pin. If a pin is configured as an input, then it acts like a HIGH resistance load and the MicroStamp11 can read the logical state of the pin applied by external circuits or devices connected to the pin.

11 Direction controlled by Bi-directional (input or output)
Lab # EGR 270 – Fundamentals of Computer Engineering PORTD PORTD is a bi-directional register, so each pin may be configured as an input or as an output. The direction is controlled by the direction register DDRD. Hardware Pin PORTD bit Direction Direction controlled by 20 PD0 Bi-directional (input or output) Bit 0 of DDRD 19 PD1 Bit 1 of DDRD 18 PD2 Bit 2 of DDRD 17 PD3 Bit 3 of DDRD 16 PD4 Bit 4 of DDRD 15 PD5 Bit 5 of DDRD Example: DDRD (bit5 … bit0): 1 PORTD (bit5 … bit0): Result: PD0, PD1, PD3 & PD4 are inputs. PD2 & PD5 are outputs. PORTD and DDRD Addresses (see Table 4-1): In assembly language, we can set or clear bits in DDRD and PORTD by storing values at their memory addresses. For the MicroStamp11: PORTD address: $0008 DDRD address: $0009

12 Direction controlled by Bi-directional (input or output)
Lab # EGR 270 – Fundamentals of Computer Engineering PORTA PORTA has only two pins (PA3 and PA7) that are bi-directional. It also has three pins (PA0-PA2) that are always configured as inputs and three pins (PA5-PA7) that are always configured as outputs. Two bits in the hardware control register PACTL are used to control the direction of PA3 and PA7. Hardware Pin PORTA bit Direction Direction controlled by 6 PA0 Input only - - - 7 PA1 8 PA2 5 PA3 Bi-directional (input or output) Bit 3 of PACTL 4 PA4 Output only 3 PA5 2 PA6 1 PA7 Bit 7 of PACTL Example: PACTL (bit7 … bit0): - 1 PORTA (bit7 … bit0): Result: PA7: set as an input. PA4-PA6: always outputs. PA3: set as an output. PA0-PA2: always inputs. PORTA and PACTL Addresses (see Table 4-1): PORTA address: $0000 PACTL address: $0026

13 Table 4-1: Register and Control Bit Assignments (reference: MC68HC11D3
Table 4-1: Register and Control Bit Assignments (reference: MC68HC11D3.pdf) The table below is used to determine memory address and bit positions for various 68HC11 registers. Some key items are highlighted.

14 Table 4-1: Register and Control Bit Assignments (continued)

15 Table 4-1: Register and Control Bit Assignments (continued)

16 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Example: Set PD2 (Perhaps to turn ON an LED connected to pin 18 on the MicroStamp11). Note that the memory addresses for PORTD and DDRD from Table 4-1 are used. LDAA #$04 ;Set the direction of PD2 to output (i.e., DDRD bit 2 = 1) * ; (Note that this also configures all other PORTD pins as inputs) STAA $09 ;Store value at address for DDRD ($09) LDAA #$04 ;Set the value of PD2 to 1 (HIGH) STAA $08 ;Store value at address for PORTD ($08) MicroStamp11 1 20 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 PD0 PD1 PD2 PD3 PD4 PD5 + _ 5V LED lights Equivalent to

17 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Memory When working with microcontrollers and their limited memory, it is important to be aware what memory addresses are available for: 68HC11 registers Storing data Storing programs A memory map is often used to illustrate different sections of memory. Different microcontrollers have different amounts of memory. Note that some memory addresses are used to access RAM and others are used to access ROM. RAM (Random Access Memory) Used for temporary storage of program data and register contents This information is lost when power is turned off to the MicroStamp11 Most MicroStamp11’s have only 256 bytes of ROM, although the 64K Max MicroStamp11 is available with an additional 32kB of external RAM. ROM (Read-Only Memory) or EEPROM (Electrically Erasable Programmable ROM) Used to store programs (i.e., S19 files that are downloaded). This information is NOT lost when power is turned off to the MicroStamp11 The MicroStamp11 is available with 8kB, 32kB, or 64kB of EEPROM. The MicroStamp11’s to be used in lab have 32kB of EEPROM.

18 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Memory Map for the MicroStamp11 (32k Turbo) 32kB EEPROM ($8000 to $FFFF) 32kB External RAM ($0100 to $7FFF) (64k MAX version only) (unused in other versions) 192 bytes Internal RAM ($0040 to $00FF) 64 bytes Internal Register Block ($0000 to $003F) $FFFF $8000 $7FFF $0100 $00FF $0040 $003F $0000 Used to store programs (S19 files) (Ex: Begin a program with ORG $8000) Extra RAM for data storage (Not available with our MicroStamp11) Used to store data (Ex: STAA $ ;Save count Used for register contents (Ex: LDAA #$04 STAA $09 ; Set PD2 as an output)

19 Lab #8 EGR 270 – Fundamentals of Computer Engineering
MicroStamp11 Sample Program #1 – Turn on an LED connected to PA6: Note that classroom examples often ignore some of the practical issues that must be covered in lab, such as knowing specific memory addresses for a given microcontroller, setting reset vectors, etc. Discuss the example below in detail.

20 Lab #8 EGR 270 – Fundamentals of Computer Engineering
MicroStamp11 Sample Program #2 – Blink an LED connected to PA6 on and off:

21 Lab #8 EGR 270 – Fundamentals of Computer Engineering
7-segment displays A 7-segment display is made up of seven LED’s configured to display the decimal digits 0 through 9. There are two types of 7-segment displays: 1) common anode (all anodes at +5V) 2) common cathode (all cathodes at ground) Common cathode displays Common cathode displays require active-HIGH outputs. When the output of the decoder or MicroStamp11 is HIGH for one segment, 5V is connected to the anode. Since all cathodes are grounded, the segment lights. a b c d e f g Common - cathode 7 segment display 7-segment decoder/driver IC or MicroStamp11 anode Typical segment

22 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Common anode displays Common anode displays require active-LOW outputs. When the output of the decoder or MicroStamp11 is LOW for one segment, 0V is connected to the cathode. Since all anodes are connected to 5V, the segment lights. a b c d e f g Common - anode 7 segment display cathode Typical segment +5V 7-segment decoder/driver IC or MicroStamp11 A “bubble” is sometimes used to indicate an active-LOW output

23 Lab #8 EGR 270 – Fundamentals of Computer Engineering
Common-anode 7-segment display Lab # EGR 270 – Fundamentals of Computer Engineering Truth table for common anode displays For a common anode display: (0 – segment ON, 1 – segment OFF) Fill out the binary value for each segment Determine the corresponding values for PORTD and PORTA Digit a PD0 b PD1 c PD2 d PD3 e PD4 f PD5 g PA6 PORTD (binary) PORTD (hex) PORTA (binary) PORTA (hex) 1 $00 $40 2 3 4 5 6 7 8 9

24 Lab #8 EGR 270 – Fundamentals of Computer Engineering
The primary tasks in Lab #8 are: Program #1: Connect a current-limiting resistor and an LED to PA6. Enter, assemble, download, and run MicroStamp11 Sample Program #2 (shown earlier in this presentation) which will cause the LED connect to PA6 to blink on and off. Program #2: Connect a common-anode 7-segment display (with 7 current-limiting resistors) to the outputs PD0-PD5 and PA6 as illustrated below. Write a program to count out the digits of your SSN or EmplID in a continuous loop with about a 1 second delay between counts. See next page for more details. a b c d e f g Common-anode 7-segment display (see data sheet for pinout) MicroStamp11 32k Turbo 1 20 2 3 4 5 6 7 8 9 10 19 18 17 16 15 14 13 12 11 PD0 PA6 220  +5V PD1 PD2 PD3 PD4 PD5 (Discuss the details of Program #2 in lab)


Download ppt "Fundamentals of Computer Engineering"

Similar presentations


Ads by Google