Using Atmel Studio
Write an AVR program that convert a distance readingin Miles (variable Mi) to
Kilometer (variable Km).
Hint1: You can use the formula: Km ≈ Mi * 1.60 = Mi * 16 / 10
Multiplying Mi (8-bits variable) by ‘16’ will give the result of16-bits, then you
need a subroutine for dividing 16-bits by 8-bits (divide the resultof multiplication
by ‘10’). Division can be implemented as a set ofsubtractions.
Hint2: In order to define variable Mi and Km, you can add followinglines to the top of
your program:
.INCLUDE <m328pdef.inc>
.DSEG
Mi: .BYTE 1
Km: .BYTE 1
.CSEG
.ORG 0x0000
using Atmel studio Write an AVR program that convert adistance reading in Miles (variable Mi) to Kilometer (variableKm).
.INCLUDE <m328pdef.inc>
.DSEG
Mi: .BYTE 1
Km: .BYTE 1
.CSEG
.ORG 0x0000
Expert Answer
Answer to Using Atmel Studio Write an AVR program that convert a distance reading in Miles (variable Mi) to Kilometer (variable Km…