1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

8051 Timer program with 7segment display 1.0

Creating a timer program with 7segment display

  1. sajiv jess
    Creating a timer program with 7segment display
    Download contains the source code with proteus simulation file.

    Sponsored Links

    Circuit Diagram

    Assembly Code
    Code (ASM):
    1. ORG 00H
    2.     JMP MAIN
    3.     ORG 30H
    4. MAIN:    MOV    TMOD,#00H    ;Set TIMER0 work MODE0
    5.     MOV    R4,#00H        ;Count pointer initial value
    6. ;------------------------------------
    7. START:    MOV    P2,R4        ;Initial output will count pointer to P2
    8.     MOV    R3,#200        ;Delay 1s
    9.     CALL    DELAY        ;
    10.     XCH    A,R4        ;To count the contents of the pointer value and the exchange of accumulator
    11.     ADD    A,#01        ;Accumulator plus 1
    12.     DA    A        ;Do decimal adjustment
    13.     XCH    A,R4        ;The content of the accumulator count pointer exchange
    14.     JMP    START
    15. ;-------------------------
    16. DELAY:    SETB    TR0    ;Start Timer 0 start counting
    17. AGAIN:    MOV    TL0,#(8192-5000) MOD 32    ; Set the initial value TL0
    18.     MOV    TH0,#(8192-5000)/32    ;Set the initial value of TH0
    19. LOOP2:    JBC    TF0,LOOP3    ;TF0 is 1, is the jump LOOP3, and clear TF0
    20.     JMP    LOOP2    ;Not then skip LOOP2
    21. LOOP3:    DJNZ    R3,AGAIN    ;R3 is 0? Not the jump AGAIN
    22.     CLR    TR0    ;Is the counting stopped TIMER0
    23.     RET
    24.     END