Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory

Similar documents
ELCT 912: Advanced Embedded Systems

Laboratory Exercise 1 Microcontroller Board with Driver Board

Binary Outputs: LEDs

' The PicBasic Pro Compiler Manual is on line at: '

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore)

;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cblock Bank0RAM ;Temporary storage for STATUS during interrupts

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

Simple Bridge Stand Alone H-Bridge Data Sheet Revision 1 August 2005

PIC ADC to PWM and Mosfet Low-Side Driver

EXERCISE 4: A Simple Hi-Fi

Department of Mechanical and Industrial Engineering MECH 471 MICROCONTROLLERS FOR MECHATRONICS. Laboratory Specialist

PIC Analog Voltage to PWM Duty Cycle

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC

More Fun with A/D Converters

MicroToys Guide: Motors N. Pinckney April 2005

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Programming PIC Microcontrollers in PicBasic Pro LCD Lesson 3 Cornerstone Electronics Technology and Robotics II

Lesson 19 In-Circuit Programming

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation

ECE Senior Design Final Report For. Scalable Regulated Three Phase Power Rectifier. May 10, 2004 Rev. 1.0

Figure 1: One Possible Advanced Control System

EE 109 Midterm Review

LM4: The timer unit of the MC9S12DP256B/C

LINE MAZE SOLVING ROBOT

Lab 5: Inverted Pendulum PID Control

Direct Current Waveforms

Lecture #4 Outline. Announcements Project Proposal. AVR Processor Resources

MICROPROCESSORS A (17.383) Fall Lecture Outline

IST TSic Temperature Sensor IC Application Notes ZACwire Digital Output

International Journal of Advances in Science and Technology (IJAST)

Implementation of Multiquadrant D.C. Drive Using Microcontroller

EE 314 Spring 2003 Microprocessor Systems

EASTERN MEDITERRANEAN UNIVERSITY FACULTY OF ENGINEERING Electrical and Electronics Engineering Department

UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING. SENG 466 Software for Embedded and Mechatronic Systems. Project 1 Report. May 25, 2006.

GRAPHICAL LCD BASED DIGITAL OSCILLOSCOPE

ME 4447 / ME 6405 MICROPROCESSOR CONTROL OF MANUFACTURING SYSTEMS / INTRODUCTION TO MECHATRONICS

Instrument Cluster Display. Grant Scott III Erin Lawler Mike Carlson

Devantech SRF04 Ultra-Sonic Ranger Finder Cornerstone Electronics Technology and Robotics II

Robotic Navigation Distance Control Platform

Directions for Wiring and Using The GEARS II (2) Channel Combination Controllers

GCE A level 1145/01 ELECTRONICS ET5

MICROCONTROLLER TUTORIAL II TIMERS

Project Final Report: Directional Remote Control

Course Introduction. Content 20 pages 3 questions. Learning Time 30 minutes

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

MICROPROCESSORS AND MICROCONTROLLER 1

GCE A level 1145/01 ELECTRONICS ET5. P.M. THURSDAY, 31 May hours. Centre Number. Candidate Number. Surname. Other Names

EXPERIMENT 6: Advanced I/O Programming

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002

School of Engineering Mechatronics Engineering Department. Experim. ment no. 1

Final Project Report E3390 Electronic Circuits Design Lab. The Seeing Natcar

Microcontroller: Timers, ADC

GCE A level 1145/01 ELECTRONICS ET5

Mechatronics Project Kit - Getting Started Manual

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

L13: (25%), (20%), (5%) ECTE333

arxiv:physics/ v1 [physics.ed-ph] 19 Oct 2004

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

MICROPROCESSOR TECHNICS II

An Embedded Approach for Motor Control Boards Design in Mobile Robotics Applications

Training Schedule. Robotic System Design using Arduino Platform

Microcontrollers and Interfacing

RC Filters and Basic Timer Functionality

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

EE 308 Spring 2006 FINAL PROJECT: INTERFACING AND MOTOR CONTROL WEEK 1 PORT EXPANSION FOR THE MC9S12

Design and Simulation of Automatic Temperature Control and Alert System Based PIC16F887

K7QO Marker Generator

CprE 288 Introduction to Embedded Systems (Output Compare and PWM) Instructors: Dr. Phillip Jones

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

PICmicro MCU APPLICATION DESIGN AND HARDWARE INTERFACING

Pulse Generation. Pulsout. 555 Timer. Software version of pulse generation Pulsout pin, Period

ANGULAR POSITION CONTROL OF DC MOTOR USING SHORTEST PATH ALGORITHM

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

Sensor Interface Using PIC12CXXX as a Sensor Interface for Metal Detection

2015 Technological Studies. Advanced Higher. Finalised Marking Instructions

Chapter 6 PROGRAMMING THE TIMERS

Monitoring Temperature using LM35 and Arduino UNO

Embedded Systems and Software

Castle Creations, INC.

Undefined Obstacle Avoidance and Path Planning

Hello, and welcome to this presentation of the STM32L4 comparators. It covers the main features of the ultra-lowpower comparators and some

FABO ACADEMY X ELECTRONIC DESIGN

Follow this and additional works at: Part of the Engineering Commons

' Turn off A/D converters (thereby allowing use of pins for I/O) ANSEL = 0

Interfacing to Analog World Sensor Interfacing

Pulse Width Modulation

Graphical Control Panel User Manual

PERIPHERAL INTERFACING Rev. 1.0

Grundlagen Microcontroller Counter/Timer. Günther Gridling Bettina Weiss

Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim

ME 461 Laboratory #2 Timers and Pulse-Width Modulation

IST TSic Temperature Sensor IC. Technical Notes ZACwire Digital Output

FM Tuner Controller for Portable and Car Radios

Microcontroller Based Inductance Capacitance Meter

Embedded Systems. Oscillator and I/O Hardware. Eng. Anis Nazer First Semester

A NEW DECISION ALGORITHM FOR AUDIO VOTING SYSTEM

Timing System. Timing & PWM System. Timing System components. Usage of Timing System

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

Transcription:

Hashemite University Faculty of Engineering Mechatronics Engineering Department Microprocessors and Microcontrollers Laboratory

The Hashemite University Faculty of Engineering Department of Mechatronics Engineering Microprocessors and Microcontrollers Lab. Experiment 1 PIC18F452 Assembly Instructions This experiment focuses on the Assembly Language Instructions for PIC18F452 device. Objectives: 1. To make the student familiar with the assembly instructions of PIC18F452 device. 2. To know the way of choosing the appropriate instructions and how to arrange them according to the application requirements Apparatus: The devices used in this experiment are: 1. Programmer 2. PIC18F452 IC 3. Breadboard and electronic components as shown in Figure 1.1 Figure 1.1: Equipment and devices used in the experiment. Exp 1: PIC18F452 Assembly Instructions 1 of 4

Theoretical Background: Microcontrollers are very important devices in the digital world, so it is necessary to know how to program them, and in order to do this you may use assembly language instructions for PIC18F452 device, and by referring to the device datasheet the following table (Table 1.1) illustrates those instructions. Table 1.1 Exp 1: PIC18F452 Assembly Instructions 2 of 4

Exp 1: PIC18F452 Assembly Instructions 3 of 4

Procedure: Write a program that adding the lower 4-bits of the input data at portc to the higher 4- bits and moving the result to portb register. Build the required circuit. Program the device and make sure the circuit is ready to turn the power on. Consult your Lab. Supervisor to turn the power on. Discussion and Analysis: Observe the execution of the code in the circuit and make your decision about your program if it matches the application requirements or not. Exp 1: PIC18F452 Assembly Instructions 4 of 4

The Hashemite University Faculty of Engineering Department of Mechatronics Engineering Microprocessors and Microcontrollers Lab. Experiment 2 Input and Output Ports This experiment focuses on dealing with Input and Output Ports for PIC18F452 device. Objectives: 1. To make the student familiar with the Input and Output Ports of PIC18F452 device. 2. To know the way of choosing the port to be input or output according to the application requirements Apparatus: The devices used in this experiment are: 1. Programmer 2. PIC18F452 IC 3. Breadboard and electronic components as shown in Figure 2.1 Figure 2.1: Equipment and devices used in the experiment. Exp 2: Input and Output Ports 1 of 3

Theoretical Background: PIC18F452 Microcontroller has five I/O ports (PortA, PortB, PortC, PortD, and PortE) that can be defined as input or output ports according to application. Referring to PIC18F452 datasheet at chapter 9: Exp 2: Input and Output Ports 2 of 3

Procedure: Write a program that increases the value at portb by 1 if the button at portc-0 was pressed, decreases portb value if the button at portc-1 was pressed and moving the portb data to portd if the button at portc-2 was pressed. Build the required circuit. Program the device and make sure the circuit is ready to turn the power on. Consult your Lab. Supervisor to turn the power on. Discussion and Analysis: Observe the execution of the code in the circuit and make your decision about your program if it matches the application requirements or not. Exp 2: Input and Output Ports 3 of 3

The Hashemite University Faculty of Engineering Department of Mechatronics Engineering Microprocessors and Microcontrollers Lab. Experiment 3 Wait Code Implementation This experiment focuses on implementing wait code using PIC18F452 device. Objectives: 1. To make the student familiar with the wait code implementation in PIC18F452 device. 2. To know how to change the wait time according to the application requirements. Apparatus: The devices used in this experiment are: 1. Programmer 2. PIC18F452 IC 3. Breadboard and electronic components as shown in Figure 3.1 Figure 3.1: Equipment and devices used in the experiment. Exp 3: Wait Code Implementation 1 of 3

Theoretical Background: One way of make delays between operations is to do a wait or delay code with the required time Example: WAIT: MOVLW D 1 MOVWF TIME3 NEXT3: MOVLW D'100' MOVWF TIME2 NEXT2: MOVLW D'199' MOVWF TIME1 NEXT1: NOP NOP DECFSZ TIME1,1 GOTO NEXT1 DECFSZ TIME2,1 GOTO NEXT2 DECFSZ TIME3,1 GOTO NEXT3 The delay time of the previous code can be calculated to give 100.007 ms. Procedure: Write a code that increasing the data at portb by 1 and if the portb value was odd then it will wait for 1 second and if it is even it will wait 2 seconds to do the next increment. Build the required circuit. Program the device and make sure the circuit is ready to turn the power on. Consult your Lab. Supervisor to turn the power on. Exp 3: Wait Code Implementation 2 of 3

Discussion and Analysis: Observe the execution of the code in the circuit and make your decision about your program if it matches the application requirements or not. Exp 3: Wait Code Implementation 3 of 3

The Hashemite University Faculty of Engineering Department of Mechatronics Engineering Microprocessors and Microcontrollers Lab. Experiment 4 Analog to Digital Converter This experiment focuses on dealing with PIC18F452 device built in analog to digital converter. Objectives: 1. To make the student familiar with the PIC18F452 device A/D hardware. 2. To know how to change the different A/D settings to match the application requirements. Apparatus: The devices used in this experiment are: 1. Programmer 2. PIC18F452 IC 3. Breadboard and electronic components as shown in Figure 4.1 Figure 4.1: Equipment and devices used in the experiment. Exp 4: Analog to Digital Converter 1 of 3

Theoretical Background: A lot of sensors in the real are analog sensors that gives analog voltages, so it is important to know how to read the analog voltages using A/D hardware. Referring to PIC18F452 datasheet chapter 17: Exp 4: Analog to Digital Converter 2 of 3

Procedure: Write a code that makes a variable delay time between toggling the value of portb depending on the analog input at AN0 Program the device and make sure the circuit is ready to turn the power on. Consult your Lab. Supervisor to turn the power on. Discussion and Analysis: Observe the execution of the code in the circuit and make your decision about your program if it matches the application requirements or not. Exp 4: Analog to Digital Converter 3 of 3

The Hashemite University Faculty of Engineering Department of Mechatronics Engineering Microprocessors and Microcontrollers Lab. Experiment 5 Pulse Width Modulation This experiment focuses on dealing with PIC18F452 device built in Pulse Width Modulation hardware. Objectives: 1. To make the student familiar with the PIC18F452 device PWM hardware. 2. To know how to change the different PWM settings to match the application requirements. Apparatus: The devices used in this experiment are: 1. Programmer 2. PIC18F452 IC 3. Breadboard and electronic components as shown in Figure 5.1 Figure 5.1: Equipment and devices used in the experiment. Exp 5: Pulse Width Modulation 1 of 3

Theoretical Background: PWM is existed in a lot of applications that control some systems through changing the equivalent DC voltage, so it is important to deal with it in microcontrollers. Referring to PIC18F452 datasheet chapter 14 Exp 5: Pulse Width Modulation 2 of 3

Procedure: Write a program that changes the duty cycle of the output pulses of RC2 depending on the analog input at AN0. Program the device and make sure the circuit is ready to turn the power on. Consult your Lab. Supervisor to turn the power on. Discussion and Analysis: Observe the execution of the code in the circuit and make your decision about your program if it matches the application requirements or not. Exp 5: Pulse Width Modulation 3 of 3

The Hashemite University Faculty of Engineering Department of Mechatronics Engineering Microprocessors and Microcontrollers Lab. Experiment 6 External Interrupt This experiment focuses on dealing with PIC18F452 device built in External Interrupt handler. Objectives: 1. To make the student familiar with the PIC18F452 device Interrupt. 2. To know how to change the different Interrupt settings to match the application requirements. Apparatus: The devices used in this experiment are: 1. Programmer 2. PIC18F452 IC 3. Breadboard and electronic components as shown in Figure 6.1 Figure 6.1: Equipment and devices used in the experiment. Exp 6: External Interrupt 1 of 3

Theoretical Background: Interrupt is very important in microprocessors especially in event driven routines, so it can introduce different methods to deal with hardware. Referring to PIC18F452 datasheet chapter 8 Exp 6: External Interrupt 2 of 3

Procedure: Write a program that calculates the number of times the button at RB0 was pressed in 3 seconds time and displays it at portc. Program the device and make sure the circuit is ready to turn the power on. Consult your Lab. Supervisor to turn the power on. Discussion and Analysis: Observe the execution of the code in the circuit and make your decision about your program if it matches the application requirements or not. Exp 6: External Interrupt 3 of 3