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

Is it possible to read 8051 timer register?

Hi, I was just got a basic doubt about timers. Is it possible to read 8051 timer register. one of the timer for example timer0 starts when an external event occurs and stops until the event is finished. Once the timer stops I need to read value of the timer to check the time taken for the event to take place.
I cant use the timer in counter mode since I dont have any signal coming to pins P3^5, P3^4.

regards.
Raghun

Parents
  • hi,

    - timer0 starts when an external event occurs and stops until the event is finished

    - I dont have any signal coming to pins P3^5, P3^4

    So how do you detect that event?
    The main idea is:
    - configure timer at startup time, do not run it, clear timer registers;
    - wait till event comes in;
    - run timer;
    - wait till event finished;
    - stop timer;
    - read timer registers.
    Note: it event duration is more than timer overflow time then use timer overflow interrupt and increase overflow counter variable.

    How to read -- look at datasheet about timer registers.

    Regards,
    Oleg

Reply
  • hi,

    - timer0 starts when an external event occurs and stops until the event is finished

    - I dont have any signal coming to pins P3^5, P3^4

    So how do you detect that event?
    The main idea is:
    - configure timer at startup time, do not run it, clear timer registers;
    - wait till event comes in;
    - run timer;
    - wait till event finished;
    - stop timer;
    - read timer registers.
    Note: it event duration is more than timer overflow time then use timer overflow interrupt and increase overflow counter variable.

    How to read -- look at datasheet about timer registers.

    Regards,
    Oleg

Children
No data