Rev 208 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 208 | Rev 381 | ||
|---|---|---|---|
| Line 28... | Line 28... | ||
| 28 | /** |
28 | /** |
| 29 | * Initialize MCU. If the MCU is mega88, the internal clock frequency will be |
29 | * Initialize MCU. If the MCU is mega88, the internal clock frequency will be |
| 30 | * set to 8MHz. Interrupts must not be enabled when calling this function! |
30 | * set to 8MHz. Interrupts must not be enabled when calling this function! |
| 31 | */ |
31 | */ |
| 32 | void Mcu_Init() { |
32 | void Mcu_Init() { |
| 33 | #if defined(__AVR_ATmega88__) |
33 | #if defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) |
| 34 | // set the clock speed to 8MHz |
34 | // set the clock speed to 8MHz |
| 35 | // set the clock prescaler. First write CLKPCE to enable setting of clock the |
35 | // set the clock prescaler. First write CLKPCE to enable setting of clock the |
| 36 | // next four instructions. |
36 | // next four instructions. |
| 37 | CLKPR=(1<<CLKPCE); |
37 | CLKPR=(1<<CLKPCE); |
| 38 | CLKPR=0; // 8 MHZ |
38 | CLKPR=0; // 8 MHZ |