0% found this document useful (0 votes)
27 views1 page

Print

PR1: Sets port A as output and loops through binary numbers from 1 to 128, displaying each value on port A for 1 second before moving to the next value. It then loops from 128 to 1, displaying two patterns (0xAA and 0x55) on port A while decrementing the value. PR2: Sets port A as output and loops continuously, displaying the binary ASCII values for the names "Alief", "Ken", "Fathin", and "Pradita" on port A for 1 second each.

Uploaded by

Alief Sias
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Print

PR1: Sets port A as output and loops through binary numbers from 1 to 128, displaying each value on port A for 1 second before moving to the next value. It then loops from 128 to 1, displaying two patterns (0xAA and 0x55) on port A while decrementing the value. PR2: Sets port A as output and loops continuously, displaying the binary ASCII values for the names "Alief", "Ken", "Fathin", and "Pradita" on port A for 1 second each.

Uploaded by

Alief Sias
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Kelompok :

PR1 :
#include <mega16.h>
#include <delay.h>
unsigned char a,b,x;
void main(void)
{ DDRA=0xFF;
PORTA=0x00;
while (1)
{a=x=0x01;b=0x80;
while(a<b)
{while(x!=b){PORTA=x;delay_ms(1000);x=x<<1;}; a=a<<1;
while(x!=a){PORTA=x;delay_ms(1000);x=x>>1;}; b=b>>1;
};PORTA=16;delay_ms(500);
while(a>1)
{a=a>>1; PORTA=0xAA; delay_ms(250);
b=b<<1; PORTA=0x55; delay_ms(250);
};
};
}
PR2:
#include <mega8535.h>
#include <delay.h>
void main(void)
{ DDRA=0xFF;
PORTA=0x00;
while (1)
{PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
PORTA
};
}

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

0b01000000;
0b11111001;
0b00100100;
0b00110000;
0b00011001;
0b00010010;
0b00000010;
0b01111000;
0b00000000;
0b00010000;
0b00001000;
0b00000011;
0b01000110;
0b00100001;
0b00000110;
0b00001110;

delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);

Q Alief 18008009
Ken A 18008020
Fathin 18008022
Pradita 18008026

You might also like