C HAPTER 2 PIC 16F887 M ICROCONTROLLER Eng. Hazem W. Marar.

Slides:



Advertisements
Similar presentations
I/O Interfacing and Programming
Advertisements

Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Mr. Banyat Somsupan ubonTecnical Unit 2. Electronic Ubontecnical.
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.
Full Adder Display. Topics A 1 bit adder with LED display Ripple Adder Signed/Unsigned Subtraction Hardware Implementation of 4-bit adder.
Chung-Ta King National Tsing Hua University
C Examples 1.
Input/Output (I/O) Ports and Interfacing
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
C Examples 4.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
1 Lab2: A/D Converter. 2 This circuit connects a variable voltage to an A/D port on the AVR mcu. Your software running on the AVR mcu will read the digital.
Slides created by: Professor Ian G. Harris Inputs and Outputs PIC Vcc RA3 RA4 RA5  Make an LED toggle state when button is pressed  Need to read RA3,
Chapter 1 Eng. Hazem W. Marar.  Arduino is an open-source single-board microcontroller using Atmel AVR processor and an on-board I/O support.  The Arduino.
Programming the ATmega16
AVR Programming CS-212 Dick Steflik. ATmega328P I/O for our labs To get data into and out of our Arduino its a little trickier than using printf and.
Learn by doing Less is more Frank Vahid (UC Riverside) Tony Givargis (UC Irvine)
Railway Foundation Electronic, Electrical and Processor Engineering.
An Embedded C Program 1 Mainly from textbook: Embedded C Programming and the Atmel AVR 2 nd Edition Barnett, Cox and O’Cull.
Dr. Amr Talaat. #include ; /* this makes the header file for the PIC16f877 ready to be used in the C-class */ #define LED PORTC ; /* defines.
Robotics Research Laboratory Louisiana State University.
Microcontroller Programming How to make something almost do something else Raffi Krikorian MAS November 2003.
chipKit Sense Switch & Control LED
© AJH 2013, V2.0 Computer Programming Embedded Systems Programming Stand-alone code, system initialisation, operating systems. Low-level operations; port.
Introduction to Using MPLAB and Hi-tide Group #9 JoseAlex MikeRoberto Goto and print the file
Input/Output Ports and Interfacing
One of the most important feature of the microcontroller is a number of input/output pins used for connection with peripherals. In the case of PIC 167CX,
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Engineering 1040: Mechanisms & Electric Circuits Winter 2015 Interfacing Light-Emitting Diodes (LEDs) & Push Buttons to Microcontrollers.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
Warmup – 16FEB2012 This one is for practice. I have paper if you need it. Suppose there are eight, single-pole, single-throw (SPST) switches connected.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Input Interface – Microprocessor
1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm.
C Examples 1. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
C Examples 1. Download Links dsPIC30F4011/4012 Data Sheet dsPIC30F4013/3014 dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.
Arduino Mega Arduino Mega 2560 Arduino Mega 2560.
PIC16F887.
Intro. Interfacing & Electronics 1 Interfacing Introduction.
Bit Manipulation in 'C' 'C' bit operators
ECE 447: Lecture 12 Keypads ECE 447: Lecture 10. ECE 447: Matrix Keypad.
Microcontroller basics Embedded systems for mortals.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
:Blink Blink: Er. Sahil Khanna
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
Introduction to Projects using Microcontroller Md. Khalilur Rhaman Credit: Interface Lab.
Applications examples. A binary count : stepped manually and reset with push buttons. Define ports Reset portd Reset =0? INCF portd no Step =0? yes.
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
Microprocessors A practical approach..
 Mini-Computer ◦ Microprocessor  The Brains  Arithmetic Logic Unit (ALU)  Control Unit  Program/ Data Storage  Peripherals (Input/Output)  Low-Cost.
Making a 24hr Timer.
Microprocessor Systems Design I
4-Integrating Peripherals in Embedded Systems (cont.)
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
EECE.3170 Microprocessor Systems Design I
Microprocessor Systems Design I
Chapter 2 Push button and Potentiometer
सोलर पॅनेलचा उपयोग करुन रीचर्जेबल टॉर्च बनवणे.
555 Integrated Circuit (IC)
I/O Ports in AVR Sepehr Naimi
AVR Programming in C Chapter 7
AVR Programming in C Chapter 7
I/O Ports in AVR Sepehr Naimi
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
Objective of the lesson
Presentation transcript:

C HAPTER 2 PIC 16F887 M ICROCONTROLLER Eng. Hazem W. Marar

P IC 16F887

P ORTS

A NALOG P INS

I N M IKRO C

A NSEL AND A NSELH

T URN LED ON void main() { TRISB = 0 ; // set PORTB as OUTPUT PORTB = 0xff; // turn all LEDs ON }

W RITE A CODE TO TOGGLE AN LED

D ELAYS void main( ) { TRISB = 0 ; // set PORTB as OUTPUT While(1) // forever { PORTB = 0xff ; // turn all LEDs ON Delay_ms(500) ; // wait 500 ms PORTB = 0 ; // turn all LEDs OFF Delay_ms(500) ; // wait 500 ms } }

U SE AN INPUT SIGNAL ( PUSH BUTTON ) TO CONTROL AN LED

I NPUT SIGNAL void main( ) { TRISB = 0x01 ; // set 1 st bit of PORTB as INPUT While(1) // forever { if(PORTB.F0 ==1) { PORTB.F1 = 1;} if(PORTB.F0 ==0) { PORTB.F1 = 0;}}

U SE AN INPUT SIGNAL ( PUSH BUTTON ) TO TOGGLE AN LED

TOGGLE unsigned short LastButton =0; void main(){ TRISC = 0x01 ; PORTC=0x00; while(1) { if(PORTC.F0 ==1 && LastButton ==0) { PORTC.F1=~PORTC.F1; LastButton=1;} else { LastButton = PORTC.F0; } } }

B OUNCING EFFECT unsigned short current; unsigned short debounce ( ) { current = PORTB.F0; if( LastButton != current) { delay_ms(5); current = PORTB.F0;} return current; }

U SE PUSH BUTTONS TO CHANGE FLASHING DELAYS

U SE A SINGLE PUSH BUTTON TO CHANGE FLASHING DELAYS

M ANAGING I NDIVIDUAL B ITS

U SE AN INPUT SIGNAL ( PUSH BUTTON ) TO CONTROL A LED MATRIX

U SE PUSH BUTTONS TO CONTROL MULTIPLE LED MATRICES

L AB EXERCISE Chapter 2