Function to loop for a specific time.

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good afternoon all!

 

Is there an ASF library module to use a counter timer to control a while loop?

Or is the an even better way to implement a time out?

 

I am using a SAM4E.

 

// setup counter with preset and start the count down to zero.

While (counter_value > zero)
}
    // Do some stuff until we timeout.
}

// WE TIMED OUT !!

 

Whaa ?,.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Durarara wrote:
Is there an ASF library module to use a counter timer to control a while loop?

I very much doubt it.

 

ASF would let you control the timer.

 

What you then do with that timer would be entirely up to you - nothing to do with ASF

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I see this TC driver for the SAM4E ... I added it and found the API docs.

 

I guess I need to use my original idea of a counter timer?

 

I just wanted to make sure I was not re-inventing the wheel.

Wasn't sure if they was a simpler way.

 

 

Whaa ?,.