You are on page 1of 4

Nama : Nyoman B.M.

A
NRP : 5103017027
Mata Kuliah : Sistem Mikroprosesor I / Rangkaian Minimum ATMEGA8535 (Delay Button)

1.Skematik Rangkaian
2. Flowchart
3. Source Code
/*****************************************************
This program was produced by the
CodeWizardAVR V2.05.3 Standard
Automatic Program Generator
© Copyright 1998-2011 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com

Project :
Version :
Date : 10/11/2020
Author : Yo
Company : Man
Comments:

Chip type : ATmega8535


Program type : Application
AVR Core Clock frequency: 16.004000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 128
*****************************************************/

#include <mega8535.h>
#include <delay.h>

void main(void)
{
//deklaraasi variable yang akan digunakan
int i;
int waktu;
int y;
int z;

// Input/Output Ports initialization


// Port A initialization
PORTA=0x00;
DDRA=0xFF;

// Port B initialization
PORTB=0x00;
DDRB=0xFF;

// Port C initialization
PORTC=0xFF;
DDRC=0x00;

//set variabel
waktu = 150;
y =0x01;
z =0x80;

while (1)
{
if (PINC.0 == 0)
{
if(PINC.2 ==1)
{
for (i=0;i<8;i++)
{
waktu = waktu;
PORTA = y<<i | z>>i;
PORTB = y<<i | z>>i;
if (PINC.1 == 0)
{
waktu = waktu - 49;
if (waktu <= 1)
{
waktu = 150;
}
}
delay_ms (waktu);
}
}
else
{
PORTA = 0b00000000;
PORTB = 0b11111111;
delay_ms (20);
PORTA = 0b11111111;
PORTB = 0b00000000;
delay_ms (20);
}
}
else
{
PORTA = 0b00000000;
PORTB = 0b00000000;
}
}
}

You might also like