This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with timer

Can any one help me plz
This is the code for some delay on p1.0 pin

org 0000h
        mov tmod,#01h
 back:  mov th0,#0f0h
        mov tl0,#0f0h
        setb tr0
        cpl p1.0
  here: jnb tf0,here

        clr tr0
        clr tf0
        jmp back

         end

My problem is value in TL is not incrementing properly .TL is displaying only even numbers . TF is setting when ever T0 reg is becoming 0000 and port bit is also working properly.
TL value incrementing even TR0 falg is 0 again reloading with T0 value when TR0 is 1. And finally iam not getting the result when I loaded this code into controller.

  • all instructions are 2-cycle instructions. That is the reason whey TL is incremented in steps of 2.

    And finally iam not getting the result when I loaded this code into controller.

    Which result are you expecting. The program really does not make any sense.

  • help me plz
    sounds like a prostate problem, go see a doctor.

    on your code TL is displaying only even numbers .
    most likely due to the synchornization between the timer clock and the uC instruction cycle. You can write code that in the ICE only show numbers divisible by e.g. 7 on a given breakpoint.

    If you are using a simulator do you not understand the meaning of the word "simulate"

    Erik

  • If you are using a simulator do you not understand the meaning of the word "simulate"

    thats not what my girlfriend said to me last night!