Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Using the AVR Studio simulator. Write an assembly program for the Atmega 8535 AVR Microcontroller, that generates a random set of lottery numbers. Your

Problem

Using the AVR Studio simulator.

Write an assembly program for the Atmega 8535 AVR Microcontroller, that generates a random set of lottery numbers.

Your system should generate six, two-digit numbers, between 01 to 59.

For each two-digit number, the most significant digit should be displayed on Port A in binary, the least significant bit should be displayed on Port B.

Development Program code should be structured using subroutines and must contain sufficient comments to annotate the code's behaviour.

The system should be developed and tested incrementally. i.e., add one feature at a time, test it, before moving on.

Pseudo Random Number Algorithm

If you start with a pre-seeded number, something other than zero, you can use the XOR and shift method to create a random-number generator.

When done correctly, you will have a sequence that does not repeat for (2n- 1) times, where n is the number of bits you are shifting.

It works like this. Start with a number, for example the hex number $66, 0110 0110 in binary.

Take the bottom two bits and XOR them together, then take that result and shift it onto the most significant bit of the number.

If you continue this method, you achieve a sense of randomness. First number and successive numbers: - 66, B3, 59, AC etc.

example:

image text in transcribed
\f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions