EE 357 Lab 1 Some Assembly Required

Similar documents
(Embedded) Systems Programming Overview

Codewarrior for ColdFire (Eclipse) 10.0 Setup

LAB #1: The CSM12C32 Module and PBMCUSLK Project Board

Last Time. Compiler requirements C preprocessor Volatile

ECE 362 Experiment 3: General Purpose I/O

ECE383: Microcomputers Lab 6 Basic and Finite State Machine LED and Switch I/O Programming

EE 101 Lab 5 Fast Adders

ECE372 CodeWarrior Simulator Andreou/Michaelides

Addressing Modes. To review data transfer instructions and applying the more advanced addressing modes.

The Alarm System: The alarm system to be designed has the following inputs.

ONE AVR D EVELOPMENT SECTION I NTRODUCTION TO NTRODUCTION TO AVR EVELOPMENT TOOLS. Section One: Introduction to AVR Development Tools

M16C/62P QSK QSK62P Plus Tutorial 1. Software Development Process using HEW4

538 Lecture Notes Week 1

C Programming in Atmel Studio 7 Step by Step Tutorial

EECS 100/43 Lab 9 PIC Input-Output (I/O)

EE475 Lab #3 Fall Memory Placement and Interrupts

Assignment 1 Board Configuration, Compiling, Debugging, and Executable Files CSE 325, Fall 2010

SEE 3223 Microprocessors. 4: Addressing Modes. Muhammad Mun im Ahmad Zabidi

Assembler Directives and Programming

Mechatronics Laboratory Assignment #1 Programming a Digital Signal Processor and the TI OMAPL138 DSP/ARM

CEIBO FE-5111 Development System

Embedded Systems. 2. Software Development. Lothar Thiele. Computer Engineering and Networks Laboratory

ECE 3120 Lab 1 Code Entry, Assembly, and Execution

Mark Redekopp, All rights reserved. EE 357 Unit 5. Assembler Directives and Programming

SKP16C26 Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

STM32L100C-Discovery Board Projects

Quick Start Guide for TWR-S08LL64 TOWER SYSTEM MC9S08LL64. S08 ultra-low-power LCD segment MCU

Installing and using CW 10.x for TPMS applications. Revision 5

Controller Continuum. for Microcontrollers V6.3. Quick Start

Tools Basics. Getting Started with Renesas Development Tools R8C/3LX Family

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Metrowerks CodeWarrior IDE 5.5 Tutorial

Last Time. Low-level parts of the toolchain for embedded systems. Any weak link in the toolchain will hinder development

Something Cool. RFID is an exciting and growing. This reader from Parallax is $40 and has a serial interface

YOUR NAME EE 310 LAB 5 3/21/2017 Instructor Name. TITLE: GENERATING 5kHz WAVEFORM, FSK MODULATION, AND BINARY COUNTER

Page 1. Lab. Something Cool. Quiz Results. Last Time. Embedded Compilers. Today: Intro to Embedded C

User's Manual Rev. 1. Freescale Semiconductor Inc. TWRS08UNIVUM

ECE 3120 Fall 2013 Lab 1 Code Entry, Assembly, and Execution

Part I. "Hello, world"

Subroutines. passing data

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

I/O handling. Purpose. Seven-segment displays. Digital Systems 15 hp

Lab Guide Rev. 1.1 TWRWIFIAR4100LAB

EECS 461 Winter 2009 Lab 1: Familiarization and Digital I/O

Quick Start Guide TWR-S08PT60. 5-Volt S08P Family of 8-bit MCUs for Industrial and Appliance Applications TOWER SYSTEM

How to use CodeWarrior ASM with Adapt9S12 and Serial Monitor.doc

Laboratory 2(b): Configuring an ADC with MicroBlaze. Authors: Trung N. Tran (National Instruments) Jeff C. Jensen (National Instruments)

CUDA Development Using NVIDIA Nsight, Eclipse Edition. David Goodwin

EE 352 Lab 3 The Search Is On

UM LPC General Purpose Shield (OM13082) Rev November Document information. Keywords

ECE3120: Computer Systems Hardware & Software Development Tools

Getting Started with the Texas Instruments ez430

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

ME 4447/ME Microprocessor Control of Manufacturing Systems/ Introduction to Mechatronics. Instructor: Professor Charles Ume

NEW CEIBO DEBUGGER. Menus and Commands

EE 231 Fall EE 231 Lab 3. Decoders and Multiplexers. Figure 1: 7-Segment Display. Memory: where the program is stored.

CEIBO FE-51RD2 Development System

DS-XA In-Circuit Emulator

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

TWR-K60F120M Quick Start Guide

Real Time Embedded Systems. Lecture 1 January 17, 2012

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports

Submit this lab and the extended learning (optional) to TEACH by Monday at 11:59pm. You must get checked off by a TA by the beginning of lab 7.

538 Lecture Notes Week 5

ECE 353 Lab 4. General MIDI Explorer. Professor Daniel Holcomb Fall 2015

ECE 362 Lab Verification / Evaluation Form Experiment 3

Assembly Programming in Atmel Studio 7 Step by Step Tutorial

Lab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011

Pre-Lab due: at 3 p.m. Post-Lab due: at 5 p.m. Name:... Forename:... Initials:...

538 Lecture Notes Week 5

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

cs281: Introduction to Computer Systems Lab03 K-Map Simplification for an LED-based Circuit Decimal Input LED Result LED3 LED2 LED1 LED3 LED2 1, 2

Freescale Semiconductor Inc. TWR-MCF51CN User Manual Rev. 1.2

EE 231 Fall Lab 2: Decoders and Multiplexers. Introduction

EVBQE128. Evaluation Board for Freescale Flexis QE128. User s Manual

More Programming with CUPL

Multiplies the word length <ea> times the least significant word in Dn. The result is a long word.

Digital I/O Operations

ELEG3924 Microprocessor

Freescale Semiconductor Inc. Microcontroller Solutions Group. TWR-MCF51CN User Manual Rev. 1.1

Hibernation Module. Introduction. Agenda

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Installing and using CW 10.6 for TPMS applications. Revision 4

STM32 Ecosystem Workshop. T.O.M.A.S Team

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

Microprocessors B (17.384) Spring Lecture Outline

A Quickie Introduction to the Windows Based 68K Assembler EASy68K

SILICA TUSA Silica Tusa Board

Microbee Technology FTM-3SE

Subroutines and the Stack

Lab 1 MC9S12 Assembler and Monitor

Quick Start Guide. S12VR64EVB S12 MagniV Mixed-Signal MCUs. S12 MagniV

MSP430 Interface to LMP91000 Code Library

Lab #4: GPIOs in Assembly Language Week of 18 February 2019

User Manual Rev. 0. Freescale Semiconductor Inc. FRDMKL02ZUM

Program Development. Chapter 5

ECE 362 Experiment 4: Interrupts

Lab 1 MC9S12 Assembler and Monitor

EE 109 Lab 8a Conversion Experience

Transcription:

EE 357 Lab ome Assembly Required Introduction In this lab you will write assembly code to control the 4 s on your MCF55259 board as well as read the input values of the 4 DIP switches. 2 hat you will learn This lab is intended to teach you to use the Codewarrior Eclipse IDE to write assembly code and then use the integrated debugger to test your code. In addition, you will learn the basics of using your microcontroller s I/O pins as digital inputs and outputs (termed General Purpose I/O, or GPIO for short). 3 Background Information and Notes Codewarrior Eclipse IDE: Please read the Codewarrior Eclipse 0. etup document on Blackboard and walk through the process of creating a new project, compiling/building the project, and then downloading/debugging it on your board before attempting this lab. It will provide direction for how to use the Eclipse IDE to write, compile, and debug software programs. General Purpose I/O: The general purpose I/O module of the MCF52259 allows you to use almost any I/O pin as either a digital input or output where you can read from or write the value of the I/O pin via software control. However, most I/O pins can be used for several alternative functions only one of which is GPIO (i.e. a pin may be used as an Analog to Digital converter, as a UB input, or as GPIO). Thus, some initialization code may be required before an I/O pin can be used for this purpose. I/O pins are grouped into ports based on common functionality. Refer to the Coldfire 5225x Reference Manual chapter 5 (and Figure 5- for alternative pin functions). These ports can be controlled in a single access or on a bit by bit basis. The MCF52259 on-board I/O functions (2 Pushbuttons, 4 DIP switches, 4 s, 3-axis accelerometer and a potentiometer) are mapped to the following ports. Last Revised: /9/202

I/O Function GPIO Port Notes PushButton - TA[0] Produces 0 when PushButton - 3 TA[] Pressed (there is no 2) 0 DIP witches 4 downto DD[7:4] Produces 0 when in the ON position 4 downto TC[3:0] Light is ON when a is written Accelerometer X-Axis AN[0] Accelerometer Y-Axis AN[] Accelerometer Z-Axis AN[2] Potentiometer AN[3] Table MCF52259 OnBoard I/O Connections To control an I/O pin we must follow the procedure outlined below:. Initialize the port s Pin Assignment Register (PxxPAR) to indicate that the pins should be used for GPIO vs. there alternate functions. Usually writing a value of all 0 s indicates GPIO. 2. Initialize the port s Data Direction Register (xx) to select whether the pins should be used as inputs (write a 0 to the appropriate bit in the Px) or outputs (write a to the appropriate bit in the Pxx) 3. e are now ready to use the I/O pins as outputs or inputs: a. If the pins of the port are to be used as outputs, we can simply write a value to the xx register which will then drive the actual I/O pins with the given value. b. If the pins of the port are to be used as inputs, we can now read from the xx register address to sample the current value of I/O pin. Register PxxPAR (Port Assignment Register): xx (Data Direction Register): xx xx (Pin Data/et Register) Description The value in this register configures the I/O pin for GPIO or one of its alternate functions. Usually a PxPAR value of 0 s indicate GPIO. The value in this register configures the I/O pin to be an input or output. The value in this register stores the output value of the I/O pin if x is enabled (logic ). A read of this address returns the current state of the I/O pin. Table 2 GPIO Control Ports 2 Last Revised: /9/202

The addresses for the pertinent I/O control registers are shown below along with the bit values and connections. By using simple MOVE instructions we can deposit the necessary initialization values to appropriate registers are read the value of a register/pin inputs by simply moving a value from its address. PTCPAR3 PTCPAR2 PTCPAR PTCPAR @ 0x400 006F TC3 TC3 TC2 TC2 PTCPAR0 TC @ 0x400 0027 TC TC0 TC @ 0x400 000F TC TC0 PAR7 DD7 DD3 DD2 DD DD0 DD7 PAR6 DD6 DD6 PAR5 PAR @ 0x400 0074 DD5 DD @ 0x400 002C DD5 PAR4 DD4 DD4 PAR3 DD3 PAR2 DD2 PAR DD PAR0 DD0 DD @ 0x400 0044 4 3 2 Vcc 4 3 2 0K ohm Figure - I/O Control Registers and their addresses Important: The L 4-bits of PAR and DD are used for the debugger s operation and MUT REMAIN PROGRAMMED to s. Blocks of Assembly in C: Most C compilers allow the programmer to embed assembly code sequences inside a C function by using an asm { } block. int main(void) { int counter = 0; asm { } move.l #0,d0... 4 Prelab None Last Revised: /9/202 3

5 Procedure. Create a new project (call it ee357_lab_io_assem ). 2. Open main.c and add the following asm{} block of code before the for loop. You will need to fill in the appropriate addresses and values. This code will output a 4-bit binary number to the s (TC), then increments the 4-bit binary number on the s and repeats (infinitely). asm { move.l #,d0 move.b d0,0x400006f // set PTCPAR for GPIO on all 4 bits move.l #,d0 move.b d0,0x4000027 // set TC to make PTCPAR[3:0] outputs move.l #0,d0 move.b d0, // set TC to all 0 s (i.e. s off) clr.l d L: addq.l #,d andi.l #0x0f,d move.b d,0x400000f bra L } 3. Build the project and then start the debugger. Use the tep Over button to walk through your code and ensure it is working. You can view the value of specific registers in the registers tab of the variable watch pane. 4. Now that you have some idea of how to output to the s, we will modify our program to include input from the 4 DIP switches. Go back and modify your code to produce a program that: a. Adds initialization of the appropriate I/O control registers so that you can use the 4 DIP switches on port DD as inputs. Important: Recall that the L 4-bits of PAR and DD are used for the debugger s operation and MUT REMAIN PROGRAMMED to s. b. Keeps the infinite loop but rather than simply incrementing the 4-bit number displayed on the s, reads the current values of the 4 DIP switches and displays it on the corresponding s. Because of how the 4 DIP switches are connected, placing the switch in the ON position actually produces a 0 as input. hile we can t change that, write your software such that placing the ITCH x in the ON position will actually cause x to light up (turn on). Important: Note that the DIP switch inputs are connected to the most significant 4 bits of Port DD while the s are connected to the least significant 4 bits of Port TC. You will need deal with this incongruence by writing appropriate code. 5. At the beginning of next discussion turn in a print your working program (main.c), your TA s signature for a successful demo your code (if necessary at the beginning of next discussion), and answer the following review question(s). 4 Last Revised: /9/202

6 Review. TA ign-off of orking Code: 2. If we wanted to convert all the absolute address references used to read/write control registers to use A.R.I with Displacement Mode. Assume we include an instruction: MOVE.L #0x4000000,A at the start of our asm block. On your hard copy printout of main.c, show updated instructions using the ARI with displacement mode next to each instruction that uses an absolute address to access an I/O register. Last Revised: /9/202 5

tudent Name: Item Outcome core Max. Register Init: Correct Initialization of PAR Registers Correct Initialization of Registers Yes / No Yes / No orking Demo Yes / No 5 Displacement Mode Modification (3 = All correct, 2 = partially correct, = Mostly incorrect, 0 = Missing) 3 Late Deductions ( pt. per day) Open Ended Comments: ubtotal 0 Total 0 6 Last Revised: /9/202