EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / RPS

RPS

|

Microcontroller › 8051 › RPS

  • This topic has 0 replies, 1 voice, and was last updated 13 years, 9 months ago by pei.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • February 4, 2012 at 11:30 am #1687
    pei
    Participant

    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“

  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • restarting this Christmas project November 14, 2025
  • desoldering November 13, 2025
  • Unknown, to me, electric motor fitting November 13, 2025
  • Can a small solar panel safely trickle-charge old NiMH AA batteries? November 13, 2025
  • KiCad custom symbol definition correct approach November 13, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise