Microprocessors B Lab 1 Spring The PIC24HJ32GP202

Similar documents
Microprocessors B Lab 3 Spring PIC24/24LC515 EEPROM Interface Using I 2 C

PICado Alpha Development Board V1.0

MICROPROCESSORS B (17.384) Spring Lecture Outline

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

MICROPROCESSORS B (17.384) Spring Lecture Outline

PIC32MX150F128 Breakout Board

PIC Dev 14 Surface Mount PCB Assembly and Test Lab 1

ECE383: Microcomputers Lab 2 PIC24 System Schematic Creation in PCB Artist

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

Getting acquainted with the development tools June 27, 2006 ELE492 Embedded System Design Exercise 1

Capacitive Touch Remote Control Reference Design User s Guide

Development board for PIC24FJ128GA010. with 262k TFT color LCD module

How to program the Fast Amplifiers

University of Hawaii EE 361L MPLab Quick Tutorial and Project 2.1 Last updated September 1, 2011

PIC Dev 14 Through hole PCB Assembly and Test Lab 1

Dwarf Boards. DB057 : 40-pin controller board

isppac-powr1208 Evaluation Board PAC-POWR1208-EV

LED Knight Rider. Yanbu College of Applied Technology. Project Description

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

HAND HELD PROGRAMMER QUICK START GUIDE

MICROPROCESSORS A (17.383) Fall Lecture Outline

BC-USB-Kit Manual. First Edition. February, BeatCraft, Inc.

KPIC-0818P (V050919) Devices Included in this Data sheet: KPIC-0818P

1/Build a Mintronics: MintDuino

TDSDB Features. Description

MICROPROCESSORS A (17.383) Fall Lecture Outline

Product Overview -A 16 bit Micro Experimenter for Solderless Breadboards

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

PIC 28 Pin Board Documentation. Update Version 5.0

Evaluation board for Microchip 100-Pin General Purpose Microcontrollers

DEV-1 HamStack Development Board

Introduction to PIC Programming

Microchip 18F4550 Interface, Signal conditioning, USB, USB- RS-232, 16x2 LCD Interface

Microcontroller Overview

isppac-powr1208p1 Evaluation Board PAC-POWR1208P1-EV

PIC PORTABLE PROGRAMMER QUICK START GUIDE

32 bit Micro Experimenter Board Description and Assembly manual

Bolt 18F2550 System Hardware Manual

Lecture (03) PIC16F84 (2)

JUNEBUG PIC LABORATORY

Laboratory 10. Programming a PIC Microcontroller - Part II

Thursday, September 15, electronic components

DEVBOARD3 DATASHEET. 10Mbits Ethernet & SD card Development Board PIC18F67J60 MICROCHIP

PICmicro Microcontroller Lite programmer datasheet

Rapid40i PIC Prototyping PCB User Manual

Development Hardware. Target Board and In-circuit Debugger

reserved pulse width stim freq int/ext trig Amplitude

Dwarf Boards. DN001 : introduction, overview and reference

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

eip-24/100 Embedded TCP/IP 10/100-BaseT Network Module Features Description Applications

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Section 30. In-Circuit Serial Programming (ICSP )

PIC KIT 2 BASIC-USERS GUIDE FEMTO ELECTRONICS

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

TCP/IP Base Board Setup Instructions (JGS_ETH24_BASE)

Laboratory 9. Programming a PIC Microcontroller - Part I

Typical applications where a CPLD may be the best design approach:

Introducing the 32 bit Micro Experimenter

Reprinted by permission of T&L Publications Inc. Copyright 2001 USB MICROCONTROLLERS FOR THE MASSES

Basic Input/Output Operations

PIC Microcontroller Introduction

Atmel AVR datasheet. Matrix Multimedia Atmel AVR Board EB Contents

Breeze Board. Type A. User Manual.

Building RoboPIC 18F4550

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system.

Lecture (04) PIC 16F84A programming I

Microcomputers. C and Embedded Systems

Laboratory Exercise 7 - Extended I/O & Parallel Processing

AX-12. PIC12F675 microcontroller Activity board

Rapid40iXL PIC Prototyping PCB User Manual

C8051F700-DK C8051F700 DEVELOPMENT KIT USER S GUIDE. 1. Relevant Devices. 2. Kit Contents. 3. Hardware Setup

Finite State Machine Lab

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

MX Educational Target User Manual

SKEE 2742 BASIC ELECTRONICS LAB

Goal: We want to build an autonomous vehicle (robot)

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

RFID: Read and Display V2010. Version 1.1. Sept Cytron Technologies Sdn. Bhd.

Good Idea to Working Electronic Model

ON4AKH Antenna Rotator controller Version 1.0

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

Build the Machine Science XBoard, with a programmable microcontroller.

EE 361L Digital Systems and Computer Design Laboratory

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

Section 9. Watchdog Timer (WDT)

SBC44EC. Single board computer for 44 pin PLCC PICs

Touch Control Switch + - R6 R4 R8 R7 CAT# Grading. Assembly Instructions by Earl D. Gates SUNY Oswego Fall Conference 2007.

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

eip-10 Embedded TCP/IP 10-BaseT Network Module Features Description Applications

EZ GUI Expansion Board Design Guide

EXPERIMENT 4: Parallel Input/Output. Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing

Exclusive 2.5 GHz Frequency Counter

Contents. The USB Logic Tool... 2 Programming... 2 Using the USB Logic Tool... 6 USB Logic Tool Features... 7 Device Hardware...

IFC-MB00 Interface Free Controller Main Board

None. MICROCONTROLLERS III

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Assembly Instructions (8/14/2014) Your kit should contain the following items. If you find a part missing, please contact NeoLoch for a replacement.

Transcription:

The PIC24HJ32GP202 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 familiarize the student with the use of MPLAB IDE, Microchip PIC24 C compiler, PIC24 microcontroller, and the PICkit 2 or PICkit 3. In addition, the initial startup circuit will be wired on a breadboard. An LED will be flashed, and then the LED will be controlled via software by a switch. PIC24 and Voltage Regulator Circuit (Circuit for use during semester --- Parts only needed once as the circuit will remain on breadboard for follow-on labs) 1 Breadboard 1 Oscilloscope 1 Voltmeter 1 PICkit 2 or PICkit 3 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 1.0 kω axial resistors (any supplier) Brown-Black-Red 1 10 kω axial resistor (any supplier) Brown-Black-Orange 1 Pushbutton switch P8009S-ND (DK) Switch Circuit 1 Pushbutton switch P8009S-ND (DK) 1 LED 1 470 Ω axial resistors (any supplier) 1

WARNINGS AND PRECAUTIONS 1) Never remove the PIC24HJ32GP202 from an energized circuit 2) Do not construct circuits while energized 3) Follow electrical safety precautions 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 This lab will transition the student from the PIC16F684 used in Microprocessors A to the PIC24HJ32GP202 microcontroller. In addition, we have transitioned from the HI-TECH ANSI C Compiler to the Microchip PIC24 C compiler. Knowledge of C programming will be enhanced by these labs. 2

Pre-Lab Preparation 1. Download Lab # 1 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 and review the PICkit 2, PICkit 3, etc). Procedure Objective 1. INITIAL START-UP CIRCUIT 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. h. Verify that L1 is on. This will be a visual aid in determining if voltage is present (when the LED is turned on). 3

i. Power down the circuit. 17.384 Microprocessors B j. Install the PIC24HJ32GP202. Objective 2. FLASHING LED L1 a. Compose a program in C to flash L1 once power is applied to the system. L1 shall flash at a rate of approximately once per sec. NOTE this does not need to be exact; an approximate rate is all that is required. RB15 needs to be configured as open drain. b. Include the required Class Required Header Code, Figure 4, in your software. Figure 6 contains the required Configuration Word. Figure 7 provides some initial code. c. Save your program as Lab_1A.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_1A.c at the end of the lab report in the space provided as well as email a copy to the instructor. Objective 3. LED/SWITCH INPUT/OUTPUT a. Connect one push button switch input (connected to RB13) which is low when pressed and one LED (connected to RB14) which is lit when the PIC s output pin is high. Configure the push button input for low true operation with the internal pull-up enabled, see Figure 5. RB14 --- configure as Normal CMOS Driver // Open drain disabled // Configure RB14 as output // RB14 initial condition 4

RB13 --- configure as low true operation with the internal pull-up enabled // Open drain disabled // Configure RB13 as input // RB13 initial condition b. Compose a program written in C such that the LED connected to RB14 shall illuminate when the push button switch connected to RB13 is pushed on. It shall remain on until the push button switch is pushed again. This condition shall repeat endlessly. c. Include the required Class Required Header Code, Figure 4, in your software. Figure 6 contains the required Configuration Word. d. Save your program as Lab_1B.c e. Program the PIC24HJ32GP202 using the PICkit 2 connected to J1 f. Troubleshoot as required to correct all hardware and software issues. g. If required, have the instructor view your working circuit. h. Insert a copy of your code, Lab_1B.c at the end of the lab report in the space provided as well as email a copy to the instructor. Objective 4. RESET SWITCH a. While Lab_1B.c is operating, depress the Reset Switch connected to the MCLR#. Verify the system resets as designed. b. Troubleshoot as required to correct all hardware and software issues. c. If required, have the instructor view your working circuit. SUMMARY: 5

You have just developed your first code for the PIC24HJ32GP202 microcontroller using MPLAB IDE, Microchip PIC24 C compiler, and the PICkit 2 or PICkit 3. Lab Notebook Requirements: Lab Report: - Ensure that you have recorded all the data requested during the lab in your lab notebook as well as your lab report. 1. Use template provided on the Class Web Site. 6

Figure 1 PIC24HJ32GP202 Pin-Out Diagram Figure 2a Top View LM2937-3.3 Figure 2b 10μF Tantalum Capacitor P/N 478-1839-ND 7

Figure 3 PIC24HJ32GP202 Initial Start-up Schematic 10 KΩ 8

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

Figure 6 - Configuration Word / Configuration Word / _FBS(BWRP_WRPROTECT_OFF); // Write Protect Disabled // FSS: Secure Code Segment Configuration Register // Not present on this chip _FGS(GSS_OFF & GCP_OFF & GWRP_OFF); // Code protect off // Code protect Disabled // Write Protect Disabled _FOSCSEL(FNOSC_FRC & IESO_OFF); // Fast RC oscillator // Two-speed Oscillator Startup Disabled _FOSC(FCKSM_CSECMD & IOL1WAY_OFF & OSCIOFNC_ON & POSCMD_NONE); // Only clock switching enabled // Single configuration for remappable I/O Disabled // OSC2 Pin function Digital I/O // Oscillator Selection... Taken from POSCMD_SEL _FWDT(FWDTEN_OFF & WINDIS_OFF & WDTPRE_PR128 & WDTPOST_PS512); // Watchdog Timer Disabled // Windowed WDT Disabled // Watchdog prescaler 1:128 // Watchdog postscaler 1:512 _FPOR(FPWRT_PWR16 & ALTI2C_OFF); // Power-on Reset Value 16 ms // Alternate I2C Pins I2C mapped to SDA1/SCL1 _FICD(JTAGEN_OFF & ICS_PGD1); // JTAG is disabled // ICD communication channel select bits communicate // on PGC1/EMUC1 and PGD1/EMUD1 / END --- Configuration Word / 10

Figure 7 - Initial Code #include "p24hj32gp202.h // Class Header // configuration word / START OF delay_routine / void delay_routine(void) { unsigned short i, j; for (i = 0; i < 800; i++) for (j = 0; j < 800; j++); return; // 16 bits } / END OF delay_routine / int main() { / PIO config / _ODCB15 = 1; // Enable open drain _TRISB15 = 0; // Config RB15 as output _LATB15 = 0; // RB15 initially low while(1 == 1) { delay_routine(); _LATB15 = 1; delay_routine(); _LATB15 = 0; // Loop Forever // RB15 high... LED on // RB15 low... LED off } // END OF While (1 == 1) LOOP //return; } / END OF main ROUTINE / 11