Connect with us

8051 counter

Discussion in 'Electronic Components' started by quad, Feb 23, 2007.

Scroll to continue with content
  1. quad

    quad Guest

    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
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-