I thought this would be simple (average time between 4 switch presses)


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: I thought this would be simple (average time between 4 switch presses)

    All good points well made...but what if the maximum time between switch presses is only ever going to be 1 second ...I've therefore got 100% 'headroom' @ 2 seconds.....and what if this was this simple task was the only purpose of the program/PIC .....hey some power consumption 'win' to boot.

    I guess where I'm heading, before anyone can decide whether a final solution is 'best' or not, then they'd need to know the full requirements.

    I don't agree with the analogy of running a car with the brakes on here ....this is more akin to running the car at very low rpm because that's all that's required! (your family car might be capable of 120mph....but when you go to the corner shop, you're likely going to go there at 30mph, becuase that's 'best' for the situation at hand)

    But as ever, there are many ways to skin a cat....and I always welcome all input from those more learned on here!(just about everybody, lol)

    Your proposed way sounds good....I'll sleep on it!

  2. #2
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default Re: I thought this would be simple (average time between 4 switch presses)

    Hi Hank,

    Late to the game (as usual) and probably haven't read thoroughly enough, but why should that stop me from commenting? 8^)

    You said that the times will always be less than 1 second and that the timer can hold just a little more than half a second. Why not clear the overflow flag at the same time you clear the timer. Then when you read the timer also check the overflow flag. If it is set, add $FFFF to your value. The interrupt flags work whether they are used to trigger an actual interrupt or not.

    Best Regards,
    Paul
    The way to avoid mistakes is to gain experience. The way to gain experience is to make mistakes.

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: I thought this would be simple (average time between 4 switch presses)

    Hi Paul,

    Stonking late entry - many thanks!!

    Hank.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts