Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.

Slides:



Advertisements
Similar presentations
Working with time: interrupts, counters and timers Chapter Six Dr. Gheith Abandah1.
Advertisements

EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Embedded System Spring, 2011 Lecture 9: I/O Programming Eng. Wazen M. Shbair.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Prof. Jorge A. Ramón Introducción a Microcontroladores.
Programming the ATmega16
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Railway Foundation Electronic, Electrical and Processor Engineering.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 26: PIC microcontroller intro.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 30: PIC data memory.
Microcontroller Architecture— PIC18F Family
Railway Foundation Electronic, Electrical and Processor Engineering.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Module 2 – Digital I/O Output: Use the digital port to provide signals to display a number on a seven segment light emitting display (LED) display by wiring.
Chapter 4 Starting to Program – an Introduction to Assembler The aims of this chapter are to introduce: the essentials of Assembler programming; the Microchip.
Smart-grid Interface with Photovoltaic Installation – Phase 2 PP-01 Team members: Matt Koresh Ivan Mills Matt Martin Advisor: Dr. Aliprantis.
9/20/6Lecture 21 -PIC Architecture1 PIC Architecture Instruction Set.
Microcontroller Programming How to make something almost do something else Raffi Krikorian MAS November 2003.
Dr. Hoganson CSIS Segment Display and Count by 16 This is our third lab using the 68HC11 microcontroller. We will write a program that counts by.
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Stacks and Subroutines ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Building Assembler Programs Chapter Five Dr. Gheith Abandah1.
Parallel Ports, Power Supply and the Clock Oscillator Material to be covered  Parallel I/O ports  Interfacing external switches and LEDs  Clock Oscillator.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
I/O PORTS (Simplest Peripherals) PORT A: 6 bits wide (7th and 8th bit always read as 0) PORT B: 8 bits wide PORT C: 8 bits wide PORT D: 8 bits wide.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Experiment 7 VHDL Modeling of Embedded Microprocessors and Microcontrollers.
Programmable Peripheral Interface Parallel port Interface 8255
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
Department of Electronic & Electrical Engineering Template program. Input / Output (IO) ● Template program. ● Introduction to IO ● Setting up for IO ●
Department of Electronic & Electrical Engineering LCD character display (parallel interface). How to interface a LCD character display to a PIC.
Department of Electronic & Electrical Engineering Serial interfaces Serial Interfaces allow communication between devices sending one bit at a time. In.
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 Seven segment display Subroutines.
Department of Electronic & Electrical Engineering Introduction to microcontrollers A microcontroller is a small computer on a single integrated circuit.
Department of Electronic & Electrical Engineering Further work? Simple Voltmeter. ● Analogue to Digital converter (MCP3001 SPI ) ● Analogue → 10bit binary.
Serial Peripheral Interface SPI I2C (i-squared cee)
Department of Electronic & Electrical Engineering Lecture 2. PIC16F84A Architecture / Instructions Memory. Program/Data (Harvard) File Registers (Data).
Department of Electronic & Electrical Engineering Introduction to microcontrollers A microcontroller is a small computer on a single integrated circuit.
Department of Electronic & Electrical Engineering Lecture 4. ➢ Loops ➢ Delays ➢ Conditional instructions ➢ Simple clock example.
Department of Electronic & Electrical Engineering Lecture 3. ● Template program. ● Introduction to IO ● PORTA PORTB TRISA TRISB ● Using a subroutine ●
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
5-2-1 PIC microcontroller. Learning objectives To aid revision, areas that are examinable are identified by a vertical line in the left margin. Where.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ read/write and clock inputs Sequence of control signal combinations.
I/O PORTS. General purpose I/O pins can be considered the simplest of peripherals. They allow the PICmicro™ to monitor and control other devices. To add.
Applications examples. A binary count : stepped manually and reset with push buttons. Define ports Reset portd Reset =0? INCF portd no Step =0? yes.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
16F877A.
Prof. Ahmad Abu-El-Haija
Chapter 10 PIC18 Serial Port Programming in Assembly
Microprocessor Systems Design I
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
Microprocessor Systems Design I
Microprocessor Systems Design I
Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
INSTRUCTION SET.
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
PIC Serial Port Interfacing
PIC Serial Port Interfacing
Presentation transcript:

Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display

Department of Electronic & Electrical Engineering Background reading Quintessential PIC. Chapter 11 (lots of detail here that we skip in the lecture). ➢ IO ports. ➢ Using a lookup table. ➢ call and retlw instructions ➢ Seven segment LED display.

Department of Electronic & Electrical Engineering Input and output (from PIC16F84A sheet) 4.1 PORTA and TRISA Registers PORTA is a 5-bit wide, bi-directional port. The corresponding data direction register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected pin)

Department of Electronic & Electrical Engineering PORTA and TRISA

Department of Electronic & Electrical Engineering Selecting a data bank The status register has various bits that can be read and written. See next slide.....

Department of Electronic & Electrical Engineering Configuring PORTA

Department of Electronic & Electrical Engineering Example: copying data from portA to portB bsf STATUS,5 ;select bank 1 movlw B' ' ;set up port B as all outputs movwf TRISB movlw B' ' ;set up port A 0-3 as inputs movwf TRISA bcf STATUS,5 ;select bank 0 loop movfw PORTA ; input PORTA movwf PORTB ; output to PORTB goto loop ; loop forever end

Department of Electronic & Electrical Engineering Seven Segment LED Display

Department of Electronic & Electrical Engineering Seven Segment Display Internal Circuit

Department of Electronic & Electrical Engineering Connecting to PORTA using wires.

Department of Electronic & Electrical Engineering Converting to seven segment display ● We have 4 bits of input (a hex number). ● We want to display the corresponding character on the 7seg display. ● Each segment can be represented by a bit of a binary number. ● The problem is to lookup the correct 7seg code for each 4bit number. ● This can be done using a lookup table.

Department of Electronic & Electrical Engineering Lookup table using programmed return. ; stuff here..... ; w contains the 4 bit number call conversion ; w now contains the 7 segment code ;....more stuff here ; convert 4bit number in w into a seven segment code. conversion: ; this is just a label for the assembler addwf PCL ; add w to the PC (jump) retlw B' ' ; 0 return 7 seg code. retlw B' ' ; 1 retlw B' ' ; 2 retlw B' ' ; 3 retlw B' ' ; 4

Department of Electronic & Electrical Engineering Demo Do a demo now Dr Leonard....

Department of Electronic & Electrical Engineering