krnl 1
Loading...
Searching...
No Matches
k00readme.ino
Go to the documentation of this file.
1The examples for krnl er enumerated k01, k02 etc
2The idea is there is a progressing in the demoprograms
3
4See github.com/jdn-aau or
5es.aau.dk/staff/jdn/edu/doc/arduino/krnl
6
7Happy krnl hacking :-)
8
9
10... this file need a cleanup ... /Jens ...
11
12/***********************
13
14NB NB ABOUT WRAP AROUND AND KRNL TIMERS
15
16Krnl maintain a milisecond timer (k_millis_counter)
17It s 32 bit unsigned long so it wraps around after 49.7 days.
18As all timing internal in krnl is relative (from now) then
19wrap around will have no influence on krnl !!!
20
21NB NB ABOUT TIMERS PORTS ETC
22
23You can configure krnl to use timer 0,1,2,3,4,5
24
25Default uno,mega timer 2
26leonardo (32u4 cpu) timer 3
27
28Normally you cant use timer 0 bq it is used for millis and preallocated.
29
30YOU CAN configure KeRNeL for using timer 0.
31It requires modification in ..../wiring.c where you shall disable the original INT0 timer isr in wiring.c
32By setting KRNLTMR to 0 you will enable a KeRNel builtin replacement for timer0 so everything
33including millis and micros will work as usual.
34
35
36See below
37
38When using a timer you must be aware of that it will prohibit you from things like
39- tone (pwm sound) uses timer2
40
41... from http://blog.oscarliang.net/arduino-timer-and-interrupt-tutorial/
42
43Timer0:
44- Timer0 is a 8bit timer.
45- In the Arduino world Timer0 is been used for the timer functions, like delay(), millis() and micros().
46- If you change Timer0 registers, this may influence the Arduino timer function.
47- So you should know what you are doing.
48
49- Timer1 is a 16bit timer.
50- In the Arduino world the Servo library uses Timer1 on Arduino Uno (Timer5 on Arduino Mega).
51
52Timer2:
53 - Timer2 is a 8bit timer like Timer0.
54 -In the Arduino work the tone() function uses Timer2.
55
56Timer3 16 bits
57- 1280/1284P and 2560 only
58
59Timer4, Timer5 16 bits
60- 1280 and 2560 only
61
62On Uno
63- Pins 5 and 6: controlled by timer0
64- Pins 9 and 10: controlled by timer1
65- Pins 11 and 3: controlled by timer2
66
67On the Arduino Mega we have 6 timers and 15 PWM outputs:
68
69TODO pinout below need checkup
70
71- Pins 4 and 13: controlled by timer0
72- Pins 11 and 12: controlled by timer1
73- Pins 9 and10: controlled by timer2
74- Pin 2, 3 and 5: controlled by timer 3
75- Pin 6, 7 and 8: controlled by timer 4
76- Pin 46, 45 and 44:: controlled by timer 5
77
78... from http://arduino-info.wikispaces.com/Timers-Arduino
79
80- Servo Library uses Timer1.
81-- You can’t use PWM on Pin 9, 10 when you use the Servo Library on an Arduino.
82-- For Arduino Mega it is a bit more difficult. The timer needed depends on the number of servos.
83-- Each timer can handle 12 servos.
84-- For the first 12 servos timer 5 will be used (losing PWM on Pin 44,45,46).
85-- For 24 Servos timer 5 and 1 will be used (losing PWM on Pin 11,12,44,45,46)..
86-- For 36 servos timer 5, 1 and 3 will be used (losing PWM on Pin 2,3,5,11,12,44,45,46)..
87-- For 48 servos all 16bit timers 5,1,3 and 4 will be used (losing all PWM pins).
88
89- Pin 11 has shared functionality PWM and MOSI.
90-- MOSI is needed for the SPI interface, You can’t use PWM on Pin 11 and the SPI interface at the same time on Arduino.
91-- On the Arduino Mega the SPI pins are on different pins.
92
93- tone() function uses at least timer2.
94-- You can’t use PWM on Pin 3,11 when you use the tone() function an Arduino and Pin 9,10 on Arduino Mega.
95
96SO BEWARE !!!
97
98***********************/
99
100
101Jens, AAU
char a[150]
The examples for krnl er enumerated k02 etc The idea is there is a progressing in the demoprograms See github com jdn aau or es aau dk staff jdn edu doc arduino krnl Happy krnl hacking
The examples for krnl er enumerated k01
Definition k00readme.ino:1