(UART_TxFloatNumber)
(UART_Printf)
Line 168: Line 168:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination ||  
+
|Defination || '''void UART_Printf(const char *argList, ...)'''
 
|-
 
|-
| Input Arguments ||  
+
| Input Arguments || '''variable length''' arguments similar to printf
 
|-
 
|-
| Return Value||  
+
| Return Value|| none
 
|-
 
|-
| Description ||
+
| Description ||This function is similar to printf function in C. It takes the arguments with specified format and prints accordingly .
 +
The supported format specifiers are as below.
 +
*%c: character
 +
*%d: decimal
 +
*%b: binary
 +
*%s: string
 +
*%f: float
 +
*%x: hexadecimal   
 
|-
 
|-
 
| Usage ||     
 
| Usage ||     
 
|}
 
|}

Revision as of 23:01, 20 December 2014

UART

UART_Init

{{#Widget:LibTable}}
Defination void UART_Init(uint32_t Baudrate)
Input Arguments

uint32_t : Baudrate to be configured.

Return Value none
Description This function is used to initialize the UART at specified baud rate.If the requested baud rate is not within the supported range then the default baud rate of 9600 is set.
Usage

UART_TxChar

{{#Widget:LibTable}}
Defination void UART_TxChar(char ch)
Input Arguments Ascii value of the character to be transmitted.
Return Value none
Description This function is used to transmit a char through UART module.
Usage

UART_RxChar

{{#Widget:LibTable}}
Defination char UART_RxChar()
Input Arguments none.
Return Value char: Ascii value of the character received
Description This function is used to receive a char from UART module. It waits till a char is received and returns it after reception.
Usage

UART_TxString

{{#Widget:LibTable}}
Defination void UART_TxString(char *string_ptr)
Input Arguments String(Address of the string) to be transmitted.
Return Value none
Description This function is used to transmit the ASCII string through UART..
  • The string_ptr points to the first char of the string and traverses till the end(NULL CHAR) and transmits a char each time
Usage

UART_RxString

{{#Widget:LibTable}}
Defination void UART_RxString(char *string_ptr)
Input Arguments char *string_ptr

Address of the string where the received data needs to be stored

Return Value none
Description
  1. This function is used to receive a ASCII string through UART till the carriage_return/New_line
  • The stream of data is copied to the buffer till carriage_return/New_line is encountered.
  • Once the Carriage_return/New_Line is received the string will be null terminated.
Usage

UART_TxDecimalNumber

{{#Widget:LibTable}}
Defination void UART_TxDecimalNumber(uint32_t num, uint8_t NumOfDigits )
Input Arguments uint32_t: Number to be transmitted on UART.

uint8_t : Number of digits to be transmitted

Return Value none
Description This function is used to transmit a max of 10digit decimal number.2nd parameter specifies the number of digits from the right side to be transmitted .

The output for the input combinations is as below.

  • (12345,4) then 4-digits ie. 2345 will be transmitted
  • (12345,6) then 6-digits ie. 012345 will be transmitted
  • (12345,C_DefaultDigitsToTransmit) then 12345 will be transmitted.
Usage

UART_TxHexNumber

{{#Widget:LibTable}}
Defination void UART_TxHexNumber(uint32_t num, uint8_t NumOfDigits )
Input Arguments uint32_t: Hexadecimal Number to be transmitted on UART.

uint8_t : Number of digits to be transmitted

Return Value none
Description This function is used to transmit a max of 10digit hex number.2nd parameter specifies the number of digits from the right side to be transmitted .

The output for the input combinations is as below .

  • (0x12AB,3) then 3-digits ie. 2AB will be transmitted
  • (0x12AB,6) then 6-digits ie. 0012AB will be transmitted
  • (0x12AB,C_DefaultDigitsToTransmit) then 12AB will be transmitted.
Usage

UART_TxBinaryNumber

{{#Widget:LibTable}}
Defination void UART_TxBinaryNumber(uint32_t num, uint8_t NumOfBits )
Input Arguments uint32_t: Hexadecimal Number to be transmitted on UART.

uint8_t : Number of bits to be transmitted

Return Value none
Description This function is used to transmit the binary equivalent of the given number. 2nd parameter specifies the number of LSB to be transmitted .

The output for the input combinations is as below .

  • (10,4) then 4-LSB will be transmitted ie. 1010
  • (10,8) then 8-LSB will be transmitted ie. 00001010
  • (10,2) then 2-LSB will be transmitted ie. 10
Usage

UART_TxFloatNumber

{{#Widget:LibTable}}
Defination void UART_TxFloatNumber(float num)
Input Arguments float: float Number to be transmitted on UART.
Return Value none
Description This function is used to transmit a floating point number .

Note : It supports 6digits of precision. Float will be disabled by default as it takes huge controller resources .It can be enabled by changing value of Enable_UART_TxFloatNumber to 1 in uart.h

Usage

UART_Printf

{{#Widget:LibTable}}
Defination void UART_Printf(const char *argList, ...)
Input Arguments variable length arguments similar to printf
Return Value none
Description This function is similar to printf function in C. It takes the arguments with specified format and prints accordingly .

The supported format specifiers are as below.

  • %c: character
  • %d: decimal
  • %b: binary
  • %s: string
  • %f: float
  • %x: hexadecimal
Usage