| Datenblatt-Suchmaschine für elektronische Bauteile |
|
STC89LE53RC Datenblatt(PDF) 86 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89LE53RC Datenblatt(HTML) 86 Page - STCmicro Technology Co,.Ltd |
|
86 / 165 page ![]() Example: Design an intrusion warning system using interrupts that sounds a 400Hz tone for 1 second (using a loudspeaker connected to P1.7) whenever a door sensor connected to INT0 makes a high-to-low transition. Assembly Language Solution ORG 0 LJMP MAIN ;3-byte instruction LJMP INT0INT ;EXT 0 vector address ORG 000BH ;Timer 0 vector LJMP T0INT ORG 001BH ;Timer 1 vector LJMP T1INT ORG 0030H MAIN: SETB IT0 ;negative edge activated MOV TMOD, #11H ;16-bit timer mode MOV IE, #81H ;enable EXT 0 only SJMP $ ;now relax ; INT0INT: MOV R7, #20 ;20 ' 5000 us = 1 second SETB TF0 ;force timer 0 interrupt SETB TF1 ;force timer 1 interrupt SETB ET0 ;begin tone for 1 second SETB ET1 ;enable timer interrupts RETI ; T0INT: CLR TR0 ;stop timer DJNZ R7, SKIP ;if not 20th time, exit CLR ET0 ;if 20th, disable tone CLR ET1 ;disable itself LJMP EXIT SKIP: MOV TH0, #HIGH (-50000) ;0.05sec. delay MOV TL0, #LOW (-5000) SETB TR0 EXIT: RETI ; T1INT: CLR TR1 MOV TH1, #HIGH (-1250) ;count for 400Hz MOV TL1, #LOW (-1250) CPL P1.7 ;music maestro! SETB TR1 RETI END 86 |
|
Link URL |
| War ALLDATASHEET hilfreich? [ DONATE ] |
Über Alldatasheet | Werbung | Kontakt | Privatsphäre und Datenschutz | Link zum Datenblatt | Linktausch | Hersteller All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |