Laporan Akhir Pratikum
Mikroprosessor dan Mikrokontroller
Atmega 128
Seven Segment
#include <mega128.h>
#include <delay.h>
void tekan_keypad_tampil_sevseg()
{
PORTF = 0b11111011;
delay_ms(1);
if (PINF.4 == 0) {PORTE=0X06 ; delay_ms(3);}
if (PINF.4 == 0) {PORTD=0X06 ; delay_ms(3);}
if (PINF.5 == 0) {PORTE=0X66; delay_ms(3);}
if (PINF.6 == 0) {PORTE=0X07; delay_ms(3);}
if (PINF.7 == 0) {PORTE=0X3F; delay_ms(3);}
PORTF = 0b11111101;
delay_ms(1);
if (PINF.4 == 0) {PORTE=0X5B; delay_ms(3);}
if (PINF.4 == 0) {PORTD=0X5B; delay_ms(3);}
if (PINF.5 == 0) {PORTE=0X6D; delay_ms(3);}
if (PINF.6 == 0) {PORTE=0X7F; delay_ms(3);}
if (PINF.7 == 0) {PORTE=0X3F; delay_ms(3);}
PORTF = 0b11111110;
delay_ms(1);
if (PINF.4 == 0) {PORTE=0X4F; delay_ms(3);}
if (PINF.4 == 0) {PORTD=0X4F; delay_ms(3);}
if (PINF.5 == 0) {PORTE=0X7D; delay_ms(3);}
if (PINF.6 == 0) {PORTE=0X6F; delay_ms(3);}
if (PINF.7 == 0) {PORTE=0X3F; delay_ms(3);}
}
void switch_on()
{
if (PINA.0 == 0) {PORTE=0X3f ; delay_ms(3);}
if (PINA.1 == 0) {PORTE=0X06; delay_ms(3);}
}
void main(void)
{
PORTF = 0xff;
DDRF = 0x0f;
PORTE=0X00;
DDRE=0XFF;
PORTA=0X00;
DDRA=0X00;
PORTD=0X00;
DDRD=0XFF;
while(1)
{
switch_on();
//tekan_keypad_tampil_sevseg();
};
}- Rangkaian Simulasi <Link Download>
- File Program <Link Download>
- Video Praktikum <Link Download>
Tidak ada komentar:
Posting Komentar