8051 counter

MOV A,#90H MOV DPTR,#FF13H // LOAD CTRL WORD(90H) TO CONTROL REG(FF13) PA- IN,PB-OUT,PC-OUT MOVX @DPTR,A

MOV R1,#0Fh //COUNTER VALUE MOV A,R1 MOV R2,A //R2 STORES THE CTR VALUE OF EACH ITERATION OF THE PROGRAM

REPEAT: MOV DPTR,#FF11H MOV A,R2 // MOVE ACC VALUE TO PORT B(FF11 - O/P PORT) MOVX @DPTR,A

MOV DPTR,#FF10H MOVX A,@DPTR // GET VALUE ON PORT A AND MOVE TO ACC

ADD A,#30H // CONVERT ACC VALUE TO HEXA

MOV TMOD,#20H MOV TH1,#FDH MOV TL1,#00H // MOVE ACC CONTENTS TO SERIAL PORT MOV TCON,#40H MOV SCON,#58H MOV SBUF,A

HERE: JNB TI,HERE CLR TI // TI = SCON.1

DEC R2 CJNE R2,#0,REPEAT // REPEAT FOR CTR VALUES STARTING FROM "OF" TO "00"

PROBLEM: output comes on hyperterminal only for the first time. Subsequent counter values are not getting printed. Anything to be changed in tcon,scon,tmod? Or some clk freq to be changed, delay given? Or anything else to be reset or cleared? Please clarify

Thanks Quad

Reply to
quad
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.