Menu

(Solved) : Example 7 27 Write Avr C Program Convert Ascii Digits 4 7 Packed Bcd Dis Play Portb Soluti Q37018441 . . .

Example 7-27 Write an AVR C program to convert ASCII digits of 4 and 7 to packed BCD and dis- play them on PORTB. SolutionExample 7-27 Write an AVR C program to convert ASCII digits of 4′ and ‘7’ to packed BCD and dis- play them on PORTB. Solution: include <avr/ io.h> //standard AVR header int main (void) unsigned char bcdbyte; unsigned char w 4 unsigned char z 7 DDRB 0xFF: WW &0x0F //make Port B an output //mask 3 //shift left to make upper BCD digit //mask 3 //combine to make packed BCD bcdbyte wI zi PORTB bedbytei return 0 3. Extend Example 7-27 to read one number each from ASCI 1 !1 and ASCIL 211 arrays and convert them to a packed BCD number and store the number in array PKD_BCDI1 ASCII 111 (‘o,1,2,3 ”5′,6 7 8:9’1 ASCII-2 [ 1-1’9′,’8′,’ア,’6′,’S’,’4′,’3′,’2′,’1′,’0′); PKD BCD [101 Show transcribed image text

Expert Answer


Answer to Example 7 27 Write Avr C Program Convert Ascii Digits 4 7 Packed Bcd Dis Play Portb Soluti Q37018441 . . .

OR