04 - System Clock and IO

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

SISTEM

MIKROKONTROLER
CCE61212
System Clock & I/O
ATmega16 Architecture
Peripheral I/O Interrupt Timers/
SPI USART TWI Comparator
Block Module Unit Counters

System
Clock General Purpose
Stack Pointer SRAM
Register (8 x 32)

Oscillator

ALU Control Line Program Counter Program FLASH

MCU
CTRL. & Instruction Instruction
Timming Status Register EEPROM
Decoder Register

Central Processing Unit (CPU) Memory Block

YOUR
LOGO
System System Clock and Clock Options
Clock
Clock Systems and their Distribution

Oscillator

MCU
CTRL. &
Timming
Peripheral I/O Interrupt Timers/
SPI USART TWI Comparator
Block Module Unit Counters

Ports as General
Digital I/O

YOUR
LOGO
Peripheral I/O DDR (Data Direction Register): To set Configuring the Pin
Block Module
as and input or output.

Configuring the Pin

YOUR
LOGO
Peripheral I/O
Block Module

▪ Configuring Input in ATMEL STUDIO

DDRA |= (0<<DDA0)|(0<<DDA1);// PINA.0 & PINA.1 as input

▪ Configuring Input with Pull Up Internal in ATMEL STUDIO

DDRA |= (0<<DDA0)|(0<<DDA1);// PINA.0 & PINA.1 as output


PORTA |= (1<<PA0)|(1<<PA1);// Internal PU for PINA.0 & PINA.1

▪ Configuring Output in ATMEL STUDIO

DDRA |= (1<<DDA0)|(1<<DDA1);// PINA.0 & PINA.1 as output

YOUR
LOGO
Peripheral I/O
Block Module

▪ Checking Input and set the Output

if (PINA == 0b00000001) // Checking input in PIN A


{
PORTB = 0b00001111; // Set the output at PORT B
}

YOUR
LOGO
Terima Kasih

You might also like