| ??? 08/24/10 23:32 Modified: 08/24/10 23:35 Read: times |
#178296 - i need help in 89c51 & LCD |
hi all
i found the following counter code in this forum and i need to us it in my scenario (89c51 & 16x2 LCD) not with 7-seg. http://www.8052.com/forum/read/126965 any one please can help me, what exactly i need to modified/add??? one more thing, is it possible to remove the BCDs and run the counter?! i'm using ISIS 7.7 for simulation. many thanks
ORG 0H
COUNT EQU 30H
PASS EQU 20H
; MAIN PROGRAM
MOV TMOD,#01H ;SET TIMER0 MODE TO 1
MOV COUNT,#00H ;SET COUNT TO 00
MOV A,COUNT ;MOVE COUNT TO ACCUMULATOR
MOV P1,A ;OUTPUT 00
DC0:
MOV PASS,#05H ;SETS TIME DELAY TO 1 SEC.DELAY
MOV TL0,#0ECH ;SET LOW BYTE TO 68 DECIMAL
MOV TH0,#16H ;SET HIGH BYTE TO 58 DECIMAL
DC1:
SETB TR0 ;START TIMER
DD1:
JNB TF0,DD1 ;WAIT FOR OVERFLOW
CLR TF0 ;CLEAR FLAG
CLR TR0 ;STOP TIMER
DJNZ PASS,DC1 ;LOOP 5 TIMES
BEG:
MOV A,COUNT ;MOVE COUNT TO ACCUMULATOR
ADD A,#01H ;ADD 1 TO ACCUMULATOR
DA A ;DECIMAL ADJUST A
MOV COUNT,A ;MOVE ACCUM NUMBER BACK TO COUNT
SWTCH:
SETB P3.0 ;CHECK P3.0 SWITCH
JNB P3.0,SWTCH
MOV P1,COUNT ;OUTPUT NUMBER TO LEDS
SJMP DC0 ;JUMP BACK TO LOOP
/* CountDown
BEG: MOV A,COUNT1 ; Move LSD to A
DEC A ; Decrement the LSD
CJNE 0FFh, BEG2 ; Check for underflow
MOV COUNT1, #09h ; If underflow, reload with 09 and dec MSD
;
MOV A, COUNT2 ; Fetch MSD
DEC A ; Decrement the MSD
CJNE 0FFh, BEG1 ; Check for underflow
MOV A, #09h ; Reload MSD with 9
BEG1: MOV COUNT2, A ; Save the MSD
JP BEG3 ; Jump to end
BEG2: MOV COUNT1,A ; Save LSD
BEG3:
*/
END
|
| Topic | Author | Date |
| i need help in 89c51 & LCD | 01/01/70 00:00 | |
| What to modify.... | 01/01/70 00:00 | |
| thnx Michael | 01/01/70 00:00 | |
Changing the Count | 01/01/70 00:00 |



