Documentos de Académico
Documentos de Profesional
Documentos de Cultura
AVR Assembly
Nama : Gilang Satria Ajie
NIM : I0717017
NIM = 017
Binary 00010001
port 0 dan port 4
Delay = 03 detik
Script Assembly
;
; AssemblerApplication1.asm
;
; Created: 5/9/2018 10:00:21 AM
; Author : Aimma
;
main:
LDI r16, 0xFF // Load the immedate value 0xFF (all bits 1) into
register 16
OUT DDRB, r16 // Set Data Direction Register B to output for all pins
loop:
SBI PortB, 0 // Set the 0 bit in PortB. (i.e. turn on the LED)
SBI PortB, 1 // Set the 4th bit in PortB. (i.e. turn on the LED)
RCALL delay_03
CBI PortB, 0 // Clear the 0 bit in PortB. (i.e. turn off the LED)
CBI PortB, 1 // Clear the 4th bit in PortB. (i.e. turn off the LED)
RCALL delay_03
RJMP loop // Loop again
outer_loop:
LDI r23, low(3037)
LDI r24, high(3037)
delay_loop:
ADIW r24, 1
BRNE delay_loop
DEC r16
BRNE outer_loop
RET
Script C
/*
* GccApplication1.c
*
* Created: 5/9/2018 10:08:47 AM
* Author : Aimmma
*/
int main(void)
{
DDRB = 0xFF;
PORTB = 0x00;
/* Replace with your application code */
while (1)
{
PINB = (1<<PB0);
PINB = (1<<PB1);
_delay_ms(3000);
}
}
Script Disassembly
--- c:\users\aimma\Documents\Atmel
Studio\7.0\GccApplication1\GccApplication1\Debug/.././main.c
{
DDRB = 0xFF;
00000040 SER R24 Set Register
00000041 OUT 0x04,R24 Out to I/O location
PORTB = 0x00;
00000042 OUT 0x05,R1 Out to I/O location
PINB = (1<<PB0);
00000043 LDI R25,0x01 Load immediate
PINB = (1<<PB1);
00000044 LDI R24,0x02 Load immediate
PINB = (1<<PB0);
00000045 OUT 0x03,R25 Out to I/O location
PINB = (1<<PB1);
00000046 OUT 0x03,R24 Out to I/O location