USING MICROPROCESSORS AND MICROCOMPUTERS ( TOCCI, AMBROSIO ) SIXTH EDITION.
BASE ON 68HC11 MPU.
1) Read Ch7 and comparable sections in the AVR datasheet, then do the following.
* Use the AVR Instruction set reference to write the instruction ADD r5,r17 in binary as it is stored in memory.
* Write a sequence of AVR instructions that adds 7 to the value stored at memory location 0x12A and stores the result in r5.
* Write a sequence of AVR instructions that copies a string from program memory to PORTB one byte at a time using the LPM instruction. </p>
2) The data that an MPU receives from an input port are often in ASCII code. These data might be coming from an ASCII-coded keyboard, a remote video terminal, or an instrument like a digital voltmeter(DVM). The MPU must often convert these data to BCD before they can be processed.
The MPU can be programmed to convert the ASCII-coded decimal digits to packed BCD. For example, assume that memory locations 0050 and 0051 contain 00111001 and 00110101, respectively; these are the ASCII codes for the digits 9 and 5 respectively. These data bytes are to be converted to 10010101, which is the packed BCD representation of 95(base 10).
a) Draw the flowchart for a program that will perform this conversion. That is, it will take the two ASCII-coded digits from addresses 0050 and 0051 and will produce the packed BCD equivalent. Assume that address 0050 contains the most significant digit.