amount of timer instances
Posted: Sun Feb 09, 2020 3:09 pm
Hello,
I'm trying to understand the internal functioning of the micro:bit a little better.
Therefor I made a program which uses an amount of timers to blink the LEDS at different interval rates.
I read on the internet, the chip has a number of hardware timers.
My program runs well up to the delay of 600. If I add more objects (from pause 650 and up), the program isn't executed at all anymore after uploading.
Can someone explain why it isn't executed anymore above this amount?
Are there 12 timers available on this chip, or is there more to it?
Thanks, Marc
basic.forever(function () {
basic.pause(50)
led.plot(0, 0)
basic.pause(50)
led.unplot(0, 0)
})
basic.forever(function () {
basic.pause(100)
led.plot(1, 0)
basic.pause(100)
led.unplot(1, 0)
})
basic.forever(function () {
basic.pause(150)
led.plot(2, 0)
basic.pause(150)
led.unplot(2, 0)
})
basic.forever(function () {
basic.pause(200)
led.plot(3, 0)
basic.pause(200)
led.unplot(3, 0)
})
basic.forever(function () {
basic.pause(250)
led.plot(4, 0)
basic.pause(250)
led.unplot(4, 0)
})
basic.forever(function () {
basic.pause(300)
led.plot(4, 1)
basic.pause(300)
led.unplot(4, 1)
})
basic.forever(function () {
basic.pause(350)
led.plot(4, 2)
basic.pause(350)
led.unplot(4, 2)
})
basic.forever(function () {
basic.pause(400)
led.plot(4, 3)
basic.pause(400)
led.unplot(4, 3)
})
basic.forever(function () {
basic.pause(450)
led.plot(4, 4)
basic.pause(450)
led.unplot(4, 4)
})
basic.forever(function () {
basic.pause(500)
led.plot(3, 4)
basic.pause(500)
led.unplot(3, 4)
})
basic.forever(function () {
basic.pause(550)
led.plot(2, 4)
basic.pause(550)
led.unplot(2, 4)
})
basic.forever(function () {
basic.pause(600)
led.plot(2, 4)
basic.pause(600)
led.unplot(2, 4)
})
basic.forever(function () {
basic.pause(650)
led.plot(1, 4)
basic.pause(650)
led.unplot(1, 4)
})
basic.forever(function () {
basic.pause(700)
led.plot(0, 4)
basic.pause(700)
led.unplot(0, 4)
})
basic.forever(function () {
basic.pause(750)
led.plot(0, 3)
basic.pause(750)
led.unplot(0, 3)
})
basic.forever(function () {
basic.pause(800)
led.plot(0, 2)
basic.pause(800)
led.unplot(0, 2)
})
basic.forever(function () {
basic.pause(850)
led.plot(0, 1)
basic.pause(850)
led.unplot(0, 1)
})
basic.forever(function () {
basic.pause(900)
led.plot(1, 1)
basic.pause(900)
led.unplot(1, 1)
})
basic.forever(function () {
basic.pause(950)
led.plot(2, 1)
basic.pause(950)
led.unplot(2, 1)
})
basic.forever(function () {
basic.pause(1000)
led.plot(3, 1)
basic.pause(1000)
led.unplot(3, 1)
})
basic.forever(function () {
basic.pause(1500)
led.plot(3, 2)
basic.pause(1500)
led.unplot(3, 2)
})
basic.forever(function () {
basic.pause(2000)
led.plot(3, 3)
basic.pause(2000)
led.unplot(3, 3)
})
basic.forever(function () {
basic.pause(2500)
led.plot(2, 3)
basic.pause(2500)
led.unplot(2, 3)
})
basic.forever(function () {
basic.pause(3000)
led.plot(1, 3)
basic.pause(3000)
led.unplot(1, 3)
})
basic.forever(function () {
basic.pause(3500)
led.plot(1, 2)
basic.pause(3500)
led.unplot(1, 2)
})
basic.forever(function () {
basic.pause(4000)
led.plot(2, 2)
basic.pause(4000)
led.unplot(2, 2)
})
I'm trying to understand the internal functioning of the micro:bit a little better.
Therefor I made a program which uses an amount of timers to blink the LEDS at different interval rates.
I read on the internet, the chip has a number of hardware timers.
My program runs well up to the delay of 600. If I add more objects (from pause 650 and up), the program isn't executed at all anymore after uploading.
Can someone explain why it isn't executed anymore above this amount?
Are there 12 timers available on this chip, or is there more to it?
Thanks, Marc
basic.forever(function () {
basic.pause(50)
led.plot(0, 0)
basic.pause(50)
led.unplot(0, 0)
})
basic.forever(function () {
basic.pause(100)
led.plot(1, 0)
basic.pause(100)
led.unplot(1, 0)
})
basic.forever(function () {
basic.pause(150)
led.plot(2, 0)
basic.pause(150)
led.unplot(2, 0)
})
basic.forever(function () {
basic.pause(200)
led.plot(3, 0)
basic.pause(200)
led.unplot(3, 0)
})
basic.forever(function () {
basic.pause(250)
led.plot(4, 0)
basic.pause(250)
led.unplot(4, 0)
})
basic.forever(function () {
basic.pause(300)
led.plot(4, 1)
basic.pause(300)
led.unplot(4, 1)
})
basic.forever(function () {
basic.pause(350)
led.plot(4, 2)
basic.pause(350)
led.unplot(4, 2)
})
basic.forever(function () {
basic.pause(400)
led.plot(4, 3)
basic.pause(400)
led.unplot(4, 3)
})
basic.forever(function () {
basic.pause(450)
led.plot(4, 4)
basic.pause(450)
led.unplot(4, 4)
})
basic.forever(function () {
basic.pause(500)
led.plot(3, 4)
basic.pause(500)
led.unplot(3, 4)
})
basic.forever(function () {
basic.pause(550)
led.plot(2, 4)
basic.pause(550)
led.unplot(2, 4)
})
basic.forever(function () {
basic.pause(600)
led.plot(2, 4)
basic.pause(600)
led.unplot(2, 4)
})
basic.forever(function () {
basic.pause(650)
led.plot(1, 4)
basic.pause(650)
led.unplot(1, 4)
})
basic.forever(function () {
basic.pause(700)
led.plot(0, 4)
basic.pause(700)
led.unplot(0, 4)
})
basic.forever(function () {
basic.pause(750)
led.plot(0, 3)
basic.pause(750)
led.unplot(0, 3)
})
basic.forever(function () {
basic.pause(800)
led.plot(0, 2)
basic.pause(800)
led.unplot(0, 2)
})
basic.forever(function () {
basic.pause(850)
led.plot(0, 1)
basic.pause(850)
led.unplot(0, 1)
})
basic.forever(function () {
basic.pause(900)
led.plot(1, 1)
basic.pause(900)
led.unplot(1, 1)
})
basic.forever(function () {
basic.pause(950)
led.plot(2, 1)
basic.pause(950)
led.unplot(2, 1)
})
basic.forever(function () {
basic.pause(1000)
led.plot(3, 1)
basic.pause(1000)
led.unplot(3, 1)
})
basic.forever(function () {
basic.pause(1500)
led.plot(3, 2)
basic.pause(1500)
led.unplot(3, 2)
})
basic.forever(function () {
basic.pause(2000)
led.plot(3, 3)
basic.pause(2000)
led.unplot(3, 3)
})
basic.forever(function () {
basic.pause(2500)
led.plot(2, 3)
basic.pause(2500)
led.unplot(2, 3)
})
basic.forever(function () {
basic.pause(3000)
led.plot(1, 3)
basic.pause(3000)
led.unplot(1, 3)
})
basic.forever(function () {
basic.pause(3500)
led.plot(1, 2)
basic.pause(3500)
led.unplot(1, 2)
})
basic.forever(function () {
basic.pause(4000)
led.plot(2, 2)
basic.pause(4000)
led.unplot(2, 2)
})