Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
attiny [2019/12/06 15:47] – [prescaler] yairattiny [2019/12/14 14:20] yair
Line 1: Line 1:
 attinyX5 Family in all their gory details attinyX5 Family in all their gory details
  
-{{:atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf|ATtiny25-ATtiny45-ATtiny85_Datasheet}}+====pinouts==== 
 +===ATtinyx5===
 <code c> <code c>
      ATTiny pinout      ATTiny pinout
                          +-\/-+                          +-\/-+
                   Reset 1|    |8  VCC                   Reset 1|    |8  VCC
-    (pin3) in 0 A3  PB3 2|    |7  PB2 (pin2) out mixed +    (pin3) in 0 A3  PB3 2|    |7  PB2 (pin2) out mixed / SCK 
-    (pin4) in 1 A2  PB4 3|    |6  PB1 (pin1) out 1 +    (pin4) in 1 A2  PB4 3|    |6  PB1 (pin1) out 1 / MISO 
-                    GND 4|    |5  PB0 (pin0) out 0+                    GND 4|    |5  PB0 (pin0) out 0 / MOSI
                          ------                          ------
 </code> </code>
 +{{:atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf|ATtiny25-ATtiny45-ATtiny85_Datasheet}}
 +
 +===USBASP V2.0===
 +{{:usbasp-v2.0-idc-pinout.png?300}}\\
 +found [[https://tosiek.pl/usbasp-v2-0-warning-cannot-set-sck-period/|here]]
 +
 ====System Clock Prescaler==== ====System Clock Prescaler====
 goal:to control prescaler goal:to control prescaler
Line 26: Line 33:
                   ------                   ------
 */ */
 +</code>
 +and
 +<code c>
 +// the setup function runs once when you press reset or power the board
 +void setup() {
 +
 +  DDRB = B00000111;  //could use this
 +
 +  // initialize timer1
 +  noInterrupts();           // disable all interrupts
 +
 +  TCCR1 = 0;                  //stop the timer
 +  TCNT1 = 0;                  //zero the timer
 +
 +  OCR1A = 200;     //50           //set the compare value
 +  OCR1C = 200;       //50         //set the compare value  ??? needed
 +
 +  TIMSK = _BV(OCIE1A);        //interrupt on Compare Match A
 +
 +  TCCR1 = _BV(CTC1) | _BV(CS11); // Start timer, ctc mode, prescaler clk/2
 +
 +  interrupts();             // enable all interrupts
 +}
 +
 </code> </code>
 {{:pasted:20191206-134349.png}} {{:pasted:20191206-134349.png}}