Source: http://www.edsim51.com/8051Notes/interfacing.html#motors Motor Source: http://www.edsim51.com/8051Notes/interfacing.html#motors.

Slides:



Advertisements
Similar presentations
Week4. Program Branching  From what we have covered so far, our assembly programs execute one instruction after another in sequence  Programs that solve.
Advertisements

The 8051 Microcontroller and Embedded Systems
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
1 Chapter 3 Jump, Loop, and Call Instructions. 2 Sections 3.1 Loop and Jump Instructions 3.2 Call Instructions 3.3 Time Delay Generation and Calculation.
Msc. Ivan A. Escobar Broitman Microprocessors 1 1 The 8051 Instruction Set.
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Microcontroller Intel 8051
MICROCONTROLLER INSTRUCTION SET
CoE3DJ4 Digital Systems Design Chapter 3: instruction set summary.
Prof. Cherrice TraverEE/CS-152: Microprocessors and Microcontrollers The 8051 Assembly Language.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
MICROCONTROLLERS 8051.
The 8051 Assembly Language Branching & Subroutines
8051 Micro controller. Architecture of 8051 Features of 8051.
The 8051 Microcontroller and Embedded Systems
Lecture Set 4 Programming the 8051.
Ass Prof Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 6: Control Instructions.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
JUMP, LOOP, AND CALL INSTRUCTIONS
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني 8085 Instruction Set logic group. Branch group. Stack memory and machine control. Addressing modes.
Serial I/O Port.
Gursharan Singh Tatla INSTRUCTION SET OF 8085 Gursharan Singh Tatla Gursharan Singh Tatla
Unit 1 Instruction set M.Brindha AP/EIE
Classification of Instruction Set of 8051
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Source: Serial Port Source:
Detailed Review of the 8085 Instruction Set.
Homework Reading Labs PAL, pp
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Lecture Set 5 The 8051 Instruction Set.
Instruksi Set Prosesor 8088
Subroutines and the Stack
Microprocessor and Assembly Language
Introduction to 8085 Instructions
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 3 & 4 Part 2
Source: Motor Source:
Assembly Language Programming Part 2
Data Processing Instructions
Boolean Operations This group of instructions is associated with the single-bit operations of the This group allows manipulating the individual bits.
Source: Serial Port Source:
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
8051 Single Board Computer (SBC) Version 1.0
Timer.
(Electrical Engg 6th Semester)
Branching Instructions
Introduction to Micro Controllers & Embedded System Design Instruction set Department of Electrical & Computer Engineering Missouri University of Science.
Detailed Review of the 8085 Instruction Set.
Introduction to Micro Controllers & Embedded System Design Addressing Mode Department of Electrical & Computer Engineering Missouri University of Science.
Subroutines and the Stack
Microcontroller 8051 Made By: Arun Branch. 4th Sem. I&C Engg.
Conditional Jumps and Time Delays
DC motor.
Introduction to Micro Controllers & Embedded System Design Instruction set Department of Electrical & Computer Engineering Missouri University of Science.
Conditional Jumps and Time Delays
DMT 245 Introduction to Microcontroller
First Design Key board R L S.
EE6502/MPMC/UNIT II/STACK AND SUBROUTINE/T.THARANKUMAR
Conditional Jumps and Time Delays
Source: Serial Port Source:
Source: Motor Source:
8051 ASSEMBLY LANGUAGE PROGRAMMING
Subroutines and the Stack
Some Assembly (Part 2) set.html.
Source: Serial Port Source:
Chapter 8: Instruction Set 8086 CPU Architecture
Presentation transcript:

Source: http://www.edsim51.com/8051Notes/interfacing.html#motors Motor Source: http://www.edsim51.com/8051Notes/interfacing.html#motors

An interfacing method for turning on and off a DC motor via a microcontroller is shown below. However, the above circuit will only work for a 5 V motor. If the supply voltage is changed (for example, if the supply is changed to 12 V to run a 12 V motor) then the motor will be on all the time because 5 V applied to the base of the p-n-p transistor is not enough to turn it off.

To interface to larger motors the following circuit may be used.

Bi-directional DC Motor P3.1 P3.0 A (P3.1) B (P3.0) Motor Off 1 (5 V) On, forward On, reverse This configuration allows the controller to not only turn on and off the motor but also to set the rotating direction.

To select a 7-segment display SW0

The subroutine setDirection setDirection: PUSH ACC ; save value of A on stack PUSH 20H ; save value of location 20H (first bit-addressable ; location in RAM) on stack CLR A ; clear A MOV 20H, #0 ; clear location 20H MOV C, P2.0 ; put SW0 value in carry MOV ACC.0, C ; then move to ACC.0 MOV C, F0 ; move current motor direction in carry MOV 0, C ; and move to LSB of location 20H (which has bit address 0) CJNE A, 20H, changeDir ; | compare SW0 (LSB of A) with F0 (LSB of 20H) ; | - if they are not the same, the motor's direction needs to be reversed JMP finish ; if they are the same, motor's direction does not need to be changed changeDir: CLR P3.0 ; | CLR P3.1 ; | stop motor CALL clearTimer ; reset timer 1 (revolution count restarts when motor direction changes) MOV C, P2.0 ; move SW0 value to carry MOV F0, C ; and then to F0 - this is the new motor direction MOV P3.0, C ; move SW0 value (in carry) to motor control bit 1 CPL C ; invert the carry MOV P3.1, C ; | and move it to motor control bit 0 (it will therefore have the opposite ; | value to control bit 1 and the motor will start ; | again in the new direction) finish: POP 20H ; get original value for location 20H from the stack POP ACC ; get original value for A from the stack RET ; return from subroutine

The subroutine setDirection Subroutine name: setDirection Function: Check the status of SW0 at P2.0. If SW0 is closed, Variables: F0: The current motor direction. = 0 for reverse (anticlockwise) rotation; = 1 for forward (clockwise) rotation P2.0: The open/closed status of SW0. = 0 if SW0 is closed; = 1 if SW0 is open. P2.0: The new motor direction. (P3.1, P3.0): To control the motor direction. = (0, 1) for reverse (anticlockwise) rotation; = (1, 0) for forward (clockwise) rotation

Instruction description: MOV 0, C ; To move C to LSB of location 20H (which has bit address 0)

ICP-W11-01 = motor direction control with simplified instruction sequence In ICP-W11-011, instead of using CJNE, use other branching control instructions for the subroutine “setDirection”. This may simplify this subroutine as well as making it easier to be understood. Some Branching Control Instructions Function JB Jump if the bit (specified by the first operand) = 1. JBC Same as JB, except that the bit is clear. JNB Jump if the bit (specified by the first operand) = 0. JC Jump if the carry flag = 1 JNC Jump if the carry flag = 0 JZ Jump if the accumulator = 0 JNZ Jump if the accumulator = 1

Aliasing What causes aliasing? Ans: Source: https://en.wikipedia.org/wiki/Aliasing Floaty bird floating: https://www.youtube.com/watch?v=hE24WVo_feQ Helicopter flying with no blades spinning: https://www.youtube.com/watch?v=jQDjJRYmeWg

Aliasing - Wagon wheel effect https://www.youtube.com/watch?v=9MN5MF72PHs&t=187s

Example 10 The motor

Example 10 The motor setDirection: ;---------------- The following instructions are deleted. ---------------------------------- ;delete PUSH ACC ; save value of A on stack ;delete PUSH 20H ; save value of location 20H (first bit-addressable ;delete ; location in RAM) on stack ;delete CLR A ; clear A ;delete MOV 20H, #0 ; clear location 20H ;delete MOV C, P2.0 ; put SW0 value in carry ;delete MOV ACC.0, C ; then move to ACC.0 ;delete MOV C, F0 ; move current motor direction in carry ;delete MOV 0, C ; and move to LSB of location 20H (which has bit address 0) ;delete CJNE A, 20H, changeDir ; | compare SW0 (LSB of A) with F0 (LSB of 20H) ;delete ; | - if they are not the same, the motor's direction needs to be reversed ;------------- The deleted instruction sequence is replaced with the instruction sequence BELOW --------------- JB P2.0,SW0_open SW0_closed: JB F0,changeDir JMP finish SW0_open: JNB F0,changeDir ;------------- The deleted instruction sequence is replaced with the instruction sequence ABOVE --------------- JMP finish ; if they are the same, motor's direction does not need to be changed changeDir: CLR P3.0 ; | CLR P3.1 ; | stop motor CALL clearTimer ; reset timer 1 (revolution count restarts when motor direction changes) MOV C, P2.0 ; move SW0 value to carry MOV F0, C ; and then to F0 - this is the new motor direction MOV P3.0, C ; move SW0 value (in carry) to motor control bit 1 CPL C ; invert the carry MOV P3.1, C ; | and move it to motor control bit 0 (it will therefore have the opposite ; | value to control bit 1 and the motor will start ; | again in the new direction) finish: ;delete POP 20H ; get original value for location 20H from the stack ;delete POP ACC ; get original value for A from the stack RET ; return from subroutine clearTimer: CLR A ; reset revolution count in A to zero CLR TR1 ; stop timer 1 MOV TL1, #0 ; reset timer 1 low byte to zero SETB TR1 ; start timer 1 LEDcodes: ; | this label points to the start address of the 7-segment code table which is ; | stored in program memory using the DB command below DB 11000000B, 11111001B, 10100100B, 10110000B, 10011001B, 10010010B, 10000010B, 11111000B, 10000000B, 10010000B Example 10 The motor SW0 P2.0 (Desired direction) F0 (Current direction) P3.1 P3.0 Clockwise Open 1 Counter Clockwise Close