Discussion Forum

problem with timer

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
kamala kamala
Posted
21-Jul-2007 09:41 GMT
Toolset
C51
New! 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.

Read-Only
Author
Reinhard Keil
Posted
23-Jul-2007 14:49 GMT
Toolset
C51
New! RE: problem with timer

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.

Read-Only
Author
erik malund
Posted
23-Jul-2007 14:51 GMT
Toolset
C51
New! RE: problem with timer

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

Read-Only
Author
Jothum Patrarajer
Posted
23-Jul-2007 15:28 GMT
Toolset
C51
New! RE: problem with timer

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!

Next Thread | Thread List | Previous Thread Start a Thread | Settings