[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

2022-06-09: Search is working again.
2022-05-12: Ghost posting is now globally disabled. 2022: Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/diy/ - Do-It-Yourself

Search:


View post   
View page     

[ Toggle deleted replies ]
>> No.2413557 [View]
File: 17 KB, 665x111, Screenshot_2022-06-23_10-40-32.png [View same] [iqdb] [saucenao] [google]
2413557

I don't use books, but my advice is to read the data sheet, and understand how easy it is to directly manipulate registers to do what you want. Libraries are fine most of the time, but be comfortable with direct access.

Example of timer setting:

TCCR1B |= (1 << CS10); //selecting prescaler 0b001 (Tclk/1)
TCCR1B &= ~((1<<CS11) | (1<<CS12)); // turn off CS12 and CS11 bits

The names, TCCR1B and others are straight out of the avr datasheet; many arduinos use the 328p: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf



Navigation
View posts [+24] [+48] [+96]