uartps
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Groups Pages
xuartps_hello_world_example.c File Reference

Overview

This file contains a design example using the XUartPs driver in polled mode.

The example uses the default setting in the XUartPs driver: . baud rate 9600 . 8 bit data . 1 stop bit . no parity

Note
This example requires an external SchmartModule connected to the pins for the device to display the 'Hello World' message onto a hyper-terminal.

MODIFICATION HISTORY:

Ver   Who    Date     Changes


1.00a drg/jz 01/13/10 First Release 1.04a hk 22/04/13 Changed the baud rate in the example to 115200. Fix for CR#707879 3.4 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028. 3.17 bkv 07/08/25 Fixed GCC Warning. 3.18 vlt 12/18/25 Update Doxygen comments to include SDT flow details.

 
#include "xparameters.h"
#include "xuartps.h"
#include "xil_printf.h"

Functions

int UartPsHelloWorldExample (UINTPTR BaseAddress)
 This function sends 'Hello World' to an external terminal in polled mode. More...
 
int main (void)
 Main function to call the Hello World example. More...
 

Function Documentation

int main ( void  )

Main function to call the Hello World example.

Returns
  • XST_FAILURE if the Test Failed .
  • A non-negative number indicating the number of characters sent.
Note
None

References UartPsHelloWorldExample().

int UartPsHelloWorldExample ( UINTPTR  BaseAddress)

This function sends 'Hello World' to an external terminal in polled mode.

The purpose of this function is to illustrate how to use the XUartPs driver.

Parameters
BaseAddresscontains the base address of the device
Returns
  • XST_FAILURE if the UART driver could not be initialized successfully.
  • A non-negative number indicating the number of characters sent.
Note
In XSCT/classic flow, DeviceId is used to look up the device configuration.

References XUartPs_Config::BaseAddress, XUartPs_CfgInitialize(), XUartPs_LookupConfig(), XUartPs_Send(), and XUartPs_SetBaudRate().

Referenced by main().