DRAFT Microprocessors B Lab 3 Spring PIC24 Inter-Integrated Circuit (I 2 C)

Similar documents
Laboratory 8. Digital Circuits - Counter and LED Display

Spring 2011 Microprocessors B Course Project (30% of your course Grade)

Laboratory 11. Required Components: Objectives. Introduction. Digital Displays and Logic (modified from lab text by Alciatore)

Part (A) Controlling 7-Segment Displays with Pushbuttons. Part (B) Controlling 7-Segment Displays with the PIC

EE 367 Lab Part 1: Sequential Logic

Laboratory 7. Lab 7. Digital Circuits - Logic and Latching

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

Lab 7: Soldering - Traffic Light Controller ReadMeFirst

Data Conversion and Lab (17.368) Fall Lecture Outline

Bill of Materials: Super Simple Water Level Control PART NO

LABORATORY # 1 LAB MANUAL. Digital Signals

Exercise 2: Connecting the Digital Logic Circuits

8 PIN PIC PROGRAMMABLE BOARD (DEVELOPMENT BOARD & PROJECT BOARD)

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

University of Illinois at Urbana-Champaign

SXGA096 DESIGN REFERENCE BOARD

Mal-2 assembly guide v1.0

Lab 7: Soldering - Traffic Light Controller ReadMeFirst

EXPERIMENT #6 DIGITAL BASICS

ECE 372 Microcontroller Design

ECE 2274 Pre-Lab for Experiment Timer Chip

N3ZI Digital Dial Manual For kit with Serial LCD Rev 3.04 Aug 2012

[ Photos ] [ Wares ] [ Library ] [ Dave's Web ] [ Matt's Web ] Wares [ SWISH ] [ Simple Search ] [ Trunk Calc ]

Lab 23 Controller Diagnostics

Bill of Materials: 7-Segment LED Die with Arduino PART NO

Christmas LED Snowflake Project

Assembly Instructions And User Guide. Nixie FunKlock. FunKlock Issue 4 (1 February 2017)

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

NewScope-7A Operating Manual

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

LAB #6 State Machine, Decoder, Buffer/Driver and Seven Segment Display

DSO138mini Troubleshooting Guide

APPLICATION NOTE 4312 Getting Started with DeepCover Secure Microcontroller (MAXQ1850) EV KIT and the CrossWorks Compiler for the MAXQ30

Nixie Clock Type Quattro'

Bill of Materials: Magic Color PART NO

Telephony Training Systems

Embedded System Training Module ABLab Solutions

N3ZI Digital Dial Manual For kit with Backlit LCD Rev 4.00 Jan 2013 PCB

Nixie Clock Kit IN-12B color LED backlit Operation Manual Nixie Clock Kit IN-12B V6.0 ( All Right Reserved 2015 )

Introduction 1. Digital inputs D6 and D7. Battery connects here (red wire to +V, black wire to 0V )

Australian Technical Production Services

Total solder points: 117 Difficulty level: beginner advanced. RGB Controller K8088 ILLUSTRATED ASSEMBLY MANUAL

DMC550 Technical Reference

Figure 7.8 Circuit Schematic with Switches, Logic Gate, and Flip-flop

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

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

Vorne Industries. 87/719 Analog Input Module User's Manual Industrial Drive Itasca, IL (630) Telefax (630)

EVALUATION BOARD DATASHEET EV-151

Alice EduPad Board. User s Guide Version /11/2017

Combo Board.

Model 6010 Four Channel 20-Bit Audio ADC Data Pack

Catch or Die! Julia A. and Andrew C. ECE 150 Cooper Union Spring 2010

Keyboard Controlled Scoreboard

Digital (5hz to 500 Khz) Frequency-Meter

DIY KIT MHZ 8-DIGIT FREQUENCY METER

A 400MHz Direct Digital Synthesizer with the AD9912

Constructing and Operating: The Island Keyer

Multi-Key v2.4 Multi-Function Amplifier Keying Interface

Digital Clock. Perry Andrews. A Project By. Based on the PIC16F84A Micro controller. Revision C

SMC 2000 Series Master Clock Installation Manual (V2) Table of Contents

PHYSICS 358 Advanced Electronics Laboratory Manual Fall 2014 Dr. Adam T. Whitten

Simple PICTIC Commands

Telephony Training Systems

PHYS 3322 Modern Laboratory Methods I Digital Devices

LED Array Board.

COLOUR CHANGING USB LAMP KIT

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

Table of Contents Introduction

University of Victoria. Department of Electrical and Computer Engineering. CENG 290 Digital Design I Lab Manual

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

Light Emitting Diodes (LEDs)

uresearch GRAVITECH.US GRAVITECH GROUP Copyright 2007 MicroResearch GRAVITECH GROUP

QUIZ BUZZER KIT TEACHING RESOURCES. Version 2.0 WHO ANSWERED FIRST? FIND OUT WITH THIS

SignalTap Plus System Analyzer

GUIDE TO ASSEMBLY OF ERICA SYNTHS DELAY MODULE

Review : 2 Release Date : 2019 Last Amendment : 2013 Course Code : SKEE 2742 Procedure Number : PK-UTM-FKE-(0)-10

Installing The PK-AM keyer and. from Jackson Harbor Press Operating: A Morse code keyer chip with pot speed control

SN-Class Nixie Clock Kits

Introduction 1. Green status LED, controlled by output signal ST

Digital Strobe Tuner. w/ On stage Display

Data Acquisition Using LabVIEW

MODULAR DIGITAL ELECTRONICS TRAINING SYSTEM

Lab #10: Building Output Ports with the 6811

INFRARED BAT-SPEED-TRACKING DEVICE CVG Systems Baseball Edition ASENIORTHESISPROPOSAL

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

Pixie Construction Notes

ELECTRONIC GAME KIT TEACHING RESOURCES. Version 2.0 BUILD YOUR OWN MEMORY & REACTIONS

Build Your Own Clone Relay Bypass Board Instructions

Introduction: Overview. EECE 2510 Circuits and Signals: Biomedical Applications. ECG Circuit 2 Analog Filtering and A/D Conversion

Nixie Tube Clock Type Marsden

DEM 9ULNACK 3.4 GHz. PHEMT LNA amplifier complete kit assembly guide

FX-2DA SPECIAL FUNCTION BLOCK USER'S GUIDE

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

TV Character Generator

Rfid Based Attendance System

This document is intended to provide information to allow the researcher to build their own device.

COMPUTER ENGINEERING PROGRAM

Tube Cricket Build Guide

L, LTC, LTM, LT are registered trademarks of Linear Technology Corporation. Other product

Experiment # 4 Counters and Logic Analyzer

Transcription:

PIC24 Inter-Integrated Circuit (I 2 C) Lab Report Objectives Materials See separate report form located on the course webpage. This form should be completed during the performance of this lab. 1) To utilize the Inter-Integrated Circuit (I 2 C) serial bus to interface the PIC24HJ32GP202 microcontroller with either the DS1307 Real Time Clock (RTC) IC or the Microchip 24LC515 Serial EEPROM. Data will be written to and read from either the RTC or the EEPROM. Data will be displayed on either a four digit 7-segment display when interfacing with the DS1307 or a LED bargraph display when interfacing with the serial EEPROM. PIC24 and Voltage Regulator Circuit (Parts only needed if not previously constructed) 1 Breadboard 1 Oscilloscope 1 Voltmeter 1 PICkit 2 2 6x1 0.1" pitch R/A long-tail connector S1132E-06-ND (DK) 1 PIC24HJ32GP202, microcontrollers - P/N PIC24HJ32GP202-I/SP-ND (DK) 1 Wall transformer 6V, 1 A T978-P7P-ND (DK) 1 Power connector CP-2519-ND (DK) 1 9 volt battery (needed only if not using the Wall Transformer) 1 9 volt battery clip (if using a 9 volt battery) 1 LM2937-3.3 low-dropout regulator 3.3 V LM2937ET-3.3-ND (DK) 1 Slide switch EG1903-ND (DK) 1 500 ma fast-acting axial fuse F2311-ND (DK) 3 0.1 microfarad capacitor (104) 2 10 μf tantalum radial, < 5 ohms ESR 478-1839-ND (DK) 1 LED 1 910 Ω axial resistors (any supplier) 1 10 kω axial resistor (brown black orange) 1 Pushbutton switch P8009S-ND (DK) Switch and LED Circuit (Figure 5) (Parts only needed if not previously constructed) 1 Pushbutton switch P8009S-ND (DK) 1 LED 1

1 470 Ω axial resistors (yellow violet brown) EEPROM Circuit (Figure 6) 1 Microchip 24LC515 EEPROM 24LC515-I/P-ND (DK) 2 2.2 kω axial resistors (red red red) Bargraph Circuit (Figure 8) 1 Bargraph 10 470 Ω axial resistors (yellow violet brown) 5 Volt Regulator (Figure 10) 1 LM7805 Voltage Regulator 1 0.33 microfarad capacitor (334) 1 0.1 microfarad capacitor (104) Real Time Clock (RTC) Circuit (Figure 11) 1 DS1307 2 2.2 kω axial resistors (red red red) 1 32.768 khz watch crystal 1 CR1220 battery 7-Segment LED Circuit (Figure 13) 1 2 9 2 Dual 7-segment LED (common anode) 2N6519 PNP Transistors 470 ohm resistors (yellow violet brown) SPST switch WARNINGS AND PRECAUTIONS 1) Never remove the PIC24HJ32GP202 from an energized circuit 2) Do not construct circuits while energized 3) Follow electrical safety precautions 2

Source File Locations 1. Microchip PIC24 C compiler (C30 compiler) LIB30 Archiver C:\Program Files\Microchip\mplabc30\v3.25\bin\pic30-ar.exe MPLAB ASM 30 Assembler C:\Program Files\Microchip\mplabc30\v3.25\bin\pic30-as.exe MPLAB C30 C Compiler C:\Program Files\Microchip\mplabc30\v3.25\bin\pic30-gcc.exe MPLAB Link30 Object Linker C:\Program Files\Microchip\mplabc30\v3.25\bin\pic30-ld.exe Background Information We shall utilize a 24LC515 EEPROM to demonstrate the I 2 C serial bus to the PIC24HJ32GP202 microcontroller. Emphasis needs to be on the I 2 C serial bus connections as well as the communications required to write and read data to/from the EEPROM. I 2 C communication is as follows 1. Master initiates a start condition 2. Master sends the 7-bit unique address of the device 3. Master outputs the read or write bit 4. Slave sends an acknowledge bit 5. Byte of data is exchanged followed by an acknowledgement. Data exchange will continues until all data is sent 6. Transaction ends with the master device causing a stop condition 3

Pre-Lab Preparation 1. Download Lab # 3 from the course website. Read and understand the lab. 2. Read the various course reference materials (PIC24HJ32GP202 data sheet, PIC24 Family Reference Manual, Microchip PIC24 C Compiler manual, 24LC515 EEPROM, DS1307, and review the PICkit 2, etc). Datasheet links are located on the course webpage. Procedure Objective 1. INITIAL START-UP CIRCUIT (Not required if accomplished in Lab #1) NOTE: This objective is only required if the circuit shown in Figure 1 has not been previously constructed on your breadboard. Skip to Objective 2 (EEPROM) or Objective 5 (RTC) if breadboard has been previously wired in Lab #1. a. Review lab Warnings and Precautions. b. Pin-out for the PIC24HJ32GP202 is shown in Figure 1. c. Pin-out for the LM2937-3.3 is shown in Figure 2a. 10μF capacitor terminals are shown in Figure 2b. d. Review the Prototyping Walkthrough for PIC24HJ32GP202 Startup Schematic file located on the Class Webpage. This document provides additional guidance when constructing your circuit. e. Construct the circuit shown in Figure 3 on your breadboard. 1. Locate your voltage regulator circuit in a corner of your board as this circuit will be required throughout the semester. 2. DO NOT install the PIC24HJ32GP202 at this time f. Apply power (either a 9 volt wall transformer or a 9 volt battery) to the Power On/Off switch. g. Using the voltmeter and an oscilloscope (if available), verify that +3.3 volts is at the output of the LM2937-3.3 regulator and is clean and free of interference. 4

h. Verify that L1 is on. This will be a visual aid in determining if voltage is present (when the LED is turned on). i. Power down the circuit. j. Install the PIC24HJ32GP202. k. Add the components shown in Figure 5. Objective 2. WIRING THE 24LC515 EEPROM AND BARGRAPH CIRCUITS (Not required if performing RTC interface starting at Objective 5) a. Add the circuit shown in Figure 6 to your breadboard. Do not disconnect any prior connections unless specifically told. b. Pin-out for the 24LC515 is shown in Figure 7. c. Add the Bargraph circuit shown in Figure 8 to your breadboard. Note only 8 LEDs need to be wired (D0 thru D7). Others can be wired for future use, if desired. Objective 3. 24LC515 EEPROM WRITE PROGRAM (Not required if performing RTC interface starting at Objective 5) a. Compose a program in C to perform the following tasks (see step b for some programming requirements and suggestions): 1. Write the following values, which will be stored in an array within your program) to the 24LC515 lower memory addresses (address boundaries 0000h to 7FFFh): 0000 0000 0000 0001 0000 0010 0000 0011 2. Write the following values, which will be stored in an array within your program, to the 24LC515 upper memory addresses (within address boundaries 8000h to FFFFh): 0000 0100 5

0000 0101 0000 0110 0000 0111 3. Your program will execute once. At the end of the EEPROM programming sequence, the LED connected to RB14 will flash indicating successful EEPROM programming. b. The following software requirements/suggestions need to be incorporated into your code (those labeled as required MUST be in your code): 1. REQUIRED --- Include the required Class Required Header Code, Figure 4, in your software. 2. SUGGESTED --- review the textbook s C code. Incorporate required Code directly into your code vice utilizing header files as the textbook s code does. 3. Utilize the I2C communication protocol for proper communications between the 24LC515 EEPROM and the PIC24HJ32GP202 microcontroller. c. Save your program as Lab_3A.c d. Program the PIC24HJ32GP202 using the PICkit 2 connected to J1 e. Troubleshoot as required to correct all hardware and software issues. f. If required, have the instructor view your working circuit. g. Insert a copy of your code, Lab_3A.c at the end of the lab report in the space provided as well as email a copy to the instructor. Objective 4. 24LC515 EEPROM READ PROGRAM (Not required if performing RTC interface starting at Objective 5) a. Compose a program in C to perform the following tasks (see step b for some programming requirements and suggestions): 6

1. Read and display on the LED Bargraph the following values, which were written to the 24LC515 lower memory addresses, address boundaries 0000h to 7FFFh, in Objective 3: 0000 0000 0000 0001 0000 0010 0000 0011 2. Read and display on the LED Bargraph the following values, which were written to the 24LC515 upper memory addresses, address boundaries 8000h to FFFFh, in Objective 3: 0000 0100 0000 0101 0000 0110 0000 0111 3. Your program will execute indefinitely. Address contents will display for one (1) second before proceeding to the next address. b. The following software requirements/suggestions need to be incorporated into your code (those labeled as required MUST be in your code): 1. REQUIRED --- Include the required Class Required Header Code, Figure 4, in your software. 2. SUGGESTED --- review the textbook s C code. Incorporate required Code directly into your code vice utilizing header files as the textbook s code does. 3. SUGGESTED --- the LED bargraph is wired exactly like the PICkit 1 which reduces the number of output pins required. However, as you may recall from Microprocessors A, we will light only one LED at a time at a sufficient speed that it appears that all required LEDs are on. This was called strobing. You may want to review the Analog- 7

to-digital lab that we utilized strobing for code details. 4. REQUIRED --- Utilize the I2C communication protocol for proper communications between the 24LC515 EEPROM and the PIC24HJ32GP202 microcontroller. c. Save your program as Lab_3B.c d. Program the PIC24HJ32GP202 using the PICkit 2 connected to J1 e. Troubleshoot as required to correct all hardware and software issues. f. Verify correct values are displayed on the LED Bargraph. g. If required, have the instructor view your working circuit. h. Insert a copy of your code, Lab_3B.c at the end of the lab report in the space provided as well as email a copy to the instructor. Objective 5. DRAFT -- WIRING THE RTC AND 7-SEGMENT CIRCUITS (Not required if performing EEPROM interface starting at Objective 2) a. Basic block diagram is shown in Figure 9. b. IMPORTANT!!!! READ the DS1307 Data Sheet which is posted on the course webpage. c. The RTC requires 5 volts. Construct the 5 volt regulator circuit shown in Figure 10. Test to ensure proper voltage after construction. WARNING do not mix the 5 volt circuit with the 3.3 volt circuit. d. Add the RTC circuit shown in Figure 11 to your breadboard. Pin-out for the DS1307 is shown in Figure 12. Do not disconnect any prior connections unless specifically told. e. Add the 7-segment circuit shown in Figure 13 to your breadboard. NOTE: This draft has not assigned PIC24 pins to the 7-segment display; assignments are for the PIC16 used last semester. Work pin-out in class with the instructor. 8

Objective 6. DRAFT DS1307 RTC WRITE PROGRAM (Not required if performing EEPROM interface starting at Objective 2) a. Compose a program in C to perform the following tasks (see step b for some programming requirements and suggestions): 1. Set the RTC seconds to the value of the last two digits of your UML ID. If the value is greater than 59, subtract 59 from your number. For example, if your UML ID is 00345678, set the seconds to 78-59 = 19 seconds. b. The following software requirements/suggestions need to be incorporated into your code (those labeled as required MUST be in your code): 1. REQUIRED --- Include the required Class Required Header Code, Figure 4, in your software. 2. Utilize the I 2 C communication protocol for proper communications between the DS1307 RTC and the PIC24HJ32GP202 microcontroller. c. Save your program as Lab_3C.c d. Program the PIC24HJ32GP202 using the PICkit 2 connected to J1 e. Display only the seconds digits on the 7-segment displays. Ensure that the seconds start at the value you have specified in 6.A. Troubleshoot as required to correct all hardware and software issues. f. If required, have the instructor view your working circuit. g. Insert a copy of your code, Lab_3C.c at the end of the lab report in the space provided as well as email a copy to the instructor. Objective 7. DRAFT DS1307 RTC READ PROGRAM (Not required if performing EEPROM interface starting at Objective 2) a. Compose a program in C to perform the following tasks (see step b for some programming requirements and suggestions): 9

1. Read the RTC minute register each second and display the value on the 7-segment display. The display will change every minute if working correctly. b. The following software requirements/suggestions need to be incorporated into your code (those labeled as required MUST be in your code): 1. REQUIRED --- Include the required Class Required Header Code, Figure 4, in your software. 2. REQUIRED --- Utilize the I 2 C communication protocol for proper communications between the DS1307 RTC and the PIC24HJ32GP202 microcontroller. c. Save your program as Lab_3D.c d. Program the PIC24HJ32GP202 using the PICkit 2 connected to J1 e. Troubleshoot as required to correct all hardware and software issues. f. Verify correct values are displayed on the 7-segment display. g. If required, have the instructor view your working circuit. h. Insert a copy of your code, Lab_3D.c at the end of the lab report in the space provided as well as email a copy to the instructor. SUMMARY: You developed Code that utilizes either a 24LC515 EEPROM or a DS1307 RTC which demonstrated the I 2 C serial bus to the PIC24HJ32GP202 microcontroller capabilities. We wrote and read data to/from either the EEPROM or the RTC which can be used in many future applications. Lab Notebook Requirements: Ensure that you have recorded all the data requested during the lab in your lab notebook as well as your lab report. Lab Report: 1. SEE INSTRUCTOR --- Use template provided on the Class Web Site. 10

Figure 1 PIC24HJ32GP202 Pin-Out Diagram Figure 2a Top View LM2937-3.3 11

Figure 2b 10μF Tantalum Capacitor P/N 478-1839-ND Figure 3 PIC24HJ32GP202 Initial Start-up Schematic 10 12

Figure 4 - Required Header Code /******************************************************** * * Program Title: xxxx * * Program File Name: Lab_XA.c * * Microprocessors B 17.384 * * xxxxxxxx - Put in Semester (i.e. ) here * * xxxxxxxx - Put in your name here * * xx/xx/xx - Put date here * ********************************************************/ Figure 5 RB13 and RB14 Connections 13

Figure 6 24LC515 EEPROM Connections Figure 7 24LC515 Pin-out 14

Figure 8 Bargraph Connections 15

Figure 9 RTC Block Diagram Figure 10 Voltage Regulator Circuit (5 volts) 16

Figure 11 Real Time Clock (RTC) Circuit Figure 12 DS1307 Pin-out 17

Figure 13 Dual Seven-Segment LED Display Circuit --- NEEDS UPDATING 18