logo

Crowdly

[AVR-IO CPMK-18] Program bekerja sebagai berikut: Jika tombol MERAH d...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

[AVR-IO CPMK-18]

Program bekerja sebagai berikut:

Jika tombol

  • MERAH ditekan maka LED0,1 menyala 
  • HIJAU ditekan maka LED2,3 menyala
  • KUNING ditekan maka LED4,5 menyala
  • BIRU ditekan maka LED6,7 menyala

Jika semua pin PORTA diset sebagai input dan semua pin PORTB sebagai output, maka lengkapi ruang kosong program berikut:

.include "m8515def.inc"

.def temp=r16

.def led_on=r17

ldi temp, 0x ;2 digit

out DDRA, temp

ldi temp, 0x;2 digit

out DDRB, temp

CEK_INPUT:

    in temp,

    cpi temp, 0x;2 digit

     MERAH

    cpi temp, 0x;2 digit

     HIJAU

    cpi temp, 0x;2 digit

     KUNING

    cpi temp, 0x;2 digit

     BIRU

    rjmp

MERAH:

    ldi led_on,0x;2 digit

    rjmp LED

HIJAU:

    ldi led_on,0x;2 digit

    rjmp LED

KUNING:

    ldi led_on,0x;2 digit

    rjmp LED

BIRU:

    ldi led_on,0x;2 digit

    rjmp LED

LED:

    out PORTB,

    rjmp

More questions like this

Want instant access to all verified answers on scele.cs.ui.ac.id?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!