VTech Alphabert s Magic Readport User Manual Page 62

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 61
Lab Manual of Microcontroller & Interfacing Page 62
Sequence of pulses required to send on port P0 to rotate motor in clockwise and anticlockwise
direction for half step mode:
Program 2: To rotate motor in half step mode continuously in clockwise direction.
ORG 40h
LOOP:
MOV P0,,#00h ;Define port P0 as output port
MOV P0,#01h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#03h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#02h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#06h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#04h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#0Ch ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#08h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
MOV P0,#09h ;Sent data to port 1 (stepper motor)
CALL DELAY ;Delay to control speed
JMP LOOP ;Continue rotation
DELAY: MOV R2,#0FFh ;Change this count to change speed
d_loop: DJNZ R2,d_loop
RET
END
:: WORKSHEET ::
A. Consider that two push-button switches are connected at port pins P3.2 and P3.3. Write a
program so that speed of the motor increases if switch connected at P3.2 pressed and
speed of the motor reduces if switch connected at port pin P3.3 is pressed.
(Hint: use polling method or interrupt method to monitor key press event, reduce timer
delay counter if switch connected at P3.2 is pressed. Increase time delay counter if switch
connected at P3.3 is pressed)
Page view 61
1 2 ... 57 58 59 60 61 62 63 64 65 66 67 ... 79 80

Comments to this Manuals

No comments