Atmega32 Embedded C - ASCII to Packed BCD Conversion

Atmega32 Embedded C - ASCII to Packed BCD Conversion


/*
 * Created: 01/04/2018 00:30:00
 * Author : ANANDHU-PC
 */

#include <avr/io.h>
int main(void)
{
    while (1)
    {
       
        unsigned char x='4';
        unsigned char z='7';
        DDRB=0xff;
        x = x & 0x0f;
        z = z & 0x0f;
        z = z<<4;
        PORTB=x|z;
       
    }
    return 0;
}

Output

PORTB=0x74

Comments

Popular posts from this blog

Introduction to C++ Programming Language

The Assembly Process Of 8086 Microprocessor-Two Pass Assembling Steps