| ??? 08/13/11 07:14 Read: times |
#183345 - update Responding to: ???'s previous message |
I was going to update this the other day but I have not been able to access the site for a few days. Here is the finished code. It worked perfectly. It showed the count on the LED's and transferred the count up to 255 on hyper-terminal. Thank you all for your help.
ORG 0000H
MOV TMOD, #00100110B ;TIMER 0 MODE 2, COUNTER
MOV TH0, #0 ;TH0 = 0
AGAIN: SETB TR0 ;START TIMER/COUNTER 0
BACK1: MOV A, TL0 ;A = TL0
MOV B, P1 ;B = P1
CJNE A, B, NEXT ;IF A IS NOT EQUAL TO B GOTO NEXT
CLR A ;A = 0
MOV TL0, A ;TL0 = A
NEXT: MOV P2, A
ACALL CONV ;CALL CONVERSION SUBROUTINE
JNB TF0, BACK1
CLR TF0 ;CLEAR TIMER 0 FLAG
SJMP AGAIN
;-------CONVERTING DEC DIGITS TO DISPLAYABLE ASCII DIGITS
CONV: MOV B, #10
DIV AB
MOV R2, B
MOV B, #10
DIV AB
ORL A, #30H
ACALL SEND
MOV A, R4
MOV A, B
ORL A, #30H
ACALL SEND
MOV R3, A
MOV A, R2
ORL A, #30H
ACALL SEND
MOV R2, A
SJMP AGAIN
RET
;-------SERIAL DATA TRANSFER.
SEND:
MOV TH1, #0FDH ;9600 BAUD RATE
MOV SCON, #50H ;8-BIT, 1 STOP BIT, REN ENABLED
SETB TR1 ;START TIMER 1
MOV SBUF, A
H_1: JNB TI, H_1
CLR TI
RET
END
|
| Topic | Author | Date |
| need help to display timer count on hyperterminal and LED'S | 01/01/70 00:00 | |
| Attention to Details | 01/01/70 00:00 | |
| divide by 10 | 01/01/70 00:00 | |
| Hundredth digit is quotient of division by 100 | 01/01/70 00:00 | |
| thanks | 01/01/70 00:00 | |
| Debugged with pen and paper? | 01/01/70 00:00 | |
| Debugged | 01/01/70 00:00 | |
| Decimal or hexadecimal? | 01/01/70 00:00 | |
| decision | 01/01/70 00:00 | |
| So take up the challenge then | 01/01/70 00:00 | |
| agreed | 01/01/70 00:00 | |
| Actually BCD!! | 01/01/70 00:00 | |
| Oh Details Details | 01/01/70 00:00 | |
| update | 01/01/70 00:00 | |
| Issues | 01/01/70 00:00 | |
| better to check before sending | 01/01/70 00:00 | |
Even Better.... | 01/01/70 00:00 |



