Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
New to AVR assembly programing language and using Atmel Studio 7. I've done other assignments which they are very simple and easy to complete but I have no idea where to start using arrays and for loops.

Write a program using a FOR loop type to find and count the number of elements within the following array that are > 50 and < 80
array:
75 71 127 96 77 32 53 11 58 82 25 94 54 66 118 111
122 25 64 61 126 87 125 57 96 101 92 52 7 59 112 33


What I have tried:

Don't have any code. I've been looking at examples and notes to try and complete this assignment.
Posted
Updated 23-Sep-20 6:04am
Comments
Richard MacCutchan 23-Sep-20 11:23am    
Get a book on the language you are trying to use, and study it in detail.

There is even an online reference: Beginner's introduction to AVR assembler language[^].
 
Share this answer
 
It's pretty simple: so simple I'm not giving you any code!

Think about a for loop:
C++
for (a ; d ; c)
  b;

a is the intialiazer: set a register to the number of elements in the array. Hint: ldi, anyone?

b is the body of code inside the loop. Hint: you will want a label before this.

c is the "move on to next value" code. Hint: is dec a month, or something else?

d is the test and branch if not complete. Hint: brne ring any bells?

Give it a try: this is not a complicated homework task!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900