Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revisionBoth sides next revision | ||
attiny [2019/12/06 15:44] – created yair | attiny [2019/12/14 13:48] – yair | ||
---|---|---|---|
Line 1: | Line 1: | ||
attinyX5 Family in all their gory details | attinyX5 Family in all their gory details | ||
+ | <code c> | ||
+ | | ||
+ | | ||
+ | Reset 1| |8 VCC | ||
+ | (pin3) in 0 A3 PB3 2| |7 PB2 (pin2) out mixed / SCK | ||
+ | (pin4) in 1 A2 PB4 3| |6 PB1 (pin1) out 1 / MISO | ||
+ | GND 4| |5 PB0 (pin0) out 0 / MOSI | ||
+ | | ||
+ | </ | ||
{{: | {{: | ||
- | ====prescaler==== | + | |
+ | ===USBASP V2.0=== | ||
+ | {{: | ||
+ | found [[https:// | ||
+ | |||
+ | ====System Clock Prescaler==== | ||
goal:to control prescaler | goal:to control prescaler | ||
- | System Clock Prescaler | ||
{{: | {{: | ||
- | in [[https:// | + | in [[https:// |
<code c> | <code c> | ||
/* | /* | ||
Line 16: | Line 29: | ||
See table 13-5 | See table 13-5 | ||
CS13, CS12, CS11, CS10 = [ 0, 0, 1, 0] is prescaler/2 | CS13, CS12, CS11, CS10 = [ 0, 0, 1, 0] is prescaler/2 | ||
+ | ------ | ||
*/ | */ | ||
+ | </ | ||
+ | and | ||
+ | <code c> | ||
+ | // the setup function runs once when you press reset or power the board | ||
+ | void setup() { | ||
+ | |||
+ | DDRB = B00000111; | ||
+ | |||
+ | // initialize timer1 | ||
+ | noInterrupts(); | ||
+ | |||
+ | TCCR1 = 0; //stop the timer | ||
+ | TCNT1 = 0; //zero the timer | ||
+ | |||
+ | OCR1A = 200; // | ||
+ | OCR1C = 200; // | ||
+ | |||
+ | TIMSK = _BV(OCIE1A); | ||
+ | |||
+ | TCCR1 = _BV(CTC1) | _BV(CS11); // Start timer, ctc mode, prescaler clk/2 | ||
+ | |||
+ | interrupts(); | ||
+ | } | ||
+ | |||
</ | </ | ||
{{: | {{: |