Skip to main content
Visitor II
February 10, 2005
Question

Auto-reload timer

  • February 10, 2005
  • 5 replies
  • 2288 views
Posted on February 10, 2005 at 06:56

Auto-reload timer

    This topic has been closed for replies.

    5 replies

    Visitor II
    February 9, 2005
    Posted on February 09, 2005 at 07:22

    How can i make a 50us timer using ST7LITE0? I'm using Indart-stx and the emulation is weird!!! Please help me!!!!!!!!!

    Visitor II
    February 9, 2005
    Posted on February 09, 2005 at 09:01

    What do you want to do with the '50µs timer'?

    Do you need one shot or periodical events?

    What are you doing now and what is the result from the emulation in your application?

    Please give more information!

    WoRo

    Visitor II
    February 9, 2005
    Posted on February 09, 2005 at 09:30

    I want to make a periodical sample. The microcontroller must generate an interrupt each 50us. In the emulation, the counters (CNTRH and CNTRL) don't count in a logical order and don't generate overflow. Therefore, the interrupt doesn't occur. I know that my doubt is basic but I'm new in ST Micro. :-] . Thank's for your help!!

    Visitor II
    February 10, 2005
    Posted on February 10, 2005 at 05:04

    First an idea:

    If you are using HiWare Compiler or assembler you have to take care to write first the MSByte (DCR0H) and then the LSByte (DCR0L) of the timer. Because writing to the DCR0H will disable the compare interrupt. Please see the notes on page 53 of the manual, even for further information.

    Note: .... At reset, the counter starts counting from 0.

     

     

    Caution: As soon as the DCR0H is written, the

     

    compare function is disabled and will start only

     

    when the DCR0L value is written.

     

    If the DCR0H write occurs just before the compare event,

     

    the signal on the PWM output may not be set to a low

     

    level. In this case, the DCRx register should be updated

     

    just after an OVF event. If the DCR and ATR

     

    values are close, then the DCRx register shouldbe

     

    updated just before an OVF event, in order not to

     

    miss a compare event and to have the right signal

     

    applied on the PWM output.

    As 50µs is quite a short time, please have a look at the running-time of your interrupt routine.

    Regards

    WoRo

    Visitor II
    February 10, 2005
    Posted on February 10, 2005 at 06:56

    I've worked more in my program, and tried follow your idea and it works. Many thank's!! :D