Chapter 3. Bit Addressable Area. By DeccanRobots

Similar documents
8051 Microcontroller Logical Operations. Prepared by : A. B. Modi Target Audience : 5 th Semester Students

Arithmetic and Logic

Assembly Language programming (2)

8051 Programming: Arithmetic and Logic

ELEG3923 Microprocessor Ch.4 I/O Ports

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

ET355 Microprocessors Thursday 6:00 pm 10:20 pm

TUTORIAL Assembly Language programming (2)

Microcontroller Intel [Instruction Set]

Department of EIE / Pondicherry Engineering College. Timer/Counters. Department of EIE / Pondicherry Engineering College 1

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

8051 Microcontroller


Embedded Controller Programming

Principle and Interface Techniques of Microcontroller

Microcontroller. Instruction set of 8051

SN8F5000 Family Instruction Set

Dodatak. Skup instrukcija

Chapter 09. Programming in Assembly

Principle and Interface Techniques of Microcontroller

Programming of 8085 microprocessor and 8051 micro controller Study material

JUMP, LOOP AND CALL INSTRUCTIONS

Introduction To MCS-51

2. Write an 8051 program to generate a square wave of 25 khz at pin P2.3 using XTAL = 12 MHz. Solution:

ENE 334 Microprocessors

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

Department of Electronics and Instrumentation Engineering Question Bank

MICROPROCESSOR LABORATORY MANUAL

Module Contents of the Module Hours COs

Dragonchip. Instruction Set Manual

ELEG3923 Microprocessor Ch.6 Arithmetic and Logics

MISSOURI UNIVERSITY OF SCIENCE & TECHNOLOGY. BCD Arithmetic. Implementing the Decimal Adjust Command in WIMP51 CpE-213 Sp 2014 Project 1 3/17/2014

WZMICRO>COM

UNIT-III ASSEMBLY LANGUAGE PROGRAMMING. The CPU can access data in various ways, which are called addressing modes

Question Bank Microprocessor and Microcontroller

ELEG3923 Microprocessor Ch.9 Timer Programming

C51 Family. Architectural Overview of the C51 Family. Summary

FACULTY OF ENGINEERING LAB SHEET

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

3. (a) Explain the steps involved in the Interfacing of an I/O device (b) Explain various methods of interfacing of I/O devices.

ET355 Microprocessors Friday 6:00 pm 10:20 pm

Q.1. A) Attempt any THREE of the following:

Assembly Language programming (3)

CPEG300 Embedded System Design. Lecture 6 Interrupt System

Digital Blocks Semiconductor IP

Programming Book Microcontroller Kit. Rev 3.0 January, Wichit Sirichote

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

SOLUTION MANUAL FOR THE 8051 MICROCONTROLLER 4TH EDITION BY MACKENZIE AND PHAN


APPLICATION NOTE 601 Accelerating 16/32-Bit Math Operations with the DS80C390/ DS80C400

CHAPTER TIMER PROGRAMMING

MICROCONTROLLER BASED WATER LEVEL CONTROL SYSTEM

ELEG3924 Microprocessor

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP

MASSEY UNIVERSITY PALMERSTON NORTH CAMPUS

Chapter 6 Interrupts. (I. Scott Mackenzie) By: Masud-ul-Hasan

DR bit RISC Microcontroller. Instructions set details ver 3.10

Timers and interrupts

MODEL ANSWER SUMMER 17 EXAMINATION Subject Title: Microcontroller and Applications Subject Code:

Q. Classify the instruction set of 8051 and list out the instructions in each type.

8051 I/O and Class 6 EE4380 Spring 03. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

8051 Programming using Assembly

UNIT THE 8051 INSTRUCTION SET AND PROGRAMMING

1. Pin diagram of 8051 and ports

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

Microcontroller and Embedded Systems:

8051 Single Board Monitor Programming. Minmon - Yeralan & Ahluwalia. PaulMon1 & PaulMon2 - Paul Stoffregen

CPEG300 Embedded System Design. Lecture 8 Timer

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

80C51 family programmer s guide and instruction set. 80C51 Family. PROGRAMMER S GUIDE AND INSTRUCTION SET Memory Organization. Philips Semiconductors

8051 Core Specification

What Registers are available? Programming in Assembler. Assembler Programming - like early Basic. Assembler Data Movement Instructions

~: Simple Programs in 8051 assembly language :~

Application Brief D-005

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

Interrupt Programming: Interrupts vs. Polling Method:

INTERFACING 16 2 LCD WITH 8051

CS 320. Computer Architecture Core Architecture

MCS -51 Programmer s Guide and Instruction Set

LCDD Application Note

Introduction to uc & Embedded Systems

8051 Microcontrollers

Control Transfer Instructions Jump, Loop, and Call. ECE473/573 Microprocessor System Design, Dr. Shiue

SUMMER 13 EXAMINATION

Input/Output Ports and Interfacing LCD & Seven Segment Display

Interrupts. EE4380 Fall 2001 Class 9. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Vidyalankar T.E. Sem. V [ETRX] Microprocessors and Microcontrollers I Prelim Question Paper Solution

Microcontroller and Applications

8051 Timers. Class 7 EE4380 Fall Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

The 8051 microcontroller has two 16-bit timers/counters called T0 and T1.

Chapter Family Microcontrollers Instruction Set

8051 Microcontroller Assembly Programming

8051 Microcontroller

TUTORIAL. Donal Heffernan University of Limerick May Tutorial D.Heffernan 2000,

8051 Serial Port. EE4380 Fall02 Class 10. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Legacy documentation refer to the Altium Wiki for current information. TSK52x MCU

Advantages of Using a Dallas Semiconductor DS1232 MicroMonitor

FlashFlex51 Microcontroller Control of CompactFlash Card in TrueIDE Mode

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATION ENGINEERING QUESTION BANK

Transcription:

Chapter 3 Bit Addressable Area By DeccanRobots

What is Bit Addressable Area? FFh 2Fh 20h 00h Data Memory General purpose Memory Area Bit Addressable Memory Registers Memory Area from 20H to 2FH is Bit addressable Area.

What is Bit Addressable Area? FFh This memory area can be accessed as a byte as well as a bit. 2Fh 20h 00h Data Memory Part of Bit addressable Memory area shown here 13 04 03 02 09 01 00 25h 24h 23h 22h 21h 20h

What is Bit Addressable Area? FFh e.g. MOV 20h,#55h will copy 55h value to 20h Memory Area. This is Byte level access Part of Bit addressable Memory area shown here 2Fh 20h 00h Data Memory 13 04 03 02 09 01 00 25h 24h 23h 22h 21h 20h

What is Bit Addressable Area? FFh e.g. SETB 00h will copy Binary 1 value to Bit address 00. This is Bit level access Part of Bit addressable Memory area shown here 2Fh 20h 00h Data Memory 13 04 03 02 09 01 00 25h 24h 23h 22h 21h 20h

What is Bit Addressable Area? This bit is named as 01h This bit is named as 00h This bit is named as 02h This bit is named as 0Dh which is 13 th Bit in bit addressable area 13 04 03 02 09 01 00 25h 24h 23h 22h 21h 20h

What is Bit Addressable Area? Question for you: SETB 20h code will copy Binary 1 at which Location? 13 04 03 02 09 01 00 25h 24h 23h 22h 21h 20h

What is Bit Addressable Area? SETB command is used to copy Binary 1 at address provided in command SETB 12h will copy Binary 1 at 12h location in Bit addressable area

What is Bit Addressable Area? CLR command is used to copy Binary 0 at address provided in command CLR 12h will copy Binary 0 at 12h location in Bit addressable area

What is Bit Addressable Area? Similarly All ports P0, P1, P2, P3 are bit addressable. In other words we can access all 8 bits(1 Byte) of any port at a time or we can access single bit individually.

What is Bit Addressable Area? MOV P2,#55h will change all 8 bits of P2 SETB P2.3 will make 3 rd Bit of P2 ( Pin number 24 of Controller to 1 state) CLR P2.0 will make 0 th Bit of P2 ( Pin number 21 of Controller to 0 state)

What is Bit Addressable Area? Hence we understand that section of data memory can be accessed as Byte and as Bit too. Each bit has its own address like 00h, 01h, 02h etc. SETB or CLR command can be used to modify values of any Bit.

What is Bit Addressable Area? MOV 00h,#00h CLR 00h Are you able to make difference between these two commands?

What is Bit Addressable Area? MOV 00h,#00h CLR 00h Are you able to make difference between these two commands? Remember: CLR Command is always used for a BIT. Hence CLR 00h command will copy Binary 0 to bit addressable area s 00h location

What is Bit Addressable Area? Remember: CLR Command is always used for a BIT. Hence CLR 00h 25h command will copy Binary 0 to bit addressable area s 00h location 13 04 03 02 09 01 00 24h 23h 22h 21h 20h

What is Bit Addressable Area? MOV 00h,#00h Will copy value 00h To memory location 00h i.e. R0 0 0 0 0 0 0 0 0 FFh 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 02h 01h 00h

What is Bit Addressable Area? MOV 00h,#00h CLR 00h Are you able to make difference between these two commands?

Second Application: Toggle LED using Micro Switch Use one Micro switch and 1 LED provided on Interfacing board. Initially LED will be OFF Press Switch once to make it ON Press it again to make it OFF Press it again to make it ON This will continue.

Toggle LED using Micro Switch Refer Application 1.2 from Book Refer Circuit diagram Make connection accordingly and send program to 89S52. LED Micro Switch

Toggle LED using Micro Switch SETB P2.0 Loop: JB P1.0, Loop CPL P2.0 Debounce: JNB P1.0, Debounce SJMP Loop Code is Explained on Next Slide Make LED OFF Wait till Switch is not pressed Change State of LED Wait till Switch is fully released

Toggle LED using Micro Switch SETB P2.0 Loop: Label JB P1.0, Loop Make LED OFF JB Command is used to jump to label specified if bit is 1 Here if P1.0 is 1 then program will jump to Loop. In other words, if switch is not pressed, P1.0 will remain to 1 state, and program will remain in Loop

Toggle LED using Micro Switch SETB P2.0 Loop: JB P1.0, Loop CPL P2.0 Make LED OFF JB Command is used to jump to label specified if bit is 1 Label Complement P2.0 CPL is complement, which will change state of P2.0 to 0 if it is 1 OR will make it 1 if it is 0

Toggle LED using Micro Switch SETB P2.0 Loop: JB P1.0, Loop CPL P2.0 Debounce: JNB P1.0, Debounce SJMP Loop JNB command is used to Jump to label if bit is 0. If bit is 1 then it will continue program to next line Program will jump to Loop

Toggle LED using Micro Switch Commands you have learnt till now: MOV SETB CLR CPL JB JNB SJMP

What is SFR? Special Function Register These are 1 byte or 2 bytes memory locations. SFR is not part of data memory. Microcontroller has a separate memory area allocated for all SFRs.

What is SFR? E.g. P0, P1, P2 and P3 (All ports) are SFRs. Another SFR commonly used in BIT operations is PSW. Address of P0 is 80h Address of P1 is 90h Address of P2 is A0h Address of P3 is B0h Address of PSW is D0h

What is SFR? Hence following code will have same effect because A0 is address of P2 MOV 0A0h,#55h Make sure to OR MOV P2,#55h add 0 (Zero) before hex value, if hex value is starting with a character

What is SFR? PSW Register 7 th bit CARRY FLAG Known as C 0 th bit D0 It is used to store result of most of the Boolean Operations

What is SFR? 7 th Bit of PSW is Known as C C is used in many commands to store operation done over bit.

Back to Bits.. ANL C,bit-address ANL C,03h This command will AND value of C with value of address 03h. Move to next slide to understand it in detail.

Back to Bits.. Logical Operation SETB C CLR 03h ANL C, 03h Location C=1 Location 03h=0 1 AND 0 = 0 Result of this operation is always stored in Left Operand. Here it will be stored in C Finally value of C will be 0

Logical Operation for Bits Similarly: E.g. ORL C,bit-address CPL bit-address CLR bit-address CPL C CLR C ORL C,03h CPL 03h CLR 03h CPL C CLR C

Logical Operation for Bits Next Instruction is: e.g. SETB C CLR 03h ANL C,/03h ANL C,/bit-address Slash ( / ) indicate complement AND operation between C and Complemented value of 03h will be executed. Value of 03h is never changed.

Logical Operation for Bits Similarly: ORL C,/bit-address

Logical Operation for Bits Commands you have learnt till now: MOV SETB CLR CPL JB JNB SJMP ANL ORL

How to Practice More? To practice more, write code in 8051IDE, assemble your program and use F11 key to execute in steps on computer. Use PORT, Registers window to check results and changes in values. These windows can be opened from Menu View-Registers or View-Ports in 8051IDE as shown in next slide.

How to Practice More?

End of Chapter 3 This is END of 3 rd Chapter Open 4 th Chapter to interface Stepper Motors and DC Motors.