Latihan LED Mati Bergantian [110213]

Posted: 11 Februari 2013 in Mikrokontroler

/* Port 1, 2, 3, 4, 5, 6 mati bergantian delay 100ms */

#include <mega8535.h>
#include <delay.h>
void main(void)
{
PORTC=0x00;
DDRC=0xFF;

while (1)
{
PORTC=0b00000001;
delay_ms (100);
PORTC=0b00000010;
delay_ms (100);
PORTC=0b00000100;
delay_ms (100);
PORTC=0b00001000;
delay_ms (100);
PORTC=0b00010000;
delay_ms (100);
PORTC=0b00100000;
delay_ms (100);
PORTC=0b01000000;
delay_ms (100);
PORTC=0b10000000;
delay_ms (100);
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s