Lab 3e LCD Alarm Clock

Similar documents
Lab 3c Performance Debugging Page 3c.1

Lab 13 Real Time Debugging

EE345L Fall 2007 December 14, 2007, 9am-12 Version 1 Page 1 of 8

FPGA Interfacing of HD44780 Based LCD Using Delayed Finite State Machine (FSM)

EE445L Fall 2010 Final Version A Page 1 of 10

melabs Serial LCD Firmware Version 1.1 3/5/07

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

melabs Serial LCD Firmware Version 1.0 2/7/07

LABORATORY MANUAL Interfacing LCD 16x2, Keypad 4x4 and 7Segment Display to PIC18F4580

Interrupt and Timer ISRs. Student's name & ID: Partner's name(s) & ID(s): Your Section number & TA's name

Laboratory 10. Programming a PIC Microcontroller - Part II

Lab Overview. Lab Details. ECEN 4613/5613 Embedded System Design Week #7 Spring 2005 Lab #4 2/23/2005

Keywords Digital IC tester, Microcontroller AT89S52

DEV-1 HamStack Development Board

LMB202DBC LCD Module User Manual

School of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time:

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

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

NCSU - ECE 306- Exam 2 March 27, 2003

Product Information. Features. Table of Contents EA DIP162 DN3LW EA DIP162 DHNLED EA DIP162 DNLED EA DIP162J DN3LW

Lab 5: LCD and A/D: Digital Voltmeter

Chapter Operation Pinout Operation 35

Standard Instructions Special Instructions High-Speed Instructions SIMATIC S7-200 Programmable Controller System Manual

Lab 5: LCD and A/D: Digital Voltmeter

The Freescale MC908JL16 Microcontroller

CHAPTER 5. Voltage Regulator

Rear Distance Detection with Ultrasonic Sensors Project Report

AXE033 SERIAL/I2C LCD & CLOCK

180 Series Keypad. Handbook. Revision 2.1

A 3-SPEED STEPPER MOTOR

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

12V. time V 12. time. V 2 Switch. time. G S V GS > constant turns on MOSFET. EE445M/EE380L Final Exam Spring 2014 Page 1 of 8

Professional Development Board (#28138)

ECE 271 Microcomputer Architecture and Applications University of Maine

Supply voltage. Input current. Encoder supply. Memory

ECE383: Microprocessors Lab 9 Analog-to-Digital and Digital-to-Analog Conversion with I 2 C Serial EEPROM Data Storage

Lab 8 RS232 October 22, 2015

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

Exclusive 2.5 GHz Frequency Counter

Lab #2: Building the System

Supply voltage. Input current. Encoder supply. Memory SIMATIC S7-200, CPU 221 COMPACT UNIT, DC POWER SUPPLY 6 DI DC/4 DO DC, 4 KB CODE/2 KB DATA,

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

BASIC Stamp Activity Board: Features and Specifications

Assembly Instructions CT-E Screen Read Board

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

PAK-XI PS/2 Coprocessor Data Sheet by AWC

Lab 9: On-Board Time Generation and Interrupts

Introduction to the SX Microcontroller

Embedded Systems and Software. LCD Displays

ENGR 40M Project 3c: Switch debouncing

Problem Score 1 / 10 2 / 26 3A / 10 3B / 12 3C / 6 4 / code check off / 22 /2 Total /100

1.6. Counters, Panel Meters, Tachometers and Timers. Contents Description Fusion Integrated Machine Control Standards and Certifications...

SLCD1-IC Serial LCD Processor

EE445L Fall 2018 Final EID: Page 1 of 7

Owner s Manual. 1833, 1834, 1835, 1837 PC Programmable Telephone Entry and Access Control Systems

Parallel Display Specifications Revision 1.0

WARNING: Do not use the thermometer/data logger before you read the users manual and the following instructions.

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

The Atmel ATmega328P Microcontroller

Robotic Systems ECE 401RB Fall 2006

中显液晶 技术资料 中显控制器使用说明书 2009年3月15日 北京市海淀区中关村大街32号和盛大厦811室 电话 86 010 52926620 传真 86 010 52926621 企业网站.zxlcd.com

MCS-51 Serial Port A T 8 9 C 5 2 1

1:N REDUNDANT SWITCHING UNIT REMOTE CONTROL TERMINAL

Pretest Programmable Logic Controllers. Unit 1, Task 1

AN10210 Using the Philips 87LPC76x microcontroller as a remote control transmitter

EE345M Summer 2000 Quiz 1 Page 1 of 6. Reset Out. Cont

Reading Spartan-3A Device DNA

Electronics Construction Manual

PSoC Designer Quick Start Guide

ENEE245 Digital Circuits and Systems Lab Manual

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

DS1676 Total Elapsed Time Recorder, Erasable

The PedalSync Master Control Development Board sends Program Change, Clock, and SelfProgramming commands to other PedalSync devices.

ENEE245 Digital Circuits and Systems Lab Manual

Sierra Radio Systems. HamStack. Project Board Reference Manual V1.0

538 Lecture Notes Week 5

DS 1682 Total Elapsed Time Recorder with Alarm

Copyright 2011 R.S.R. Electronics, Inc. All rights reserved. 04/11. Ver. 1.0web

Introduction to Embedded Microcomputer Systems Lecture Synchronizing with an input device. Busy-Wait. Empty Fifo. Busy Status.

Lost Item Pager. Project Description. Russ Kinley

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

CMB16D. 16 Channel DC Controller. User Manual May 25, 2008 V1.01 Copyright Light O Rama, Inc. 2007, 2008 CMB16D. Table of Contents

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

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

External and Flash Memory

538 Lecture Notes Week 5

3. (a) Explain the steps involved in the Interfacing of an I/O device (b) Explain various methods of interfacing of I/O devices.

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

JUL. 27, 2001 Version 1.0

PROGRAMMING AND CUSTOMIZING

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

WTDIO-M. eeder. Digital I/O Module. Technologies FEATURES SPECIFICATIONS DESCRIPTION. Weeder Technologies

Two-wire. Jumper for 12V. J2 Enable Adjust D/A1. Super PLC Warning: Warranty Void if this label is damaged 62256LP-12 CMOS RAM 4.

MULTI-PURPOSE SELF-CONTAINED DIGITAL ACCESS CONTROL KEYPAD

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Lab Test III

AVRminiV3.1 Manual. 1. AVRminiV3.1 Overview. 2. AVRminiV3.1 Features and Specifications Standard Features: 2.2. Optional Features:

Finite State Machine Lab

Transcription:

Lab 3e Alarm Clock Page 3e.1 Lab 3e Alarm Clock This laboratory assignment accompanies the book, Embedded Microcomputer Systems: Real Time Interfacing, Second edition, by, published by Thomson, copyright 2006. Goals Review Starter files Optimize an existing /software between a display and a microcomputer, Design a /software between three switches and a microcomputer, Design a /software for generating single tones on a, Implement a digital alarm clock. Valvano Chapter 3 on Basic Handshake Mechanisms, Valvano Section 8.3 on fundamentals, Valvano Section 2.7 on device s. hd44780.pdf and.pdf data sheets RTI and projects Background Microprocessor controlled displays are widely used having replaced most of their LED counterparts, because of their low power and flexible display graphics. This experiment will illustrate how a handshaked parallel port of the microcomputer will be used to output to the display. The for the display uses an industry standard HD44780 controller. The low-level software initializes and outputs to the HD44780 controller. Because the 9S12C32 has so few I/O pins, you will implement the 4-bit data. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Figure 3.1. 1 by 16 display. Vss (ground) Vdd (+5V power) Vlc (0 to +5 contrast adjustment) RS (0=instruction, 1=data) R/W (0=write to, 1=read from ) E (enable) DB0 (data bit 0) DB1 (data bit 1) DB2 (data bit 2) DB3 (data bit 3) DB4 (data bit 4) DB5 (data bit 5) DB6 (data bit 6) DB7 (data bit 7) HD44780 controller display There are four types of access cycles to the HD44780 depending on RS and R/W RS R/W Cycle 0 0 Write to Instruction Register 0 1 Read Busy Flag (bit 7) 1 0 Write data from µp to the HD44780 1 1 Read data from HD44780 to the µp Two types of synchronization can be used with the, blind cycle and gadfly. Most operations require 40 µs to complete while some require 1.64 ms. The example implementation shown in the project uses TCNT to create the blind cycle wait. YOU ARE REQUIRED TO DEVELOP SOFTWARE THAT READS THE BUSY FLAG. A gadfly provides feedback to detect a faulty, but has the problem of creating a software crash if the never finishes. You will implement an excellent solution utilizing both gadfly and blind cycle, so that the software can return with an error code if a display operation does not finish on time (due to a broken wire or damaged display.) Your low-level functions must perform both gadfly (wait for the busy flag to be clear) and blind cycle. For each operation you will return with the error code equal to success if the busy becomes clear, but return with a failure if the busy does not become clear after waiting the appropriate amount of time. The paragraph discusses issues involved in developing software that will be sold. Because the software for embedded systems is much smaller than software for a general-purpose computer, it is customary to provide sell

Lab 3e Alarm Clock Page 3e.2 copyrighted source files (e.g.,.h and.c) that the user can compile with their application. In a large software system, one typically sells the header file together with precompiled object code. In our embedded system, the compiler will perform the linking. You are encouraged to modify/extend this example, and define/develop/test your own format. Normally, we group the device software into four categories. Interrupt service routines would be classified as protected support software, not directly callable by the user. 1. Data structures: global, protected (accessed only by the device, not the user.) OpenFlag boolean that is true if the display port is open initially false, set to true by _Open static storage (or dynamically created at bootstrap time, i.e., when loaded into memory) 2. Initialization routines (used/called by the user) _Open Initialization of display port Sets OpenFlag to true Initialize, other data structures Returns an error code if unsuccessful non-existent, already open, out of memory, failure, illegal parameter Input Parameters(display, cursor, move, size) Output Parameter(none) if(!_open(inc+noshift,nocursor+noblink, NOSCROLL+LEFT,2LINE+7DOT)) error(); 3. Regular I/O calls (called by user to perform I/O) _Clear clear the display Returns an error code if unsuccessful. E.g., device not open, failure (happens when a wire is loose) Input Parameter(none) if(_clear()) error(); _OutChar Output an ASCII character to the port Returns an error code if unsuccessful. E.g., device not open, failure (happens when a wire is loose) Input Parameter(ASCII character) if(_outchar(letter)) error(); _OutString Output a NULL-terminated ASCII string to the port Returns an error code if unsuccessful. E.g., device not open, failure (happens when a wire is loose) Input Parameter(pointer to ASCII string) if(_outstring("hello world")) error(); 4. Support software (protected/static, not directly accessible by the user). outcsr sends one command code to the control/status Input Parameter(command is 8-bit function to execute) Output Parameter(none} wait fixed time delay Input Parameter(time in microseconds to wait) Output Parameter(none} You will write the first main program in order to test and evaluate the device software and. For a device this simple you should be able to test all modes and all characters. Purposefully cause errors and see if the software gives the appropriate response. For example, the project contains a main program that is used to test the features of the.h,.c device.

Lab 3e Alarm Clock Page 3e.3 The second main program will implement a simple digital alarm clock. You can connect individual pushbutton switches (see Figure 3.2) to input pins of the 6812, which the user can use to set the current time and the alarm time. The display will be used to display the current time. You are free to implement whatever features you wish, but there must be a way to set the time. The system maintains three global variables hour, minute, second. No SCI input is allowed, and the time parameters must be maintained using the RTI interrupts. In particular, the RTI interrupt service routine should increment second once a second, increment minute once a minute, and increment hour once an hour. The foreground (main) will output to the display, and interact will the operator via the switch inputs. If the correct sequence of switches is pushed, the main program can initialize the values of hour, minute, second. Figure 3.2. S.P.S.T. momentary, normally open. 0.48" square x 0.18" body. Plunger stands 0.3" above body. Four PC leads on 0.2" x 0.5" centers. CAT# MPB-127, http://www.allelectronics.com. You can a using a NPN transistor like PN2222 to an output port. The resistor controls the loudness of the sound. Please make it quiet, try 1 kω. The maximum I CE of the transistor must be larger than 5V/32Ω. The 1N914 diode is used as a snubber to remove back EMF when the transistor switches off. If you toggle the output pin in the background ISR, then sound will be generated. See Figure 3.3. +5 6812 1N914 output R PN2222 Figure 3.3. 2.25" 32 OHM SPEAKER. 0.38" thick. CAT# SK-232, http://www.allelectronics.com. Preparation Show the required connections. Label all chips, pin numbers, and resistor values. Modify the existing low-level device to implement the combined blind-cycle/gadfly synchronization. You must have a separate.h and.c files to simplify the reuse of these routines. Write one main program that tests all features of the. Write a second main program that implements the digital alarm clock. The interrupt service routine used to maintain time must run as fast as possible. This means you must perform all I/O from the main program. You must be careful not to let the show an intermediate time of 1:00:00 as the time rolls over from 1:59:59 to 2:00:00. You must also be careful not to disable interrupts too long (more than one RTI interrupt period), because a time error will result if any RTI interrupts are skipped. You will have to do some 32-bit math to maintain the exact time. For example, if the RTI interrupts at 30.517Hz, then interrupts are requested at exactly 32768 µs. One method is to add 32768 to a 32-bit counter. When the counter exceeds 1 million, increment second and subtract 1 million from the counter. Figure 3.4 shows the data flow graph of the alarm clock.

Lab 3e Alarm Clock Page 3e.4 push buttons timer switch timer main logic Figure 3.4. Data flows from the timer and the switches to the and. Figure 3.5 shows a possible call graph of the system. Dividing the system into modules allows for concurrent development and eases the reuse of code. main program Switch Sound Switch RTI Figure 3.5. A call graph showing the four modules used by the alarm clock. Procedure You should look at the +5 V voltage versus time signal on a scope when power is first turned on to determine if the power on reset circuit will be properly activated. The data sheet specifies it needs from 0.1 ms to 10 ms rise time from 0.2 V to 4.5 V to generate the power on reset. Connect the to your microcomputer. Use the scope to verify the sharpness of the digital inputs/outputs. If needed, adjust the contrast potentiometer for the best looking display. Test the device software and two main programs in small pieces. Deliverables (exact components of the lab report) A) Objectives (1/2 page maximum) B) Hardware Design, showing all external components, showing all external components C) Software Design (no software printout in the report) If you organized the system different than Figure 3.4 and 3.5, then draw its data flow and call graphs D) Measurement Data Plot the supply voltage versus time as the system is powered up Plot the voltage versus time during an alarm sound E) Analysis and Discussion (1 page maximum) Checkout Using the first main program, you should be able to demonstrate all the cool features of your display system. Next, download the digital alarm program. Demonstrate that your digital alarm clock is stand-alone by

Lab 3e Alarm Clock Page 3e.5 turning the power off then on. The digital alarm clock should run (the time will naturally have to be reprogrammed) without downloading the software each time. Your software files will be copied onto the TA s zip drive during checkout. Hints 1) Make sure the 14 wires are securely attached to your board. 2) One way to test for the first call to _Open is to test the direction register. After reset, the direction registers are usually zero, after a call to _Open, some direction register bits will be one. 3) Observe the starter files in the project. These C language routines only output to PTM and PAD0. Notice that they do not perform any input (either status or data), therefore they leave DDRM=0x3F, DDRAD =0x01. Because you have to include inputs, then you must toggle DDRM, so that PTM bits 3-0 are output for writes and an input for reads. 4) Although many displays use the same HD44780 controller, the displays come in various sizes ranging from 1 row by 16 columns up to 4 rows by 40 columns.