SISTEM
MIKROKONTROLER
I Gde Eka Dirgayussa
ATmega Architecture
DATA BUS
General Purpose
Register ( 8 x 32) Stack Pointer SRAM
Oscillator
Control
Line Program Counter Program FLASH
MCU ALU
CTRL. &
Timming
Instruction Instruction EEPROM
Status Register
Decoder Register
Clock
System Central Processing Unit (CPU) Memory Block
Timer pada ATmega8535
Peripheral I/O Interrupt Timer/
Block Module Unit Counters
© https://www.sparkfun.com/news/2613
Prescaler
• Berfungsi untuk membagi frekuensi agar periodenya menjadi besar
• Nilai Prescaler adalah 1, 8, 64, 256, dan 1024
• Contoh: Misalnya Prescaler 256, maka:
16 𝑀𝑀𝑀𝑀𝑀𝑀 𝑇𝑇 =
1
=
1
= 16 𝜇𝜇𝜇𝜇
𝑓𝑓 = = 625000 𝑓𝑓 625000
256
Timer 0
• Bekerja menghitung clock yang berasal dari osilator
• Periode timer menyesuaikan dengan frekuensi osilator (kristal)
• Pada ATmega8535, kristalnya 16MHz maka periodenya:
1 1
𝑇𝑇 = = = 0.0625 𝜇𝜇𝜇𝜇
𝑓𝑓 16 𝑀𝑀𝑀𝑀𝑀𝑀
Pada simulasi Proteus, LED akan Pada KIT, LED akan ON/OFF tiap 1 detik sekali
ON/OFF tiap 16 detik sekali