Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $INCLUDE (REG51.INC)
- LED1 EQU P3.7
- LED2 EQU P3.6
- LED3 EQU P3.5
- LED4 EQU P3.4
- OFF EQU P3.3
- LOAD EQU P3.2
- CLOCK EQU P3.1
- DANE EQU P3.0
- SCL EQU P1.1
- SDA EQU P1.2
- ENTER EQU P1.7
- DOWN EQU P1.6
- UP EQU P1.5
- ESCAPE EQU P1.4
- ACALL RESET_FUN
- SHOW:
- JNB DOWN ,RESET_COUNTER
- SJMP SKIP_RESET
- RESET_COUNTER: ACALL RESET_FUN
- SKIP_RESET:
- JNB UP ,FORCE_NUMS
- SJMP SKIP_FORCE_NUMS
- FORCE_NUMS: ACALL FORCE_NUMS_FUN
- SKIP_FORCE_NUMS:
- STOP_THIS_MADNES: JNB ESCAPE ,STOP_THIS_MADNES
- JNB ENTER ,HIDE_SECONDS
- MOV A, R5
- ACALL WPIS
- MOV A, R1
- ACALL WPIS
- SJMP SKIP_HIDE_SECONDS
- HIDE_SECONDS:
- MOV R5, #20
- MOV A, R5
- ACALL WPIS
- MOV R1, #20
- MOV A, R1
- ACALL WPIS
- SKIP_HIDE_SECONDS:
- MOV A, R2
- ACALL WPIS
- MOV A, R3
- ACALL WPIS
- CLR LOAD
- SETB LOAD
- CLR OFF
- ACALL BIT_STARTU
- MOV A, #11010000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- MOV A, #00000000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- ACALL BIT_STARTU
- MOV A, #11010001B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- ACALL ODBIERZ_BAJT
- MOV R4, A
- ANL A, #00001111B
- ADD A, #10
- MOV R5, A
- MOV A, R4
- ANL A, #11110000B
- SWAP A
- ADD A, #10
- MOV R1, A
- ACALL NOACK
- ACALL BIT_STOPU
- ACALL BIT_STARTU
- MOV A, #11010000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- MOV A, #00000001B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- ACALL BIT_STARTU
- MOV A, #11010001B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- ACALL ODBIERZ_BAJT
- MOV R4, A
- ANL A, #00001111B
- MOV R2, A
- MOV A, R4
- ANL A, #11110000B
- SWAP A
- ADD A, #10
- MOV R3, A
- ACALL NOACK
- ACALL BIT_STOPU
- JMP SHOW
- WPIS:
- MOV DPTR, #TABLICA
- MOVC A, @A + DPTR
- MOV R0, #8
- NEXT:
- RRC A
- MOV DANE, C
- CLR CLOCK
- SETB CLOCK
- DJNZ R0, NEXT
- RET
- BIT_STARTU:
- SETB SDA
- SETB SCL
- CLR SDA
- CLR SCL
- RET
- BIT_STOPU:
- CLR SDA
- CLR SCL
- SETB SCL
- SETB SDA
- RET
- WYSLIJ_BAJT:
- MOV R0, #8
- SLOOP:
- RLC A
- MOV SDA, C
- SETB SCL
- CLR SCL
- DJNZ R0, SLOOP
- RET
- ODBIERZ_BAJT:
- SETB SDA
- MOV R0, #8
- RLOOP:
- MOV C, SDA
- RLC A
- SETB SCL
- CLR SCL
- DJNZ R0, RLOOP
- RET
- ACK:
- SETB SDA
- BACK:
- JB SDA, BACK
- SETB SCL
- CLR SCL
- RET
- ACKP:
- CLR SDA
- SETB SCL
- CLR SCL
- RET
- NOACK:
- SETB SDA
- SETB SCL
- CLR SCL
- RET
- RESET_FUN:
- MOV R0, #10
- MOV R1, #10
- MOV R2, #0
- MOV R3, #10
- MOV R4, #0
- MOV R5, #10
- ACALL BIT_STARTU
- MOV A, #11010000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- MOV A, #00000000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- MOV A, #00000000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- ACALL NOACK
- ACALL BIT_STOPU
- ACALL BIT_STARTU
- MOV A, #11010000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- MOV A, #00000001B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- MOV A, #00000000B
- ACALL WYSLIJ_BAJT
- ACALL ACK
- ACALL NOACK
- ACALL BIT_STOPU
- RET
- FORCE_NUMS_FUN:
- MOV A, #10
- ACALL WPIS
- MOV A, #11
- ACALL WPIS
- MOV A, #12
- ACALL WPIS
- MOV A, #13
- ACALL WPIS
- CLR LOAD
- SETB LOAD
- CLR OFF
- ASD: JNB P1.5 ,ASD
- RET
- TABLICA:
- DB 040H ;0 "0."
- DB 079H ;1 "1."
- DB 024H ;2 "2."
- DB 030H ;3 "3."
- DB 019H ;4 "4."
- DB 012H ;5 "5."
- DB 002H ;6 "6."
- DB 078H ;7 "7."
- DB 000H ;8 "8."
- DB 010H ;9 "9."
- DB 0C0H ;10 "0"
- DB 0F9H ;11 "1"
- DB 0A4H ;12 "2"
- DB 0B0H ;13 "3"
- DB 099H ;14 "4"
- DB 092H ;15 "5"
- DB 082H ;16 "6"
- DB 0F8H ;17 "7"
- DB 080H ;18 "8"
- DB 090H ;19 "9"
- DB 0FFH ;20 PUSTE MIEJSCE
- DB 0BFH ;21 "-"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement