1. Write a PIC16F877A assembler subroutine called “Mul_8x8” to multiply register Numb1 in memory location 20h, with register Numb2 in memory location 21h. The least significant byte result must be placed in register “AnswL” in memory location 22h. The most significant byte result must be placed in register “AnswH” in memory location 23h. Data in registers Numb1 and Numb2 must remain unchanged after the multiplication. First sketch a flowchart to determine the program structure and then write the firmware source code.
2. Write a PIC16F877A assembler subroutine called “DataStatistics” to count the number of registers in a memory block in RAM that contains number values that are greater than fifty, less than fifty and equal to fifty. The numbers counted must be placed in registers called “GreaterThan”, “LessThan” and “EqualTo”, located in memory 70h, 71h, and 72h respectively. Make use of indirect addressing to access the memory block in RAM that starts at 30h and ends at 60h.
3. Write a PIC16F877A assembler subroutine called “AsciiToBCD” to convert ASCII data in register “AsciiH” and “AsciiL” in memory locations 20h and 21h, to a single packed BCD byte. The result must be stored in register “PackedBCD” in memory location 22h.
4. Write a PIC16F877A assembler subroutine called “HexToAscii” to convert a hexadecimal byte in register “HexByte” in memory location 20h, into two ASCII characters. The higher nibble ASCII character must be returned in register “CharTens” in memory location 21h and the lower nibble ASCII character must be returned in register “CharUnits” in memory location 22h. A look-up table called “AsciiChar” must be used to convert a hexadecimal nibble value to an ASCII character.
5. Write a PIC16F877A assembler fixed delay subroutine called “D500US” using a single register called “DR1” located in memory 20h. The micro-controller is clocked by a 4MHz crystal oscillator. Show all calculations.
2. Write a PIC16F877A assembler subroutine called “DataStatistics” to count the number of registers in a memory block in RAM that contains number values that are greater than fifty, less than fifty and equal to fifty. The numbers counted must be placed in registers called “GreaterThan”, “LessThan” and “EqualTo”, located in memory 70h, 71h, and 72h respectively. Make use of indirect addressing to access the memory block in RAM that starts at 30h and ends at 60h.
3. Write a PIC16F877A assembler subroutine called “AsciiToBCD” to convert ASCII data in register “AsciiH” and “AsciiL” in memory locations 20h and 21h, to a single packed BCD byte. The result must be stored in register “PackedBCD” in memory location 22h.
4. Write a PIC16F877A assembler subroutine called “HexToAscii” to convert a hexadecimal byte in register “HexByte” in memory location 20h, into two ASCII characters. The higher nibble ASCII character must be returned in register “CharTens” in memory location 21h and the lower nibble ASCII character must be returned in register “CharUnits” in memory location 22h. A look-up table called “AsciiChar” must be used to convert a hexadecimal nibble value to an ASCII character.
5. Write a PIC16F877A assembler fixed delay subroutine called “D500US” using a single register called “DR1” located in memory 20h. The micro-controller is clocked by a 4MHz crystal oscillator. Show all calculations.