Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.

Slides:



Advertisements
Similar presentations
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Advertisements

م/محمد علي عطية حسين. Pin Diagram DescriptionPin Name Oscillator crystal input/external clock source input. OSC1/CLKIN Oscillator crystal output.OSC2/CLKOUT.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
The 8051 Microcontroller and Embedded Systems
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
By Muhammad Ali Mazidi, Rolin McKinlay, Danny Causey
Prof. Jorge A. Ramón Introducción a Microcontroladores.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
EE1A Revision What should you be expected to do in a typical exam question ? Understanding of basic principles. Ability to perform simple circuit analysis.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Programming and Problem Solving
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Railway Foundation Electronic, Electrical and Processor Engineering.
8051 ASSEMBLY LANGUAGE PROGRAMMING
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
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.
Microcontroller Architecture PIC18F Family
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Chapter 4 Starting to Program – an Introduction to Assembler The aims of this chapter are to introduce: the essentials of Assembler programming; the Microchip.
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1.
Building Assembler Programs Chapter Five Dr. Gheith Abandah1.
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
Parallel Ports, Power Supply and the Clock Oscillator Material to be covered  Parallel I/O ports  Interfacing external switches and LEDs  Clock Oscillator.
CoE3DJ4 Digital Systems Design
Stack Stack Pointer A stack is a means of storing data that works on a ‘Last in first out’ (LIFO) basis. It reverses the order that data arrives and is.
Lecture – 4 PIC18 Family Instruction Set 1. Outline Literal instructions. Bit-oriented instructions. Byte-oriented instructions. Program control instructions.
Embedded System Spring, 2011 Lecture 5: The PIC Microcontrollers Eng. Wazen M. Shbair.
Chapter 2 Introducing the PIC Mid-Range Family and the 16F84A The aims of this chapter are to introduce: The PIC mid-range family, in overview The overall.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Department of Electronic & Electrical Engineering Template program. Input / Output (IO) ● Template program. ● Introduction to IO ● Setting up for IO ●
Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.
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 2. PIC16F84A Architecture / Instructions Memory. Program/Data (Harvard) File Registers (Data).
Working with Time: Interrupts, Counters and Timers
1 EKT 225 MICROCONTROLLER I CHAPTER ASSEMBLY LANGUAGE PROGRAMMING.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
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.
An Introduction to Embedded Systems, and the PIC Microcontroller Lecture 8: Interrupts The aims of this session are to explore the structure and application.
Prof. Ahmad Abu-El-Haija
Control Unit Lecture 6.
Assembly Language Programming of 8085
Microprocessor Systems Design I
The 8051 Microcontroller and Embedded Systems
Microprocessor Systems Design I
PIC – ch. 2b Md. Atiqur Rahman Ahad.
PIC 16F877.
Microprocessor Systems Design I
Chapter 1 Introduction.
Introducing the PIC Mid-Range Family and the 16F84A
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
8051 ASSEMBLY LANGUAGE PROGRAMMING
EECE.3170 Microprocessor Systems Design I
Computer Operation 6/22/2019.
Presentation transcript:

Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department بسم الله الرحمن الرحيم EELE 4315 — Fall 2010 Lecture 6

Programming methods What options do we have for programming a microcontroller? The Problem of Programming, and Programming Options Use Machine Code Use High Level Language Use Assembler

Assembler option The Assembler Option

Developing a Simple Project Write/modify Source Code Assemble/Compile (Simulate) Download Test in Hardware

Instruction set for PIC 16 series what does each column represent?

PIC 16XXX Instruction Set Operand Codes. f for file (i.e. memory location in RAM), a 7-bit number; b for bit, to be found within a file also specified, a 3-bit number; d for destination, as described above, a single bit; k for literal, an 8-bit number if data, or 11-bit if address

Status register The STATUS register contains the arithmetic status of the ALU, the RESET status and the bank select bit for data memory. As with any register, the STATUS register can be the destination for any instruction. If the STATUS register is the destination for an instruction that affects the Z, DC or C bits, then the write to these three bits is disabled. These bits are set or cleared according to device logic. Furthermore, the TO and PD bits are not writable. Therefore, the result of an instruction with the STATUS register as destination may be different than intended. For example, CLRF STATUS will clear the upper three bits and set the Z bit. This leaves the STATUS register as 000u u1uu (where u = unchanged). Only the BCF, BSF, SWAPF and MOVWF instructions should be used to alter the STATUS register, because these instructions do not affect any status bit.

Status Register

Some Example Instructions clrw This clears the value in the W register to zero. There are no operands to specify. Column 5 tells us that the Status Register Z bit is affected by the instruction. As the result of this instruction is always zero, the bit is always set to 1. No other status register bits are affected. clrf f This clears the value of a memory location, symbolised as f. It is up to the programmer to specify a value for f. Again, because the result is zero, the Status Register Z bit is affected. addwf f,d This adds the contents of the W register to the contents of a memory location symbolised by f. It is up to the programmer to specify a value for f. There is a choice of where the result is placed, as discussed above. This is determined by the value of the operand bit d. Because of the different values that the result can take, all three condition code bits, i.e. Z, the Carry bit C, and the Digit Carry bit DC are affected by the instruction.

Some Example Instructions bcf f,b This instruction clears a single bit in a memory location. Both the bit and the location must be specified by the programmer. The bit number b will take a value from 0 to 7, to identify any one of the 8 bits in a memory location. No Status Register flags are affected, even though it is possible to imagine that the result of the instruction could be to set a memory location to zero. addlw k This instruction adds the value of a literal, whose value k must be specified by the programmer, to the value held in the W register. The result is stored in the W register; there is no choice. Like addwf, all condition code bits can be affected by this instruction.

Writing in Assembler label instruction operand(s) ;comment Assembler format: ;now switch on red led Start bsf status,5 ;select memory bank 1 addwf counter For example: labelcomment operands commentLeft-most space optional instruction

Assembler Directives These look like Assembler mnemonics, but are instructions to the (Cross-) Assembler program itself. They differ from one Assembler to the other, though there does tend to be some similarity. Assembler DirectiveSummary of Action listimplement a listing option* #includeinclude additional source file orgset program origin equdefine an assembly constant; this allows us to assign a value to a label endend program block Example MPASM Directives

Representing Numbers RadixExample Representation Decimal D ‘ 255 ’ Hexadecimal H ‘ 8d ’ or Ox8d Octal O ‘ 574 ’ Binary B ‘ ’ ASCII ‘ G ’ or A ‘ G ’

Assembler File Structure (Simple Form) For us, this will be MPLAB Written by you, as a text file, in Assembler format Files that the Assembler (e.g. MPLAB) generates Source File Assembler Executable File List File Error File.asm.hex.lst.err

A Complete 16 Series Assembler Program ;This program moves push button switch values from Port A to the ;leds on Port B ;************************************************************** ; ;Configuration Word: WDT off, power-up timer on, code protect off, RC oscillator ; list p=16F84A ;specify SFRs status equ 03 porta equ 05 trisa equ 05 portb equ 06 trisb equ 06 ; org 00 ;Initialise startbsfstatus,5 ;select memory bank 1 movlwB' ' movwftrisa;port A according to above pattern movlw00 movwftrisb;all port B bits output bcfstatus,5 ;select bank 0 ; ;The “main” program starts here clrf porta;clear all bits in ports A loopmovfporta,0;move port A to W register movwfportb;move W register to port B gotoloop end Opening explanatory comments SFR locations specified, by equating labels to numbers, taken directly from RAM memory map Initialisation Actual Program Program start address specified Directive specifying processor

Software MPLAB v8.00 “ASSEMBLER+ SIMULTATOR”

Software IC-Prog1.05” programmer software

Software Pic simulator

Software Proteus V7.1 “simulator for circuits”