- This topic has 0 replies, 1 voice, and was last updated 12 years, 7 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › RPS
digit equ 8
buffer equ 9
counter225 equ 13
counter16 equ 14
puluhan equ 16
satuan equ 17
speed equ 18
THX equ 20
bendera1Detik bit 20H.0
ljmp start;
org timer0
ajmp tim0rut
org timer1
inc THX
reti
tim0rut:
push PSW
push Acc
djnz counter225,scanning
mov counter225,#225
djnz counter16,scanning
mov counter16,#16
setb bendera1detik
mov speed,TL1
mov TL1,#156
mov speed+1,THX
mov THX,#0
acall isibuffer
scanning:
acall display
pop Acc
pop PSW
reti
display:
setb RS0
mov p1,#0ffh
mov P2,@R0
acall aktifdigit
inc R0
cjne R0,#buffer+4,dispfin
mov R0,#buffer
dispfin:
clr RS0
ret
aktifdigit:
mov a,R0
clr c
subb a,#buffer-3
movc a,@a+pc
mov P1,a
ret
db 08h,04h,02h,01h
konversi:
inc a
movc a,@a+pc
ret
db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h
hextobcd:
push B
mov B,#10
div ab
mov puluhan,a
mov Satuan,B
pop B
ret
isibuffer:
mov A,speed+1
clr c
subb a,#100
jnc error
mov A,speed
clr c
subb a,#156
acall hextobcd
mov a,satuan
acall konversi
mov buffer,a
mov a,puluhan
acall konversi
mov buffer+1,a
mov A,speed+1
acall hextobcd
mov a,satuan
acall konversi
mov buffer+2,a
mov a,puluhan
acall konversi
mov buffer+3,a
isibuffend:
ret
error:
mov buffer+3,#86h
mov buffer+2,#0afh
mov buffer+1,#0afh
mov buffer,#0ffh
sjmp isibuffend
start:
mov SP,#20h
mov digit,#buffer
mov counter225,#225
mov counter16,#16
mov TMOD,#62h
mov TCON,#50h
mov TH0,#0
mov TL0,#0
mov TH1,#156
mov TL1,#156
mov THX,#0
mov IE,#8ah
mainloop:
sjmp mainloop
end
“anybody help me to change this from RPS to RPM?Because I do not understand where the data and how to multiply by 60“