assembly code for counter

Discussion in 'Embedded Systems and Microcontrollers' started by vead, Jan 2, 2014.

  1. vead

    Thread Starter Well-Known Member

    Nov 24, 2011
    I want make counter program for 8051 controller in assembly that count 0 to 4 I know I have to use display but first think I want to learn how we write instruction for counter in assembly 8051 has two timer timer0 and timer1 each has 16 bit registers

    set control bit means timer start
    TR0=1; start timer
    TR1=1; start timer

    clear control bit means stop the timer

    TR0=0; stop timer
    TR1=0; stop timer

    TIME MODE- there are four mode of timer
    mode 0
    mode 1
    mode 2
    mode 3

    now I know how to set bit how to clear bit and timer mode

    my problem is that I have no idea how to start please anyone will help me to write code only for timer not for display I will learn later first for timer