This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Display value in 20x4 LCD with TM4C 123GXL

My objective is to display a variable value in 20x4 LCD that variable value will get sourced
either from adc or some communication like uart,CAN so i was trying with just
a variable x defined 5 which i want to display

i am using  usprintf function
but it is giving error of expression is missing

let me know if m missing something or understanding is wronge




Code snippet



#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "utils/ustdlib.h"



// initilization of global variable

uint32_t X=5;
char X1[3]={0};

void main(void)
{
    SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);      // Setting the System Clock 40Mhz

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);    // Enable GPIO Port F
    SysCtlDelay(6);                                   // 450ns approx
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);    // Enable GPIO Port B For LCD Lines
    SysCtlDelay(6);                                   // 450ns approx

    // Check if the peripheral access is Enabled.
       while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF))
       {
       }
       while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOB))
       {
       }

       GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3| GPIO_PIN_4| GPIO_PIN_5| GPIO_PIN_6| GPIO_PIN_7);
       GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);  //Red,Blue,Green Gpio Pin as a Output Pin
       GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, 0x0);      //  R/W Low, Enable LCD Data Write
       LcdInit();    // LCD Configuration
       X=5;

      // Loop forever.
      while(1)
       {
         
             displaystrn(2,3,"Tiva=");
            usprintf(X1,"%u",X);        //usprintf(char * restrict s, const char * restrict format, ...);
            displaystrn(2,3,X1);
            delay_ms(1000);
            LcdClear();
            delay_ms(1000);
       }    // End of Infinite Loop

}     // End of Main Function