Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dseg at 0030h
- counter_1s : ds 1
- blinky : ds 1
- counter_lcd: ds 1
- cseg at 8200h
- ; move stack pointer to upper half of internal memory
- mov sp, 080h
- ; configure timer T0
- ; gate = 0 (always active, not only during interrupt)
- ; C/T = 0 (use internal counter from system clock)
- ; mode = 01 (16 bit, no auto reload)
- ; lower half of TMOD: 0001b=1h
- mov A, TMOD
- anl A, #0F1h ; TMOD & (1111 0000)
- orl A, #01h
- mov TMOD, A
- ; enable timer interrupts
- setb ET0
- setb EA
- ; output value
- ; used for blinking LED on P6
- mov blinky, #00h
- ; init counter value
- mov counter_1s, #00h
- ; start timer
- setb TR0
- mov A, #00h
- LCALL 1000h
- mov A, #01h
- LCALL 1000h
- mov counter_lcd, #00h
- MAIN:
- mov 0FAh, blinky
- ; check if 1s has passed (20x50ms)
- mov R0, counter_1s
- cjne R0, #14h, MAIN
- mov counter_1s, #00h
- ; invert lowest bit of blinky
- mov A, blinky
- xrl A, #01h
- mov blinky, A
- sjmp LCD
- LCD:
- inc counter_lcd
- mov R0, counter_lcd
- mov R1, #01h
- mov A, #18h
- LCALL 1000h
- ;Curser Position
- mov R0, #01h
- mov R1, #02h
- mov A, #02h
- LCALL 1000h
- ; zahl Schreiben
- mov R0, counter_lcd
- mov A, #015h
- LCALL 1000h
- ;Bar
- sjmp MAIN
- cseg at 800Bh
- clr TR0
- mov TL0, #0B0h
- mov TH0, #03Ch
- inc counter_1s
- ;setb 20h
- setb TR0
- RETI
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement