#include <mega16.h>   PORTA=merah;#include <delay.h>    delay_ms(20);                      PORTB=hijau;int merah=1;       ...
#include <mega16.h>                                 PORTC=bil[kanan];#include <delay.h>                                  d...
#include <mega16.h>                     delay_ms(10);                    PORTC=0xff;#include <delay.h>                    ...
Membuat traffic light dengan avr at mega
Membuat traffic light dengan avr at mega
Membuat traffic light dengan avr at mega
Membuat traffic light dengan avr at mega
Membuat traffic light dengan avr at mega
Upcoming SlideShare
Loading in …5
×

Membuat traffic light dengan avr at mega

4,798 views

Published on

contoh file latihan membuat simulasi traffic light dengan codevision AVR dan ISIS proteus

Published in: Education, Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,798
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
292
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Membuat traffic light dengan avr at mega

  1. 1. #include <mega16.h> PORTA=merah;#include <delay.h> delay_ms(20); PORTB=hijau;int merah=1; delay_ms(100);int kuning=2; PORTB=kuning;int hijau=4; delay_ms(50) ;void main (void) PORTB=merah;{ delay_ms(20);DDRA=0xff; PORTC=hijau;DDRB=0xff; delay_ms(100);DDRC=0xff; PORTC=kuning;DDRD=0xff; delay_ms(50);while(1) PORTC=merah;{ delay_ms(20); PORTA=hijau; PORTD=hijau; PORTB=merah; delay_ms(100); PORTC=merah; PORTD=kuning; PORTD=merah; delay_ms(50); delay_ms(100); } PORTA=kuning; } delay_ms(50);
  2. 2. #include <mega16.h> PORTC=bil[kanan];#include <delay.h> delay_ms(100); }unsigned char for(kiri=9;kiri>-1;kiri--) bil[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x8 { 2,0xf8,0x80,0x90}; PORTD=0x01;int kanan=9; PORTC=bil[kiri]; int kiri=9; delay_ms(100);void main (void) }{ PORTC=0x00;DDRC=0xff; PORTD=0x04;DDRD=0xff; delay_ms(100); }{ } }while(1){ for(kanan=9;kanan>-1;kanan--) { PORTD=0x02;
  3. 3. #include <mega16.h> delay_ms(10); PORTC=0xff;#include <delay.h> if(tengen<0) } { else{unsigned char PORTA=0xff;} PORTC=bil[kiwo];} bil[10]={0xc0,0xf9,0xa4,0xb0,0x else{ delay_ms(10); 99,0x92,0x82,0xf8,0x80,0x90}; PORTA=bil[tengen]; }int kanan, kiri, tengen, kiwo }delay_ms(10); } if (kiwo<0)void main (void) } {{ PORTA=0xff; kiwo=9;DDRC=0xff; PORTB=0x04; }DDRD=0xff; delay_ms(100); }DDRB=0xff; PORTD=0x04;DDRA=0xff; if(tengen<0) delay_ms(100); { }{ tengen=9; } } }while(1){ for(kiri=9;kiri>-1;kiri--) int mulai; { for(kanan=9;kanan>-1;kanan--) kiwo--; { for(mulai=0;mulai<10;mulai++){ tengen--; PORTD=0x01; for(mulai=0;mulai<10;mulai++) PORTB=0x02; { PORTA=bil[kiri]; PORTD=0x02; delay_ms(10); PORTB=0x01; if(kiwo<0) PORTC=bil[kanan]; {

×