Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
23
Task/Sleep/8051-Assembly/sleep.8051
Normal file
23
Task/Sleep/8051-Assembly/sleep.8051
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
ORG RESET
|
||||
jmp main
|
||||
ORG TIMER0
|
||||
; timer interrupt only used to wake the processor
|
||||
clr tr0
|
||||
reti
|
||||
|
||||
main:
|
||||
setb ea ; enable interrupts
|
||||
setb et0 ; enable timer0 interrupt
|
||||
mov tl0, #0 ; start timer counter at zero
|
||||
mov th0, #0 ; these two values dictate the length of sleep
|
||||
|
||||
mov a, pcon ; copy power control register
|
||||
setb a.0 ; set idl bit
|
||||
setb tr0 ; start timer
|
||||
; sleeping...
|
||||
mov pcon, a ; move a back into pcon (processor sleeps after this instruction finishes)
|
||||
|
||||
; when the timer overflows and the timer interrupt returns, execution will resume at this spot
|
||||
|
||||
; Awake!
|
||||
jmp $
|
||||
Loading…
Add table
Add a link
Reference in a new issue