m
 
(59 intermediate revisions by 2 users not shown)
Line 8: Line 8:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination ||void LCD_Init ( uint8_t v_lcdMode_u8,uint8_t v_lcdNoOfLines_u8,uint8_t v_MaxCharsPerLine_u8)
+
|Defination ||void LCD_Init ( uint8_t var_lcdMode_u8, uint8_t var_lcdNoOfLines_u8, uint8_t var_MaxCharsPerLine_u8)
 
|-
 
|-
| Input Arguments || *uint8_t: required Mode 4/8-bit<br /> *uint8_t: Number of lines of LCD<br /> *uint8_t: Number of Chars per line
+
| Input Arguments ||<br />
 +
*uint8_t: required Mode 4/8-bit <br />
 +
*uint8_t: Number of lines of LCD<br />
 +
*uint8_t: Number of Chars per line
 
|-
 
|-
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
 
| Description ||This function is used to initialize the lcd.<br />It initializes the LCD for selected mode(4/8-bit) and Type(16x2/16x1 etc)
 
| Description ||This function is used to initialize the lcd.<br />It initializes the LCD for selected mode(4/8-bit) and Type(16x2/16x1 etc)
 +
|-
 +
| Usage ||LCD_Init(8,2,16) //Initialize 2x16 LCD in 8-bit Mode<br />LCD_Init(4,2,16) //Initialize 2x16 LCD in 4-bit Mode<br />LCD_Init(4,4,16) //Initialize 4x16 LCD in 8-bit Mode
 +
|}
 +
 +
==LCD_CmdWrite== 
 +
{|{{Widget:LibCol}}
 +
{{#Widget:LibTable}}
 +
|-
 +
|Defination || void LCD_CmdWrite( uint8_t var_lcdCmd_u8)
 +
|-
 +
| Input Arguments || 8-bit command supported by LCD.
 +
|-
 +
| Return Value|| none
 +
|-
 +
| Description ||This function sends a command to LCD.<br />Some of the commonly used commands are defined in lcd.h.<br />For more commands refer the data sheet.<br />The behaviour is undefined if unsupported commands are sent.   
 
|-
 
|-
 
| Usage ||   
 
| Usage ||   
 +
LCD_CmdWrite(0x0c);                                      //Sets display On and Cursor Off<br />
 +
LCD_CmdWrite(CMD_DISPLAY_ON_CURSOR_OFF); //Recommended
 
|}
 
|}
  
Line 31: Line 51:
 
| Description ||This function clears the LCD and moves the cursor to beginning of first line
 
| Description ||This function clears the LCD and moves the cursor to beginning of first line
 
|-
 
|-
| Usage ||    
+
| Usage ||  
 +
LCD_Clear(); // Clears the lcd and sets the cursor to beginning of the first line.   
 
|}
 
|}
 
 
  
  
Line 42: Line 61:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination || void LCD_GoToLine(uint8_t v_lineNumber_u8)
+
|Defination || void LCD_GoToLine(uint8_t var_lineNumber_u8)
 
|-
 
|-
| Input Arguments || uint8_t: Line number.
+
| Input Arguments || uint8_t: Line number to move the cursor.
 
|-
 
|-
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||This function moves the Cursor to beginning of the specified line. If the requested line number is out of range, it will not move the cursor.
+
| Description ||This function moves the Cursor to beginning of the specified line. If the requested line number is out of range, it will not move the cursor.<br />
    Note: The line numbers run from 1 to Maxlines,
+
Note: The line numbers run from 1 to Maxlines.<br />To avoid the confusion the below enums has to be used for selecting lines.<br />For four line LCD the enums are as below:<br />
  To avoid the confusion the below enums has to be used for selecting lines
+
*E_LcdLineOne<br />
          For four line LCD the enums are as below:
+
*E_LcdLineTwo<br />
          *E_LcdLineOne,
+
*E_LcdLineThree<br />
          *E_LcdLineTwo,
+
*E_LcdLineFour
          *E_LcdLineThree,
+
          *E_LcdLineFour,
+
 
|-
 
|-
 
| Usage ||     
 
| Usage ||     
 +
LCD_GoToLine(1);                  //Moves the cursor to beginning of first line
 +
LCD_GoToLine(E_LcdLineOne); //Recommended usage
 
|}
 
|}
  
Line 73: Line 92:
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||  This function moves the Cursor to beginning of the next line.  If the cursor is on last line and NextLine command is issued then it will move the cursor to first line.
+
| Description ||  This function moves the Cursor to beginning of the next line.  If the cursor is on last line and NextLine command is issued then it will move the cursor to first line.
 
|-
 
|-
 
| Usage ||   
 
| Usage ||   
 +
LCD_GoToNextline();  //Moves the cursor to beginning of next line.
 
|}
 
|}
 
  
  
Line 86: Line 105:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination || void LCD_SetCursor(char v_lineNumber_u8,char v_charNumber_u8)
+
|Defination || void LCD_SetCursor(char var_lineNumber_u8,char var_charNumber_u8)
 
|-
 
|-
| Input Arguments || *row: line number(line1=1, line2=2)
+
| Input Arguments ||<br />
                          For 2line LCD the I/P argument should be either 1 or 2.
+
*row: line number(line1=1, line2=2)<br />For 2line LCD the I/P argument should be either 1 or 2.<br />
                      *col: char number.
+
*col: char number.<br />For 16-char LCD the I/P argument should be between 0-15.
                            For 16-char LCD the I/P argument should be between 0-15.
+
 
|-
 
|-
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||  This function moves the Cursor to specified position
+
| Description ||  This function moves the Cursor to specified position.<br />
      *Note:If the Input(Line/Char number) are out of range then no action will be taken
+
*Note:If the Input(Line/Char number) are out of range then no action will be taken
 
|-
 
|-
| Usage ||  
+
| Usage ||  
 +
LCD_SetCursor(1,10);    //Moves the cursor to 1st line 11th char.
 +
LCD_SetCursor(5,10);    //No action taken as line 5 is out of range
 
|}
 
|}
 
 
 
 
 
==LCD_CmdWrite== 
 
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
|-
 
|Defination || void LCD_CmdWrite( uint8_t v_lcdCmd_u8)
 
|-
 
| Input Arguments || 8-bit command supported by LCD.
 
|-
 
| Return Value|| none
 
|-
 
| Description ||  This function sends a command to LCD. Some of the commonly used commands are defined in lcd.h. For more commands refer the data sheet and send the supported command. The behaviour is undefined if unsupported commands are sent.   
 
|-
 
| Usage || 
 
|}
 
 
 
 
  
 
==LCD_DisplayChar==
 
==LCD_DisplayChar==
Line 127: Line 125:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination || void LCD_DisplayChar( char v_lcdData_u8)
+
|Defination || void LCD_DisplayChar( char var_lcdData_u8)
 
|-
 
|-
 
| Input Arguments || uint8_t: ASCII value of the char to be displayed.
 
| Input Arguments || uint8_t: ASCII value of the char to be displayed.
Line 133: Line 131:
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||This function sends a character to be displayed on LCD.
+
| Description ||This function sends a character to be displayed on LCD.<br />Any valid ascii value can be passed to display the respective character
                  Any valid ascii value can be passed to display the respective character
+
 
|-
 
|-
| Usage ||  
+
| Usage ||  
 +
LCD_DisplayChar(65);    //Displays 'A' on LCD<br />
 +
LCD_DisplayChar(0x41);  //Displays 'A' on LCD <br />
 +
LCD_DisplayChar('A');    //Recommended usage
 
|}
 
|}
 
  
  
Line 147: Line 146:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination || void LCD_DisplayString(char *p_stringPointer_u8)
+
|Defination || void LCD_DisplayString(char *ptr_stringPointer_u8)
 
|-
 
|-
 
| Input Arguments || char*:String(Address of the string) to be displayed.
 
| Input Arguments || char*:String(Address of the string) to be displayed.
Line 155: Line 154:
 
| Description ||This function is used to display the ASCII string on the lcd.
 
| Description ||This function is used to display the ASCII string on the lcd.
 
|-
 
|-
| Usage ||    
+
| Usage ||  
 +
<syntaxhighlight>
 +
void main()
 +
{
 +
  char myString[]={"hello, world"};
 +
  LCD_DisplayString(myString);
 +
  LCD_DisplayString("good morning");
 +
 +
</syntaxhighlight>
 
|}
 
|}
 
 
 
 
  
 
==LCD_ScrollMessage==
 
==LCD_ScrollMessage==
Line 166: Line 169:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination ||  void LCD_ScrollMessage(uint8_t v_lineNumber_u8, char *p_msgPointer_u8)
+
|Defination ||  void LCD_ScrollMessage(uint8_t var_lineNumber_u8, char *ptr_msgPointer_u8)
 
|-
 
|-
 
| Input Arguments ||
 
| Input Arguments ||
Line 174: Line 177:
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||This function scrolls the given message on the specified line. If the specified line number is out of range then the message will be scrolled on first line
+
| Description || This function scrolls the given message on the specified line.<br />If the specified line number is out of range then the message will be scrolled on first line.<br />
 +
*Note: Leave 7-8 spaces at the beginning and 1 space at the end of the message to be scrolled.
 
|-
 
|-
| Usage ||    
+
| Usage ||  
 +
LCD_ScrollMessage("          Welcome to embedded programming ");
 
|}
 
|}
  
Line 182: Line 187:
  
  
==LCD_DisplayDecimalNumber==
+
==LCD_DisplayNumber==
 
{|{{Widget:LibCol}}
 
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination || void LCD_DisplayNumber(uint32_t v_DecNumber_u32, uint8_t v_numOfDigitsToDisplay_u8 )
+
|Defination || void LCD_DisplayNumber(NumericSystem_et e_typeOfNum_e8, uint32_t var_number_u32, uint8_t var_numOfDigitsToDisplay_u8)
 
|-
 
|-
 
| Input Arguments ||  
 
| Input Arguments ||  
 +
*NumericSystem_et: Specifies type of number ENUM_BINARY(2),ENUM_DECIMAL(10), ENUM_Hex(16)
 
*uint32_t: Number to be displayed on the LCD.
 
*uint32_t: Number to be displayed on the LCD.
 
*uint8_t : Number of digits to be displayed
 
*uint8_t : Number of digits to be displayed
Line 194: Line 200:
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||This function is used to display a max of 10digit decimal number.
+
| Description ||
2nd parameter specifies the number of digits from the right side to be displayed
+
This function is used to display a max of 10digit decimal/Hex number OR specified number of bits for binary number.<br>
The output for the input combinations is as below
+
1st parameter specifies type of number ENUM_BINARY(2),ENUM_DECIMAL(10), ENUM_Hex(16).<br>
*(12345,4) then 4-digits ie. 2345 will be displayed
+
3rd parameter specifies the number of digits from the right side to be displayed.<br>
*(12345,6) then 6-digits ie. 012345 will be displayed
+
The output for the input combinations is as below<br>
*(12345,C_DisplayDefaultDigits_U8) then 12345 will be displayed.
+
Binary:      
|-
+
| Usage ||   
+
|}
+
 
+
 
+
 
+
 
+
==LCD_DisplayHexNumber==
+
{|{{Widget:LibCol}}
+
{{#Widget:LibTable}}
+
|-
+
|Defination ||void  LCD_DisplayHexNumber(uint32_t v_hexNumber_u32, uint8_t v_numOfDigitsToDisplay_u8)
+
|-
+
| Input Arguments ||
+
*uint32_t: Hexadecimal Number to be displayed on the LCD.
+
*uint8_t : Number of digits to be displayed
+
|-
+
| Return Value|| none
+
|-
+
| Description ||This function is used to display a max of 10digit hex number.2nd parameter specifies the number of digits from the right side to be displayed .
+
The output for the input combinations is as below
+
*(0x12AB,3) then 3-digits ie. 2AB will be displayed
+
*(0x12AB,6) then 6-digits ie. 0012AB will be displayed
+
*(0x12AB,C_DisplayDefaultDigits_U8) then 12AB will be displayed.
+
|-
+
| Usage ||      
+
|}
+
 
+
 
+
 
+
 
+
==LCD_DisplayBinaryNumber==
+
{|{{Widget:LibCol}}
+
{{#Widget:LibTable}}
+
|-
+
|Defination || void  LCD_DisplayBinaryNumber(uint32_t v_binNumber_u32, uint8_t v_numOfBitsToDisplay_u8)
+
|-
+
| Input Arguments ||
+
*uint32_t: Hexadecimal Number to be displayed on the LCD.
+
*uint8_t: Number of bits to be displayed
+
|-
+
| Return Value|| none
+
|-
+
| Description ||This function is used to display the binary equivalent of the given number.2nd parameter specifies the number of LSB to be displayed .
+
 
+
The output for the input combinations is as below
+
 
*(10,4) then 4-LSB will be displayed ie. 1010
 
*(10,4) then 4-LSB will be displayed ie. 1010
 
*(10,8) then 8-LSB will be displayed ie. 00001010
 
*(10,8) then 8-LSB will be displayed ie. 00001010
 
*(10,2) then 2-LSB will be displayed ie. 10
 
*(10,2) then 2-LSB will be displayed ie. 10
 +
               
 +
Decimal:
 +
*(10,12345,4) then 4-digits ie. 2345 will be displayed
 +
*(ENUM_DECIMAL,12345,6) then 6-digits ie. 012345 will be displayed
 +
*(10,12345,C_DisplayDefaultDigits_U8) then 12345 will be displayed.\
 +
             
 +
Hex:
 +
*(16,0x12AB,3) then 3-digits ie. 2AB will be displayed
 +
*(ENUM_Hex,0x12AB,6) then 6-digits ie. 0012AB will be displayed
 +
*(ENUM_Hex,0x12AB,C_DisplayDefaultDigits_U8) then 12AB will be displayed.
 
|-
 
|-
| Usage ||    
+
| Usage ||  
 +
uint32_t decNumber = 123456;<br />
 +
LCD_DisplayDecimalNumber(decNumber,5); //Display last 5-digits of Number<br />
 +
LCD_DisplayDecimalNumber(12345,4);  //Display last 4-digits of number   
 
|}
 
|}
 
 
 
 
==LCD_DisplayFloatNumber==
 
{|{{Widget:LibCol}}
 
{{#Widget:LibTable}}
 
|-
 
|Defination || void  LCD_DisplayFloatNumber(float v_floatNum_f32)
 
|-
 
| Input Arguments || float: Number to be displayed on the LCD.
 
|-
 
| Return Value|| none
 
|-
 
| Description ||This function is used to display a floating point number It supports 6digits of precision.
 
Note: Float will be disabled by default as it takes huge controller resources
 
It can be enabled by changing value of Enable_LCD_DisplayFloatNumber to 1 in lcd.h        
 
|-
 
| Usage ||   
 
|}
 
 
 
 
  
 
==LCD_Printf==
 
==LCD_Printf==
Line 280: Line 230:
 
{{#Widget:LibTable}}
 
{{#Widget:LibTable}}
 
|-
 
|-
|Defination || '''void LCD_Printf(const char *argList, ...)'''
+
|Defination || void LCD_Printf(const char *argList, ...)
 
|-
 
|-
| Input Arguments || '''variable length''' arguments similar to printf
+
| Input Arguments || variable length arguments similar to printf
 
|-
 
|-
 
| Return Value|| none
 
| Return Value|| none
 
|-
 
|-
| Description ||This function is similar to printf function in C. It takes the arguments with specified format and prints accordingly .
+
| Description ||This function is similar to printf function in C. It takes the arguments with specified format and displays accordingly .
 
The supported format specifiers are as below.
 
The supported format specifiers are as below.
 
*%c: character
 
*%c: character
Line 303: Line 253:
  
 
|-
 
|-
| Usage ||    
+
| Usage ||
|}
+
 
+
 
+
 
+
 
+
==Usage Guide==
+
 
<syntaxhighlight>
 
<syntaxhighlight>
/* Program to demonstrate the LCD library usage*/
+
void main()
#include"lcd.h"
+
#include"delay.h"
+
 
+
int main()
+
 
{
 
{
char a_displayMsg_u8[]={"Good Morning"};
+
uint16_t decNum=1234;//16-bit
char v_lcdData_u8='A';
+
uint32_t longDec=12345678;//32-bit
uint16_t v_number_u16= 1234u;
+
float floatNum=1234.5678;
 +
uint16_t hexNum=0xABCD;
 +
char myString[]={"hello, world};
  
 +
LCD_Printf("%d %l %f %x %b %s",decNum,longDec,floatNum,hexNum,hexNum,myString);
 +
LCD_Printf("D:%d,L:%l,F=%f,H:%x,Str:%s",1234,12345678,123.456,0xAB,"hello");
 +
}
  
   LCD_Init(8,2,16);
+
</syntaxhighlight>    
  LCD_ScrollMessage(0,"            Program to illustrate the lcd library usage ");
+
|}
  
 +
==Usage Guide==
 +
<html>
 +
<script src="https://gist.github.com/Amritach/f6623a13490f16d1ff6a.js"></script>
 +
</html>
  
  LCD_Clear();
+
{{DISQUS}}
  LCD_DisplayString("Hello, world");    /* Display the specified Message */
+
  LCD_GoToNextLine();
+
  LCD_DisplayString(a_displayMsg_u8);  /* Display the message stored in a string */
+
 
+
  DELAY_sec(2);
+
  LCD_Clear();
+
  LCD_DisplayString("Display Char\n");
+
  LCD_DisplayChar('X');            /* Display the specified Ascii character */
+
  LCD_DisplayChar(v_lcdData_u8);    /* Display the char stored in a variable */
+
 
+
 
+
  DELAY_sec(2);
+
  LCD_Clear();
+
  LCD_DisplayString("D:");
+
  LCD_DisplayDecimalNumber(1234,5);  /* Display the specified digits of a number */
+
  LCD_DisplayString(" H:");
+
  LCD_DisplayHexNumber(0xABCD,5);    /* Note here the num=1234, and digitsToDisplay=5 */
+
  LCD_GoToNextLine();                /* The number displayed on LCD will be as below*/
+
  LCD_DisplayBinaryNumber(0xABCD,16); /* dec=01234, hex=0ABCD,
+
                                        bin=1010101111001101*/
+
 
+
 
+
 
+
  DELAY_sec(2);
+
  LCD_Clear();
+
  LCD_Printf("D=%d H=%x \n%b",v_number_u16,v_number_u16,v_number_u16);
+
 
+
 
+
 
+
  DELAY_sec(2);
+
  LCD_Clear();
+
  LCD_Printf("Enjoy Embedded \nProgramming");
+
  while(1);
+
 
+
  return 0;
+
  }
+
</syntaxhighlight>
+

Latest revision as of 18:08, 30 May 2015

LCD

LCD_Init

{{#Widget:LibTable}}
Defination void LCD_Init ( uint8_t var_lcdMode_u8, uint8_t var_lcdNoOfLines_u8, uint8_t var_MaxCharsPerLine_u8)
Input Arguments
  • uint8_t: required Mode 4/8-bit
  • uint8_t: Number of lines of LCD
  • uint8_t: Number of Chars per line
Return Value none
Description This function is used to initialize the lcd.
It initializes the LCD for selected mode(4/8-bit) and Type(16x2/16x1 etc)
Usage LCD_Init(8,2,16) //Initialize 2x16 LCD in 8-bit Mode
LCD_Init(4,2,16) //Initialize 2x16 LCD in 4-bit Mode
LCD_Init(4,4,16) //Initialize 4x16 LCD in 8-bit Mode

LCD_CmdWrite

{{#Widget:LibTable}}
Defination void LCD_CmdWrite( uint8_t var_lcdCmd_u8)
Input Arguments 8-bit command supported by LCD.
Return Value none
Description This function sends a command to LCD.
Some of the commonly used commands are defined in lcd.h.
For more commands refer the data sheet.
The behaviour is undefined if unsupported commands are sent.
Usage

LCD_CmdWrite(0x0c); //Sets display On and Cursor Off
LCD_CmdWrite(CMD_DISPLAY_ON_CURSOR_OFF); //Recommended

LCD_Clear

{{#Widget:LibTable}}
Defination void LCD_Clear()
Input Arguments none.
Return Value none.
Description This function clears the LCD and moves the cursor to beginning of first line
Usage

LCD_Clear(); // Clears the lcd and sets the cursor to beginning of the first line.


LCD_GoToLine

{{#Widget:LibTable}}
Defination void LCD_GoToLine(uint8_t var_lineNumber_u8)
Input Arguments uint8_t: Line number to move the cursor.
Return Value none
Description This function moves the Cursor to beginning of the specified line. If the requested line number is out of range, it will not move the cursor.

Note: The line numbers run from 1 to Maxlines.
To avoid the confusion the below enums has to be used for selecting lines.
For four line LCD the enums are as below:

  • E_LcdLineOne
  • E_LcdLineTwo
  • E_LcdLineThree
  • E_LcdLineFour
Usage

LCD_GoToLine(1); //Moves the cursor to beginning of first line LCD_GoToLine(E_LcdLineOne); //Recommended usage



LCD_GoToNextline

{{#Widget:LibTable}}
Defination void LCD_GoToNextLine()
Input Arguments none
Return Value none
Description This function moves the Cursor to beginning of the next line. If the cursor is on last line and NextLine command is issued then it will move the cursor to first line.
Usage

LCD_GoToNextline(); //Moves the cursor to beginning of next line.



LCD_SetCursor

{{#Widget:LibTable}}
Defination void LCD_SetCursor(char var_lineNumber_u8,char var_charNumber_u8)
Input Arguments
  • row: line number(line1=1, line2=2)
    For 2line LCD the I/P argument should be either 1 or 2.
  • col: char number.
    For 16-char LCD the I/P argument should be between 0-15.
Return Value none
Description This function moves the Cursor to specified position.
  • Note:If the Input(Line/Char number) are out of range then no action will be taken
Usage

LCD_SetCursor(1,10); //Moves the cursor to 1st line 11th char. LCD_SetCursor(5,10); //No action taken as line 5 is out of range

LCD_DisplayChar

{{#Widget:LibTable}}
Defination void LCD_DisplayChar( char var_lcdData_u8)
Input Arguments uint8_t: ASCII value of the char to be displayed.
Return Value none
Description This function sends a character to be displayed on LCD.
Any valid ascii value can be passed to display the respective character
Usage

LCD_DisplayChar(65); //Displays 'A' on LCD
LCD_DisplayChar(0x41); //Displays 'A' on LCD
LCD_DisplayChar('A'); //Recommended usage



LCD_DisplayString

{{#Widget:LibTable}}
Defination void LCD_DisplayString(char *ptr_stringPointer_u8)
Input Arguments char*:String(Address of the string) to be displayed.
Return Value none
Description This function is used to display the ASCII string on the lcd.
Usage
 
void main()
{
   char myString[]={"hello, world"};
   LCD_DisplayString(myString);
   LCD_DisplayString("good morning");
}

LCD_ScrollMessage

{{#Widget:LibTable}}
Defination void LCD_ScrollMessage(uint8_t var_lineNumber_u8, char *ptr_msgPointer_u8)
Input Arguments
  • uint8_t: Line number on which the message has to be scrolled
  • char *: pointer to the string to be scrolled
Return Value none
Description This function scrolls the given message on the specified line.
If the specified line number is out of range then the message will be scrolled on first line.
  • Note: Leave 7-8 spaces at the beginning and 1 space at the end of the message to be scrolled.
Usage

LCD_ScrollMessage(" Welcome to embedded programming ");



LCD_DisplayNumber

{{#Widget:LibTable}}
Defination void LCD_DisplayNumber(NumericSystem_et e_typeOfNum_e8, uint32_t var_number_u32, uint8_t var_numOfDigitsToDisplay_u8)
Input Arguments
  • NumericSystem_et: Specifies type of number ENUM_BINARY(2),ENUM_DECIMAL(10), ENUM_Hex(16)
  • uint32_t: Number to be displayed on the LCD.
  • uint8_t : Number of digits to be displayed
Return Value none
Description

This function is used to display a max of 10digit decimal/Hex number OR specified number of bits for binary number.
1st parameter specifies type of number ENUM_BINARY(2),ENUM_DECIMAL(10), ENUM_Hex(16).
3rd parameter specifies the number of digits from the right side to be displayed.
The output for the input combinations is as below
Binary:

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

Decimal:

  • (10,12345,4) then 4-digits ie. 2345 will be displayed
  • (ENUM_DECIMAL,12345,6) then 6-digits ie. 012345 will be displayed
  • (10,12345,C_DisplayDefaultDigits_U8) then 12345 will be displayed.\

Hex:

  • (16,0x12AB,3) then 3-digits ie. 2AB will be displayed
  • (ENUM_Hex,0x12AB,6) then 6-digits ie. 0012AB will be displayed
  • (ENUM_Hex,0x12AB,C_DisplayDefaultDigits_U8) then 12AB will be displayed.
Usage

uint32_t decNumber = 123456;
LCD_DisplayDecimalNumber(decNumber,5); //Display last 5-digits of Number
LCD_DisplayDecimalNumber(12345,4); //Display last 4-digits of number

LCD_Printf

{{#Widget:LibTable}}
Defination void LCD_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 displays accordingly .

The supported format specifiers are as below.

  • %c: character
  • %d: decimal(16bit)
  • %l: decimal(32-bit)
  • %b: binary(16-bit)
  • %s: string
  • %f: float
  • %x: hexadecimal
Usage
void main()
{
uint16_t decNum=1234;//16-bit
uint32_t longDec=12345678;//32-bit
float floatNum=1234.5678;
uint16_t hexNum=0xABCD;
char myString[]={"hello, world};
 
LCD_Printf("%d %l %f %x %b %s",decNum,longDec,floatNum,hexNum,hexNum,myString);
LCD_Printf("D:%d,L:%l,F=%f,H:%x,Str:%s",1234,12345678,123.456,0xAB,"hello");
}

Usage Guide