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

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.