Menu

ms time delay

Krem
2008-11-24
2012-11-19
  • Krem

    Krem - 2008-11-24

    I used the word ms to create a time delay to blink a LED. While watching the LED blink I noticed it sometimes became erratic. The problem seemed to come from the word "ms".
    The word ms uses the tick counter to create the time delay. The tick counter counts up then overflows and starts over. If the overflow happens in the middle of a measured time interval will the start and stop count be valid?
    I may be off track here but any ideas?

    I find FF to be a very useful piece of software and hope it will be continued to be supported.

    Thanks
    Krem

     
    • Mikael Nordman

      Mikael Nordman - 2008-11-24

      Hi Krem,

      The word MS should be safe from overflows of TICKS. At least I cannot see
      how it could fail. Perhaps you can try to debug this issue ?

      Are you using FF3.3? In some earlier FF versions MS had this bug.

      If you run MS in a background task and use END and RUN
      without initializing the task again, it can happen that TICKS has
      already passed the timeout and a sporadic delay occurs.

      Thanks for the nice feedback. FF will still be supported and there are some improvement
      plans also.

      Regards
      Mikael

       
    • Krem

      Krem - 2008-11-25

      Hello Mikael,

      Thanks for the fast response....

      Here is the code I used to blink a LED.

      hex ram

      ff93 constant trisb
      ff81 constant portb
      90 as3 bcf,
      80 as3 bsf,

      Blink
            
                    [ trisb 5 0 bcf, ]

                Begin

                    [ portb 5 0 bsf, ]
                    #200 ms
                    [ portb 5 0 bcf, ]
                    #200 ms

                    key?

                Until ;

      If you watch the LED it will skip a beat every so often. I monitored the TICK count and it looks OK. Could it be the Begin .... Until ?
      I tried Begin ... Again with the same results.

      Thanks
      Krem

       
    • Mikael Nordman

      Mikael Nordman - 2008-11-25

      I just tested your program on my 18F252.
      It works OK.

      RB5 is the LowVoltageProgramming input.

      Are you sure the LVP configuration bit is off ?

      What processor and clock are you using ?

      Mikael

       
    • Krem

      Krem - 2008-11-26

      The processor I am using is pic18F4525 with a clock speed of 4.00 Mhz. The version of FF is 3.3.
      When I configured FF I used p18f2525-2620-4525-4520.cfg which had config LVP=OFF so I assumed the bit was off.

      If you can get my program running OK on the 18F252 then I must have a problem with my set-up.

      I will keep playing around with it.

      Thanks for your time Mikael.

      Krem

       

Log in to post a comment.