Search code examples
cavratmegaatmelatmelstudio

Convert int to string to display on lcd, atmel studio c language


i write a program in atmel studio for my avr atmega 32 ic. By keypad enter a number between 0 to999. I want to display it on lcd. My problem is: lcd take only char and string.i store the entered number in a int variable. How can i convert it to string or char. I writted this function; Y is entered number by keypad that is int:

char str;
itoa(y,str,10);
alcd_putc(str);

Bu it dosent work. Help me thanks.


Solution

  • Use alcd_puts function like following:

    char str[5]; //< Use a array of char
    itoa(y,str,10);
    alcd_puts(str);