VTech Alphabert s Magic Readport User Manual Page 69

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 68
BM Dept., Govt. Engg. College, Gandhinagar Page 69
Program: Write a program to rotate DC motor connected in above circuit such that when switch
SW1 is pressed, motor rotates in clockwise direction and when SW2 is pressed, motor rotates in
anti-clockwise direction. Use external interrupts for the program.
ORG 00h
AJMP START
ORG 03h ; Vector location for external interrupt 0
SETB P1.1 ; Rotate motor in clockwise direction
CLR P1.0 ; -- do --
RETI
ORG 13h ; Vector location for external interrupt 1
SETB P1.1 ; Rotate motor in anticlockwise direction
CLR P1.0 ; -- do --
RETI
START: CLR P1.0 ; Make P1.0 output pin
CLR P1.1 ; Make P1.1 output pin
CLR P1.2 ; Make P1.2 output pin
MOV IE,#85h ; Enable external interrupt 0 and 1
SETB IT0 ; Negative edge triggered interrupt
SETB IT1 ; Negative edge triggered interrupt
SETB P1.0 ; Enable chip L293 (H-bridge)
HERE: SJMP HERE
:: WORKSHEET ::
A. Modify previous program without using interrupts.
(Hint: using polling method to check whether switch is pressed or not like JNB P3.2,
clockwise.)
Memory
Location
HEX
code
Label Opcode Operands Comments
Page view 68
1 2 ... 64 65 66 67 68 69 70 71 72 73 74 ... 79 80

Comments to this Manuals

No comments