95Views2Replies

Author Options:

ATtiny13A Max O/P time? Answered

Hi, I am trying, with no success, to have an output on my attiny13a have a maximum output ON time of 5 seconds.
If someone could give me some pointers or snippets of code, that would be greatly appreciated.
Many thanks

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.
0
The Skinnerz
The Skinnerz

Best Answer 8 years ago

If you don't mind the processor being busy while the delay is running, you can use nested loops, each decrementing a counter on each pass. For an 8-bit core, setting two of the counters to 255 will get a visible delay, and the third can be used to extend the delay to about 5 seconds. If you are programming in C, there should be a delay function available if you don't want to write the delay yourself.

For a more elegant solution, you should look into whether that microcontroller has any timers, as these will allow you to run other code during the delay, and won't use up as many registers.

0
LED Maestro
LED Maestro

Answer 8 years ago

Thats brilliant. Thanks for that. I will give that a go and shout if I have any furthur queries.
Many thanks again