Question

Assembly using "Atmel" : 1- Write a program that counts from 0 to 255 and show...

Assembly using "Atmel" :

1- Write a program that counts from 0 to 255 and show the result on PORTD (shown on 8 LEDs).

2- Write a program that adds two numbers and show their sum on PORTD.

Homework Answers

Answer #1

1.

int LPins[] = {2,3,4,5,6,7,8,9};

void setup()
{
for(int i = 0; i < 8; i++)
{   
pinMode(LPins[i],OUTPUT);
}   
}
void loop()   
{
for (int i=0; i<256; i++)
{
showBinNumber(i);
delay(256-i);
}
}

void showBinNumber(int num) {
for (int i=0; i<8; i++) {
if (num%2)
digitalWrite(LPins[i], HIGH);
else
digitalWrite(LPins[i], LOW);
num/=2;
}
}

2.

# Number 1
LDI R16 0x…
LDI R17 0x…
LDI R18 0x…
LDI R19 0x…
# Number 2
LDI R20 0x…
LDI R21 0x…
LDI R22 0x…
LDI R23 0x…
# Add LSB of 1 and 2, result will be in R20
ADD R20,R16
# Add remaining bytes using the add-with-carry operation
ADC R21,R17
ADC R22,R18
ADC R23,R19 # MSB


Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program to count number between 0 and 255 in binary using 8 LEDs connected...
Write a program to count number between 0 and 255 in binary using 8 LEDs connected to the Arduino. This code should start at 0 and loop back to 0 once it counts to 255. Delay 0.25s between counts.
1. Open “Atmel Studio” and write an assembly program to count up from 0 to 9...
1. Open “Atmel Studio” and write an assembly program to count up from 0 to 9 and show the result on a CC seven segment.
Using for loops: - write a Java program that adds numbers between 1 to 100 and...
Using for loops: - write a Java program that adds numbers between 1 to 100 and prints the result. - write a Java program that adds odd numbers between 1 to 100 and prints the result - write a Java program that averages even numbers between 5 to 30 and prints the result
Write an assembly code for a M68CH12 microcontroller that counts from 0000-9999 using even numbers on...
Write an assembly code for a M68CH12 microcontroller that counts from 0000-9999 using even numbers on the seven segment display.
open atmell studio and write an assembly program that toggels a 8 leds for differnt collor...
open atmell studio and write an assembly program that toggels a 8 leds for differnt collor connected to portB with a custom delay time i want the code of this program
Write an ARM assembly language program that counts the number of 1’s for any value in...
Write an ARM assembly language program that counts the number of 1’s for any value in R0. The program must assemble/compile in KEIL and must be able to run in the KEIL simulator. Generally, R0 may contain any value, but for purpose of this exercise, you may move 0x2345ABCD into R0. The number in R0 does not need be preserved. You may use any other registers as you need. The result, total count of 1’s in R0, should be in...
Write a Hack Assembly Language program to calculate the quotient from a division operation. The values...
Write a Hack Assembly Language program to calculate the quotient from a division operation. The values of dividend a and divisor b are stored in RAM[0] (R0) and RAM[1] (R1), respectively. The dividend a is a non-negative integer, and the divisor b is a positive integer. Store the quotient in RAM[2] (R2). Ignore the remainder. Example: if you are given two numbers 15 and 4 as dividend a (R0) and divisor b (R1), respectively, the answer will be 3 stored...
Write a program that adds the sum of digits in an integer and loops until 0...
Write a program that adds the sum of digits in an integer and loops until 0 is entered to end the program C++.
Challenge 1 - SumDigits.java Write a program that reads an integer between 0 and 1000 and...
Challenge 1 - SumDigits.java Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer. For example, if an integer is 837, the sum of all digits is 18. Sample output: Enter an integer between 0 and 1000: 837 The sum of all digits in 837 is 18
Please write a program in assembly language(by using EMU86 simulator), to calculate the 2450 by 30...
Please write a program in assembly language(by using EMU86 simulator), to calculate the 2450 by 30 (2450/30), and print out the result.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • Suppose that people's heights (in centimeters) are normally distributed, with a mean of 170 and a...
    asked 9 minutes ago
  • Use the information from the following Income Statement to create and Projected Income Statement and solve...
    asked 22 minutes ago
  • An unequal tangent vertical curve has the following elements: g1=-3.25%, g2=75%, total length = 500.00’, length...
    asked 24 minutes ago
  • Please write clear definitions of the following legal terms. Commerce Clause Supremacy Clause Indictment Tort
    asked 28 minutes ago
  • Do you think Moralistic Therapeutic Deism is an accurate reflection of society today? What are relevant...
    asked 33 minutes ago
  • The mean operating cost of a 737 airplane is $2,071 per day. Suppose you take a...
    asked 41 minutes ago
  • Arguments can be made on both sides of this debate about the ethical implications of using...
    asked 47 minutes ago
  • In the Chapter, they mention the idea of strategizing around your cash flows. Why are cash...
    asked 53 minutes ago
  • Company A signed a fixed-price $6,500,000 contract to construct a building. At the end of Year...
    asked 54 minutes ago
  • An unequal tangent vertical curve has the following elements: g1=-3.25%, g2=1.75%, total length = 500.00’, length...
    asked 1 hour ago
  • In a previous​ year, 61​% of females aged 15 and older lived alone. A sociologist tests...
    asked 1 hour ago
  • Topic: Construction - Subsurface Investigation (Note: Briefly discuss in your own words, 1 paragraph minimum.) Typically...
    asked 2 hours ago