Epson S1D13700 Graphic Lcd Library
The mikroC PRO for AVR provides a library for working with Glcds based on Epson S1D13700 controller.
The S1D13700 Glcd is capable of displaying both text and graphics on an LCD panel. The S1D13700 Glcd allows layered text and graphics, scrolling of the display in any direction, and partitioning of the display into multiple screens.
It includes 32K bytes of embedded SRAM display memory which is used to store text, character codes, and bit-mapped graphics.
The S1D13700 Glcd handles display controller functions including :
- Transferring data from the controlling microprocessor to the buffer memory
- Reading memory data, converting data to display pixels
- Generating timing signals for the LCD panel
The S1D13700 Glcd is designed with an internal character generator which supports 160, 5x7 pixel characters in internal mask ROM (CGROM) and 64, 8x8 pixel characters incharacter generator RAM (CGRAM).
When the CGROM is not used, up to 256, 8x16 pixel characters are supported in CGRAM.
External dependencies of the Epson S1D13700 Graphic Lcd Library
The following variables must be defined in all projects using S1D13700 Graphic Lcd library: | Description : | Example : |
---|---|---|
extern sfr char S1D13700_DATA; |
System data bus. | char S1D13700_DATA at PORTD; |
extern sfr sbit S1D13700_WR; |
Write signal. | sbit S1D13700_WR at PORTC2_bit; |
extern sfr sbit S1D13700_RD; |
Read signal. | sbit S1D13700_RD at PORTC1_bit; |
extern sfr sbit S1D13700_A0; |
System Address pin. | sbit S1D13700_A0 at PORTC0_bit; |
extern sfr sbit S1D13700_RES; |
Reset signal. | sbit S1D13700_RES at PORTC4_bit; |
extern sfr sbit S1D13700_CS; |
Chip select. | sbit S1D13700_CS at PORTC4_bit; |
extern sfr sbit S1D13700_DATA_Direction; |
Direction of the system data bus pins. | sbit S1D13700_DATA_Direction at DDRD; |
extern sfr sbit S1D13700_WR_Direction; |
Direction of the Write pin. | sbit S1D13700_WR_Direction at DDC2_bit; |
extern sfr sbit S1D13700_RD_Direction; |
Direction of the Read pin. | sbit S1D13700_RD_Direction at DDC1_bit; |
extern sfr sbit S1D13700_A0_Direction; |
Direction of the System Address pin. | sbit S1D13700_A0_Direction at DDC2_bit; |
extern sfr sbit S1D13700_RES_Direction; |
Direction of the Reset pin. | sbit S1D13700_RES_Direction at DDC0_bit; |
extern sfr sbit S1D13700_CS_Direction; |
Direction of the Chip select pin. | sbit S1D13700_CS_Direction at DDC4_bit; |
Library Routines
- S1D13700_Init
- S1D13700_Write_Command
- S1D13700_Write_Parameter
- S1D13700_Read_Parameter
- S1D13700_Fill
- S1D13700_GrFill
- S1D13700_TxtFill
- S1D13700_Display_GrLayer
- S1D13700_Display_TxtLayer
- S1D13700_Set_Cursor
- S1D13700_Display_Cursor
- S1D13700_Write_Char
- S1D13700_Write_Text
- S1D13700_Dot
- S1D13700_Line
- S1D13700_H_Line
- S1D13700_V_Line
- S1D13700_Rectangle
- S1D13700_Box
- S1D13700_Rectangle_Round_Edges
- S1D13700_Rectangle_Round_Edges_Fill
- S1D13700_Circle
- S1D13700_Circle_Fill
- S1D13700_Image
- S1D13700_PartialImage
S1D13700_Init
Prototype |
void S1D13700_Init(unsigned int width, unsigned char height); |
---|---|
Returns |
Nothing. |
Description |
Initializes S1D13700 Graphic Lcd controller. Parameters :
|
Requires |
Global variables :
|
Example |
// S1D13700 module connections char S1D13700_Data_Port at PORTD; sbit S1D13700_WR at PORTC2_bit; sbit S1D13700_RD at PORTC1_bit; sbit S1D13700_A0 at PORTC0_bit; sbit S1D13700_RES at PORTC4_bit; sbit S1D13700_CS at PORTC5_bit; char S1D13700_Data_Port_Direction at DDRD; sbit S1D13700_WR_Direction at DDC2_bit; sbit S1D13700_RD_Direction at DDC1_bit; sbit S1D13700_A0_Direction at DDC0_bit; sbit S1D13700_RES_Direction at DDC4_bit; sbit S1D13700_CS_Direction at DDC5_bit; // End of S1D13700 module connections ... // init display for 320 pixel width, 240 pixel height S1D13700_Init(320, 240); |
S1D13700_Write_Command
Prototype |
void S1D13700_Write_Command(char command); |
||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||
Description |
Writes a command to S1D13700 controller. Parameters :
|
||||||||||||||||||||||||||||||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||||||||||||||||||||||||||||||
Example |
// Turn the display on S1D13700_Write_Command(S1D13700_DISP_ON); |
S1D13700_Write_Parameter
Prototype |
void S1D13700_Write_Parameter(char parameter); |
---|---|
Returns |
Nothing. |
Description |
Writes a parameter to S1D13700 controller. Parameters :
|
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. Previously, a command must be sent through S1D13700_Write_Command routine. |
Example |
S1D13700_Write_Command(S1D13700_CSRW); // set cursor address S1D13700_Write_Parameter(Lo(start)); // send lower byte of cursor address S1D13700_Write_Parameter(Hi(start)); // send higher byte cursor address |
S1D13700_Read_Parameter
Prototype |
char S1D13700_Read_Parameter(); |
---|---|
Returns |
Nothing. |
Description |
Reads a parameter from GLCD port. |
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
parameter = S1D13700_Read_Parameter(); |
S1D13700_Fill
Prototype |
void S1D13700_Fill(char d, unsigned int start, unsigned int len); |
---|---|
Returns |
Nothing. |
Description |
Fills Glcd memory block with given byte. Parameters :
|
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
// from the starting address of 0x3000, fill the memory block size of 0x7FFF with 0x20 S1D13700_Fill(0x20, 0x3000, 0x7FFF); |
S1D13700_GrFill
Prototype |
void S1D13700_GrFill(char d); |
---|---|
Returns |
Nothing. |
Description |
Fill graphic layer with appropriate value (0 to clear). Parameters :
|
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
// clear current graphic panel S1D13700_GrFill(0); |
S1D13700_TxtFill
Prototype |
void S1D13700_TxtFill(char d); |
---|---|
Returns |
Nothing. |
Description |
Fill current text panel with appropriate value (0 to clear). Parameters :
|
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
// clear current text panel S1D13700_TxtFill(0); |
S1D13700_Display_GrLayer
Prototype |
void S1D13700_Display_GrLayer(char mode); |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||
Description |
Display selected graphic layer. Parameters :
|
||||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||||
Example |
// Turn on graphic layer S1D13700_Display_GrLayer(S1D13700_LAYER_ON); |
S1D13700_Display_TxtLayer
Prototype |
void S1D13700_Display_TxtLayer(char mode); |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||
Description |
Display selected text layer. Parameters :
|
||||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||||
Example |
// Display on text layer S1D13700_Display_TxtLayer(S1D13700_LAYER_ON); |
S1D13700_Set_Cursor
Prototype |
void S1D13700_Set_Cursor(char width, char height, char mode); |
||||||
---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||
Description |
Sets cursor properties. Parameters :
|
||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||
Example |
// set cursor with the following properties : width 5px, height 10px, cursor shape - block S1D13700_Set_Cursor(5, 10, S1D13700_CURSOR_BLOCK); |
S1D13700_Display_Cursor
Prototype |
void S1D13700_Display_Cursor(char mode); |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||
Description |
Displays cursor. Parameters :
|
||||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||||
Example |
// set cursor on S1D13700_Display_Cursor(S1D13700_CURSOR_ON); |
S1D13700_Write_Char
Prototype |
void S1D13700_Write_Char(unsigned char c, unsigned int x, unsigned int y, unsigned char mode); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Writes a char in the current text layer of Glcd at coordinates (x, y). Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Write_Char('A',22,23,S1D13700_OVERLAY_OR); |
S1D13700_Write_Text
Prototype |
void S1D13700_Write_Text(unsigned char *str, unsigned char x, unsigned char y, char mode); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Writes text in the current text panel of Glcd at coordinates (x, y). Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Write_Text("EPSON LIBRARY DEMO, WELCOME !", 0, 0, S1D13700_OVERLAY_OR); |
S1D13700_Dot
Prototype |
void S1D13700_Dot(unsigned int x, unsigned int y, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a dot in the current graphic panel of Glcd at coordinates (x, y). Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Dot(50, 50, S1D13700_WHITE); |
S1D13700_Line
Prototype |
void S1D13700_Line(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, unsigned char pcolor); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a line from (x0, y0) to (x1, y1). Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Line(0, 0, 239, 127, S1D13700_WHITE); |
S1D13700_H_Line
Prototype |
void S1D13700_H_Line(unsigned int x_start, unsigned int x_end, unsigned int y_pos, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a horizontal line. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Line(0, 0, 239, 127, S1D13700_WHITE); |
S1D13700_V_Line
Prototype |
void S1D13700_V_Line(unsigned int y_start, unsigned int y_end, unsigned int x_pos, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a horizontal line. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Line(0, 0, 239, 127, S1D13700_WHITE); |
S1D13700_Rectangle
Prototype |
void S1D13700_Rectangle(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, unsigned char pcolor); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a rectangle on Glcd. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_rectangle(20, 20, 219, 107, S1D13700_WHITE); |
S1D13700_Box
Prototype |
void S1D13700_Box(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, unsigned char pcolor); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a box on Glcd. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Box(0, 119, 239, 127, S1D13700_WHITE); |
S1D13700_Rectangle_Round_Edges
Prototype |
void S1D13700_Rectangle_Round_Edges(unsigned int x_upper_left, unsigned int y_upper_left, unsigned int x_bottom_right, unsigned int y_bottom_right, unsigned short round_radius, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a rounded edge rectangle on Glcd. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Rectangle_Round_Edges(20, 20, 219, 107, 12, S1D13700_WHITE); |
S1D13700_Rectangle_Round_Edges_Fill
Prototype |
void S1D13700_Rectangle_Round_Edges_Fill(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, unsigned short round_radius, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a filled rounded edge rectangle on Glcd. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Rectangle_Round_Edges_Fill(20, 20, 219, 107, 12, S1D13700_WHITE); |
S1D13700_Circle
Prototype |
void S1D13700_Circle(unsigned int x_center, unsigned int y_center, unsigned int radius, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a circle on Glcd. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Circle(120, 64, 110, S1D13700_WHITE); |
S1D13700_Circle_Fill
Prototype |
void S1D13700_Circle_Fill(unsigned int x_center, unsigned int y_center, unsigned int radius, unsigned short color); |
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||
Description |
Draws a filled circle on Glcd. Parameters :
|
||||||||
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
||||||||
Example |
S1D13700_Circle_Fill(120, 64, 110, S1D13700_WHITE); |
S1D13700_Image
Prototype |
void S1D13700_Image(const code char *pic); |
---|---|
Returns |
Nothing. |
Description |
Displays bitmap on Glcd. Parameters :
![]() |
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
S1D13700_Image(image); |
S1D13700_PartialImage
Prototype |
void S1D13700_PartialImage(unsigned int x_left, unsigned int y_top, unsigned int width, unsigned int height, unsigned int picture_width, unsigned int picture_height, code const unsigned short * image); |
---|---|
Returns |
Nothing. |
Description |
Displays a partial area of the image on a desired location. Parameters :
![]() |
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
// Draws a 10x15 part of the image starting from the upper left corner on the coordinate (10,12). Original image size is 16x32. S1D13700_PartialImage(10, 12, 10, 15, 16, 32, image); |
What do you think about this topic ? Send us feedback!