Difference between revisions of "GLCD"
(Created page with "category:Library_Reference =GLCD= ==GLCD_Init== {|{{Widget:LibCol}} {{#Widget:LibTable}} |- |Defination ||void GLCD_Init () |- | Input Arguments || none |- | Return...") |
m |
||
(6 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
| Return Value|| none | | Return Value|| none | ||
|- | |- | ||
− | | Description ||This function is used to initialize the | + | | Description ||This function is used to initialize the glcd. |
|- | |- | ||
− | | Usage ||GLCD_Init() //Initialize GLCD | + | | Usage ||GLCD_Init() //Initialize GLCD |
|} | |} | ||
Line 25: | Line 25: | ||
|Defination || void GLCD_CmdWrite( uint8_t var_lcdCmd_u8) | |Defination || void GLCD_CmdWrite( uint8_t var_lcdCmd_u8) | ||
|- | |- | ||
− | | Input Arguments || 8-bit command supported by | + | | Input Arguments || 8-bit command supported by GLCD. |
|- | |- | ||
| Return Value|| none | | Return Value|| none | ||
|- | |- | ||
− | | Description ||This function sends a command to | + | | Description ||This function sends a command to GLCD.<br />Some of the commonly used commands are defined in glcd.h.<br />For more commands refer the data sheet.<br />The behaviour is undefined if unsupported commands are sent. |
|- | |- | ||
| Usage || | | Usage || | ||
− | GLCD_CmdWrite( | + | GLCD_CmdWrite(0xB8); //Sets cursor to first line<br /> |
− | GLCD_CmdWrite( | + | GLCD_CmdWrite(FirstLineNumberAddress); //Recommended |
|} | |} | ||
Line 46: | Line 46: | ||
| Return Value|| none. | | Return Value|| none. | ||
|- | |- | ||
− | | Description ||This function clears the | + | | Description ||This function clears the GLCD and moves the cursor to beginning of first line |
|- | |- | ||
| Usage || | | Usage || | ||
Line 65: | Line 65: | ||
|- | |- | ||
| 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 /> | | 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.<br />To avoid the confusion the below enums has to be used for selecting lines.<br />For four line | + | 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 GLCD the enums are as below:<br /> |
*E_LcdLineOne<br /> | *E_LcdLineOne<br /> | ||
*E_LcdLineTwo<br /> | *E_LcdLineTwo<br /> | ||
Line 73: | Line 73: | ||
| Usage || | | Usage || | ||
GLCD_GoToLine(1); //Moves the cursor to beginning of first line | GLCD_GoToLine(1); //Moves the cursor to beginning of first line | ||
+ | |||
GLCD_GoToLine(E_LcdLineOne); //Recommended usage | GLCD_GoToLine(E_LcdLineOne); //Recommended usage | ||
|} | |} | ||
− | |||
− | |||
− | |||
==GLCD_GoToNextline== | ==GLCD_GoToNextline== | ||
Line 105: | Line 103: | ||
|- | |- | ||
| Input Arguments ||<br /> | | Input Arguments ||<br /> | ||
− | *row: line number(line1=1, line2=2)<br />For 2line | + | *row: line number(line1=1, line2=2)<br />For 2line GLCD the I/P argument should be either 1 or 2.<br /> |
− | *col: char number.<br />For 16-char | + | *col: char number.<br />For 16-char GLCD the I/P argument should be between 0-15. |
|- | |- | ||
| Return Value|| none | | Return Value|| none | ||
Line 128: | Line 126: | ||
| Return Value|| none | | Return Value|| none | ||
|- | |- | ||
− | | Description ||This function sends a character to be displayed on | + | | Description ||This function sends a character to be displayed on GLCD.<br />Any valid ascii value can be passed to display the respective character |
|- | |- | ||
| Usage || | | Usage || | ||
− | GLCD_DisplayChar(65); //Displays 'A' on | + | GLCD_DisplayChar(65); //Displays 'A' on GLCD<br /> |
− | GLCD_DisplayChar(0x41); //Displays 'A' on | + | GLCD_DisplayChar(0x41); //Displays 'A' on GLCD <br /> |
GLCD_DisplayChar('A'); //Recommended usage | GLCD_DisplayChar('A'); //Recommended usage | ||
|} | |} | ||
Line 192: | Line 190: | ||
| Input Arguments || | | Input Arguments || | ||
*NumericSystem_et: Specifies type of number ENUM_BINARY(2),ENUM_DECIMAL(10), ENUM_Hex(16) | *NumericSystem_et: Specifies type of number ENUM_BINARY(2),ENUM_DECIMAL(10), ENUM_Hex(16) | ||
− | *uint32_t: Number to be displayed on the | + | *uint32_t: Number to be displayed on the GLCD. |
*uint8_t : Number of digits to be displayed | *uint8_t : Number of digits to be displayed | ||
|- | |- | ||
Line 269: | Line 267: | ||
==Usage Guide== | ==Usage Guide== | ||
<html> | <html> | ||
− | <script src="https://gist.github.com/Amritach/ | + | <script src="https://gist.github.com/Amritach/d383ab80738c7177ad79.js"></script> |
</html> | </html> | ||
+ | |||
+ | {{DISQUS}} |
Latest revision as of 18:09, 30 May 2015
Contents
[hide]GLCD
GLCD_Init
{{#Widget:LibTable}}Defination | void GLCD_Init () |
Input Arguments | none |
Return Value | none |
Description | This function is used to initialize the glcd. |
Usage | GLCD_Init() //Initialize GLCD |
GLCD_CmdWrite
{{#Widget:LibTable}}Defination | void GLCD_CmdWrite( uint8_t var_lcdCmd_u8) |
Input Arguments | 8-bit command supported by GLCD. |
Return Value | none |
Description | This function sends a command to GLCD. Some of the commonly used commands are defined in glcd.h. For more commands refer the data sheet. The behaviour is undefined if unsupported commands are sent. |
Usage |
GLCD_CmdWrite(0xB8); //Sets cursor to first line |
GLCD_Clear
{{#Widget:LibTable}}Defination | void GLCD_Clear() |
Input Arguments | none. |
Return Value | none. |
Description | This function clears the GLCD and moves the cursor to beginning of first line |
Usage |
GLCD_Clear(); // Clears the lcd and sets the cursor to beginning of the first line. |
GLCD_GoToLine
{{#Widget:LibTable}}Defination | void GLCD_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.
|
Usage |
GLCD_GoToLine(1); //Moves the cursor to beginning of first line GLCD_GoToLine(E_LcdLineOne); //Recommended usage |
GLCD_GoToNextline
{{#Widget:LibTable}}Defination | void GLCD_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 |
GLCD_GoToNextline(); //Moves the cursor to beginning of next line. |
GLCD_SetCursor
{{#Widget:LibTable}}Defination | void GLCD_SetCursor(char var_lineNumber_u8,char var_charNumber_u8) |
Input Arguments |
|
Return Value | none |
Description | This function moves the Cursor to specified position.
|
Usage |
GLCD_SetCursor(1,10); //Moves the cursor to 1st line 11th char. GLCD_SetCursor(5,10); //No action taken as line 5 is out of range |
GLCD_DisplayChar
{{#Widget:LibTable}}Defination | void GLCD_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 GLCD. Any valid ascii value can be passed to display the respective character |
Usage |
GLCD_DisplayChar(65); //Displays 'A' on GLCD |
GLCD_DisplayString
{{#Widget:LibTable}}Defination | void GLCD_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 |
|
GLCD_ScrollMessage
{{#Widget:LibTable}}Defination | void GLCD_ScrollMessage(uint8_t var_lineNumber_u8, char *ptr_msgPointer_u8) |
Input Arguments |
|
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.
|
Usage |
GLCD_ScrollMessage(" Welcome to embedded programming "); |
GLCD_DisplayNumber
{{#Widget:LibTable}}Defination | void GLCD_DisplayNumber(NumericSystem_et e_typeOfNum_e8, uint32_t var_number_u32, uint8_t var_numOfDigitsToDisplay_u8) |
Input Arguments |
|
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.
Decimal:
Hex:
|
Usage |
uint32_t decNumber = 123456; |
GLCD_Printf
{{#Widget:LibTable}}Defination | void GLCD_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.
|
Usage |
|
Usage Guide
#include<lpc17xx.h> | |
#include "glcd.h" //User defined GLCD library which contains the lcd routines | |
#include "delay.h" //User defined library which contains the delay routines | |
void main() | |
{ | |
SystemInit(); //Clock and PLL configuration | |
/* Setup/Map the controller pins for LCD operation | |
CS1 CS2 RS RW EN D0 D1 D2 D3 D4 D5 D6 D7 */ | |
GLCD_SetUp(P2_0,P2_1,P2_2,P2_3,P2_4,P1_20,P1_21,P1_22,P1_23,P1_24,P1_25,P1_26,P1_27); | |
/* Initialize GLCD before use */ | |
GLCD_Init(); | |
while(1) | |
{ | |
/*scroll the message on line1 */ | |
GLCD_Clear(); | |
GLCD_ScrollMessage(1," Program to demonstrate the ExploreEmbedded Lib Usage"); | |
GLCD_Clear(); | |
GLCD_Printf("Hello, World \nGood Morning"); | |
DELAY_sec(3); | |
GLCD_Clear(); | |
GLCD_Printf("DecNum:%4d",1234); | |
GLCD_Printf("\nHexNum:%4x",0xABCD); | |
DELAY_sec(3); | |
GLCD_Clear(); | |
GLCD_Printf("16-bit Bin:1234"); | |
GLCD_GoToNextLine(); | |
GLCD_Printf("%16b",0x1234); | |
DELAY_sec(3); | |
} | |
} |