Assignment 3: 68HC11 Beep Lab

Similar documents
Lab #10: Building Output Ports with the 6811

Implementing a Rudimentary Oscilloscope

Tutorial Introduction

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

o The 9S12 has a 16-bit free-running counter to determine the time and event happens, and to make an event happen at a particular time

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Analog to Digital Converter

Experiment # 4 Counters and Logic Analyzer

Lab #11: Building a 1-Bit Input I/O Controller

ECE 3610 MICROPROCESSING SYSTEMS: A SPEECH RECORDER AND PLAYER. Using the Polling I/O Method

TV Synchronism Generation with PIC Microcontroller

Working with a Tektronix TDS 3012B Oscilloscope EE 310: ELECTRONIC CIRCUIT DESIGN I

S op o e p C on o t n rol o s L arni n n i g n g O bj b e j ctiv i e v s

EET 1131 Lab #12 - Page 1 Revised 8/10/2018

imso-104 Manual Revised August 5, 2011

successive approximation register (SAR) Q digital estimate

TV Character Generator

Experiment 13 Sampling and reconstruction

The Micropython Microcontroller

Solutions to Embedded System Design Challenges Part II

Burlington County College INSTRUCTION GUIDE. for the. Hewlett Packard. FUNCTION GENERATOR Model #33120A. and. Tektronix

Experiment 9 Analog/Digital Conversion

Lab experience 1: Introduction to LabView

MP212 Principles of Audio Technology II

Zeroplus Logic Analyzer Multi-LA Stack and LA-Oscilloscope Stack

Integration of Virtual Instrumentation into a Compressed Electricity and Electronic Curriculum

AD9884A Evaluation Kit Documentation

Basic LabVIEW Programming Amit J Nimunkar, Sara Karle, Michele Lorenz, Emily Maslonkowski

M68HC11 Timer. Definition

ECE 2274 Pre-Lab for Experiment Timer Chip

"shell" digital storage oscilloscope (Beta)

TABLE OF CONTENTS. Instructions:

Part No. ENC-LAB01 Users Manual Introduction EncoderLAB

PQ-Box 100 Quick Start Instructions

Laboratory 9 Digital Circuits: Flip Flops, One-Shot, Shift Register, Ripple Counter

imso-104 Manual Revised July 19, 2012

Quick Start. RSHS1000 Series Handheld Digital Oscilloscope

MODULAR DIGITAL ELECTRONICS TRAINING SYSTEM

ME EN 363 ELEMENTARY INSTRUMENTATION Lab: Basic Lab Instruments and Data Acquisition

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

Tutorial Introduction

INTRODUCTION (EE2499_Introduction.doc revised 1/1/18)

Point System (for instructor and TA use only)

CARLETON UNIVERSITY. Facts without theory is trivia. Theory without facts is bull 2607-LRB

Checkpoint 2 Video Interface

Analog Input & Output

TRIMBLE GPS / 10MHz REFERENCE MONITOR DISPLAY V January 2015

A 400MHz Direct Digital Synthesizer with the AD9912

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Digital Signal Processing Laboratory 7: IIR Notch Filters Using the TMS320C6711

SXT SXGA TFT NEMA 4/12 Flat Panel Monitor. User s Guide

STEMSEL LCD Project 8 : Vending Machine MICROCHIP. Figure 1: Inputs and Outputs

Please feel free to download the Demo application software from analogarts.com to help you follow this seminar.

PCIe: EYE DIAGRAM ANALYSIS IN HYPERLYNX

DAAB DB409 INSTRUCTION MANUAL FOR THE VFD-EL FREQUENCY CONVERTER. For the DAAB EP104 automatic control system with software version 4.

Table of Contents Introduction

BME 3512 Biomedical Laboratory Equipment List

EXPERIMENT #6 DIGITAL BASICS

COMP2611: Computer Organization Building Sequential Logics with Logisim

LabView Exercises: Part II

DMC550 Technical Reference

Introduction 1. Green status LED, controlled by output signal ST. Sounder, controlled by output signal Q6. Push switch on input D6

Exercise 2: D-Type Flip-Flop

Tools to Debug Dead Boards

2 MHz Lock-In Amplifier

h c HUNG CHANG D IBM PC 586, Pcntium Software Drive : Windows 95 Dual Clmnel Sampling per channel : 100 MS/s

Dave Jones Design Phone: (607) Lake St., Owego, NY USA

Analog Arts SA985 SA975 SA935 SA915 Product Specifications

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

Analog Arts SA985 SA975 SA935 SA915 Product Specifications [1]

University of Utah Electrical & Computer Engineering Department ECE1050/1060 Oscilloscope

TSIU03: Lab 3 - VGA. Petter Källström, Mario Garrido. September 10, 2018

Electrical and Electronic Laboratory Faculty of Engineering Chulalongkorn University. Cathode-Ray Oscilloscope (CRO)

Arria-V FPGA interface to DAC/ADC Demo

"With the advent of soundcards and digital sound, the speaker has become the poor relation"

Exercise 1-2. Digital Trunk Interface EXERCISE OBJECTIVE

Assignment 2b. ASSIGNMENT 2b. due at the start of class, Wednesday Sept 25.

PDW MARTHEL S.C. ul. Sosnowa 24-5, Bielany Wrocławskie Kobierzyce, POLAND tel , 12; fax MART-02:

Data Conversion and Lab (17.368) Fall Lecture Outline

Copyright 2011 by Enoch Hwang, Ph.D. and Global Specialties. All rights reserved. Printed in Taiwan.

Physics 120 Lab 10 (2018): Flip-flops and Registers

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT /12/14 BIT 10 TO 65 MSPS DUAL ADC

A dedicated data acquisition system for ion velocity measurements of laser produced plasmas

Application Note AN-708 Vibration Measurements with the Vibration Synchronization Module

Laboratory 10. Required Components: Objectives. Introduction. Digital Circuits - Logic and Latching (modified from lab text by Alciatore)

Tutorial 11 ChipscopePro, ISE 10.1 and Xilinx Simulator on the Digilent Spartan-3E board

Using SignalTap II in the Quartus II Software

Computer Systems Architecture

Virtual instruments and introduction to LabView

Using an oscilloscope - The Hameg 203-6

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT /12/14 BIT 10 TO 105 MSPS ADC

1. Abstract. Mixed Signal Oscilloscope Ideal For Debugging Embedded Systems DLM2000 Series

DEPARTMENT OF THE ARMY TECHNICAL BULLETIN CALIBRATION PROCEDURE FOR AUTOMATIC VIDEO CORRECTOR TEKTRONIX, MODEL 1440 (NSN )

Lab 2: A/D, D/A, and Sampling Theorem

EE 367 Lab Part 1: Sequential Logic

SignalTap Plus System Analyzer

What to look for when choosing an oscilloscope

Spectrum Analyser Basics

Meeting Embedded Design Challenges with Mixed Signal Oscilloscopes

Logic Devices for Interfacing, The 8085 MPU Lecture 4

LCD Direct Drive Using HPC

Transcription:

ASSIGNMENT 3: 68HC11 Beep Lab Introduction In this assignment, you will: Analyze the timing of a program that makes a beep, calculating the precise frequency of oscillation. Use an oscilloscope in the lab to measure the oscillation and confirm your analysis. Modify the program to generate a different, specific frequency. Connect a photocell to your HC11, generate tones based on light levels, and analyzing the result. Assignment Summary Following is a synopsis of what you are to turn in for this assignment. A. A written analysis of beep2.s, explaining what frequency it generates and why. B. A screen snapshot from one of the lab oscilloscopes that shows the beep2.s output. C. A program named beep1250.lst that generates 1250 Hz, with comments that indicate how much time is one cycle of 1250 Hz and how many E clocks are consumed generating that cycle. D. Your working lightbeep.lst program that uses a subroutine call to get analog conversions, your measurements of the highest and lowest frequencies it can generate, and an analysis of what analog values these frequencies imply. http://www.cs.uml.edu/~fredm/courses/91.305/files/hc11-beeplab.pdf page 1

PART A COMPUTING BEEP FREQUENCY. From the course web site, download a slightly modified program, named beep2.s. This program creates an oscillation on the Port A4 pin:.area SYS (ABS).org 0xb600 ldx #0x1000 ; setup X to point at PORTA clra ; 0 into accum A loop: bset 0,x,#0b00010000 ; set bit 4 of PORTA declp1: deca ; A = A - 1 bne declp1 ; if not 0, keep at it bclr 0,x,#0b00010000 ; clear bit 4 declp2: deca ; 1st time here, accum A=0 bne declp2 bra loop The program sets up the X register as a pointer to PORTA (address 0x1000) and then uses bit set and bit clear instructions to set and clear the beeper pin. For example, the instruction bset 0,x,#0b00010000 sets the bit indicated at address 0 + X. 91.305 Assignment 3: 68HC11 Beep Lab Note how pleasant it is to use the bit set and bit clear instructions! Each one replaces the 3 instruction sequences used in the previous lab (e.g., ldab 0x1000, orab #0b00010000, stab 0x1000). But, bit set and bit clear need to use the indexed addressing mode (or the direct mode, which won t reach address 0x1000). Hence the use of the X register as an index/pointer. Your task is to analyze this program and determine what is the frequency of the square wave that it generates. In order to do this, you need to know two things: 1. Cycle rate: how fast the does the HC11 system run? 2. Cycles per instruction: How many cycles does each instruction takes to execute? Both of these things are known precisely. Cycle rate. The HC11 has an 8 MHz oscillator. This is internally divided into 4 phases, resulting in a 2 MHz cycle rate (also known as the E clock ). The cycle rate meaning, how much time each cycle takes is then 1/2,000,000 seconds. This is equal to 0.5x10-6 seconds, or 1/2 of a microsecond (µs). Put another way, there are 2 E clock cycles per microsecond. Cycles per instruction. Each HC11 instruction takes a precise number of cycles to execute, usually 2 to 7, depending on the instruction. More complex instructions, or instructions with longer opcode sequences, will take longer to execute. But each instruction executes in a known and http://www.cs.uml.edu/~fredm/courses/91.305/files/hc11-beeplab.pdf page 2

invariant number of cycles. (Note: this deterministic execution time is not a characteristic of modern processors like the Pentium. We ll learn why later in the class.) In the yellow 68HC11 Reference Manual, the Instruction Set table includes the mapping from instructions to cycles. For example, the LDX #0x1000 instruction takes 3 cycles, or 1.5 microseconds, to execute. For this problem, analyze beep2.s and determine the frequency of tone that it generates. Your answer should be a frequency in cycles per second (Hz), along with a justification for how you got it. PART B USE THE OSCILLOSCOPE TO CONFIRM YOUR RESULT. Assemble beep2.s and load it into your board using HC11EELoader. Then bring it into lab and hook it up to the oscilloscope. Find one of the three desks with a sign that says 91.305 WORKSTATION. These desks have oscilloscopes with a CompactFlash card and also a card reader connected to the PC on the desk. Get a scope probe. It should be either already connected to the scope, or in one of the bins above the desk. Now, connect the probe to your circuit as shown above. The black alligator clip wire from the probe goes to your circuit ground. The probe tip clamps to a wire which is then plugged into the signal you want to measure in this case, the piezo signal at the HC11 s pin 4. http://www.cs.uml.edu/~fredm/courses/91.305/files/hc11-beeplab.pdf page 3

Connect your probe to the CH1 (channel 1) input, as in the picture above. Next, turn on the scope. The power button is on the top panel on the left (you can t see it in the picture). After the scope boots up, press the Auto-Set button in the upper left area of the panel. In a few seconds, the screen should stabilize to something like what you can see in the picture above. Information on the scope screen show show the period of the waveform as well as its frequency. Take a screen snap of the waveform generated by the beep2 program and turn it in for Part B of this lab. See the instructions below. Make sure the CompactFlash card is in the scope. It might be in the blue flash reader on the PC; if so, pull it out and put it in the scope. (Look down at the top of the scope, on the right, for the vertical card slot.) When you have the data from the beep2 program on the screen, press the round Print button. This will save the screen to the CompactFlash. You will see a message at the bottom of the screen like Saved to A:\TEK0001.TIF when it s done. Eject the card. (Look down at the top of the scope, on the right, and press the card eject tab). Put the card into the triangular blue flash reader on the adjacent PC. Go into the E: drive, find, open, and print the corresponding file to turn in with your lab. http://www.cs.uml.edu/~fredm/courses/91.305/files/hc11-beeplab.pdf page 4

PART C GENERATING EXACTLY 1250 HZ. Now, re-write the beep2.s program to generate precisely 1250 Hz. Hint: 91.305 Assignment 3: 68HC11 Beep Lab Think about how long in time is one cycle of 1250 Hz. Determine how many E clock cycles fit into that much time. Then write your code to consume that many cycles. Name your program beep1250.s. Assemble it and download it into your board. Turn in your listing file beep1250.lst. The comments should include: your name how long in time is one cycle of 1250 Hz. how many E clock cycles make up that much time. PART D USING THE PHOTOCELL READING TO GENERATE VARYING TONES. In this section, you will connect a photocell to the HC11, and use a provided subroutine to read its value. Then you ll use this value as the basis for the delay loop, thereby generating tones that vary based on light readings. First, the photocell circuit has to be constructed. The photocell is wired in a voltage divider circuit as shown. The diagram on the left is the electrical schematic; on the right is a visual wiring guide. pin 17 The voltage divider generates an output voltage that is a function of the ratio of the two resistances in the legs of the converter. In this instance, the photocell is in the upper leg. Its resistance decreases with increasing light, causing a higher voltage result in this case. Conversion Subroutine The code below, from the file analog.s, is a subroutine that will exercise the HC11 s analog-to- http://www.cs.uml.edu/~fredm/courses/91.305/files/hc11-beeplab.pdf page 5

digital converter and make a conversion of the channel 0 input. It returns the result as a value from 0 to 255 in the A register. The core functionality in the following code snippet: bset <OPTION,X,#0x80 ; set high bit of option -> turn on A/Ds loop: ldaa #0 ; select channel 0 staa ADCTL ; start conversion donelp: ldaa ADCTL bpl donelp ; if high bit set, it's done ldaa ADR1 ; grab result! Installing the Subroutine The subroutine is targeted at address 0xb700 of the HC11 s memory. Assemble and download the analog.s code into your HC11. Now, your code can call the subroutine simply by executing the command jsr 0xb700 to retrieve the converted value into the A accumulator. The lightbeep.s Starter Code Your task: modify the lightbeep.s code to generate tones based on how much light the photocell receives. You should call the analog subroutine to retrieve the analog value in accumulator A. Then use that value as the basis of the delay loop for each half of the waveform. Please note: you must initialize the stack pointer register (SP) to an area of HC11 RAM before using the jsr (jump-to-subroutine) instruction! In the HC11, the stack builds down toward low memory from high. RAM on the E1 chip goes from 0x00 to 0x1FF, so you should initialize the stack to 0x1FF, using the following at the top of your code: lds #0x1FF Analyzing the Result After you have it working, perform the analysis with the oscilloscope: 1. What is the lowest frequency you can generate? You ll need to connect your circuit to the scope to measure. 2. What analog value does this correspond to? Based on cycle-counting your code, what analog value would generate this frequency? Assume that the analog conversion subroutine takes a fixed 30 µs (0.00003 sec, or 3 x 10-5 sec) to execute. 3. What is the highest frequency you can generate? Measure your highest frequency. 4. What analog value does this correspond to? Do a similar analysis on this. 5. Turn in your final lightbeep.lst program. http://www.cs.uml.edu/~fredm/courses/91.305/files/hc11-beeplab.pdf page 6