Epson S1D13700 Graphic Lcd Library
The mikroBasic PRO for dsPIC30/33 and PIC24 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 : |
---|---|---|
dim S1D13700_DATA as byte sfr external |
System data bus. | dim S1D13700_DATA at PORTD |
dim S1D13700_WR as sbit sfr external |
Write signal. | dim S1D13700_WR as sbit at LATC2_bit |
dim S1D13700_RD as sbit sfr external |
Read signal. | dim S1D13700_RD as sbit at LATC1_bit |
dim S1D13700_A0 as sbit sfr external |
System Address pin. | dim S1D13700_A0 as sbit at LATC0_bit |
dim S1D13700_RES as sbit sfr external |
Reset signal. | dim S1D13700_RES as sbit at LATC4_bit |
dim S1D13700_CS as sbit sfr external |
Chip select. | dim S1D13700_CS as sbit at LATC4_bit |
dim S1D13700_DATA_Direction as byte sfr external |
Direction of the system data bus pins. | dim S1D13700_DATA_Direction sbit at TRISD |
dim S1D13700_WR_Direction as sbit sfr external |
Direction of the Write pin. | dim S1D13700_WR_Direction as sbit at TRISC2_bit |
dim S1D13700_RD_Direction as sbit sfr external |
Direction of the Read pin. | dim S1D13700_RD_Direction as sbit at TRISC1_bit |
dim S1D13700_A0_Direction as sbit sfr external |
Direction of the System Address pin. | dim S1D13700_A0_Direction as sbit at TRISC2_bit |
dim S1D13700_RES_Direction as sbit sfr external |
Direction of the Reset pin. | dim S1D13700_RES_Direction as sbit at TRISC0_bit |
dim S1D13700_CS_Direction as sbit sfr external |
Direction of the Chip select pin. | dim S1D13700_CS_Direction as sbit at TRISC4_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 |
sub procedure S1D13700_Init(dim width as word, dim height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes S1D13700 Graphic Lcd controller. Parameters :
|
Requires |
Global variables :
|
Example |
' S1D13700 module connections dim S1D13700_Data_Port as byte at PORTD dim S1D13700_WR as sbit at LATC2_bit dim S1D13700_RD as sbit at LATC1_bit dim S1D13700_A0 as sbit at LATC0_bit dim S1D13700_RES as sbit at LATC4_bit dim S1D13700_CS as sbit at LATC5_bit dim S1D13700_Data_Port_Direction as byte at TRISD dim S1D13700_WR_Direction as sbit at TRISC2_bit dim S1D13700_RD_Direction as sbit at TRISC1_bit dim S1D13700_A0_Direction as sbit at TRISC0_bit dim S1D13700_RES_Direction as sbit at TRISC4_bit dim S1D13700_CS_Direction as sbit at TRISC5_bit ' End of S1D13700 module connections ... ' init display for 320 pixel width, 240 pixel height S1D13700_Init(320, 240) |
S1D13700_Write_Command
Prototype |
sub procedure S1D13700_Write_Command(dim command as byte) |
||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Write_Parameter(dim parameter as byte) |
---|---|
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 |
sub function S1D13700_Read_Parameter() as byte |
---|---|
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 |
sub procedure S1D13700_Fill(dim d as byte, dim start as word, dim len as word) |
---|---|
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 |
sub procedure S1D13700_GrFill(dim d as byte) |
---|---|
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 |
sub procedure S1D13700_TxtFill(dim d as byte) |
---|---|
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 |
<sub procedure S1D13700_Display_GrLayer(dim mode as byte) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Display_TxtLayer(dim mode as byte) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Set_Cursor(dim width as byte, dim height as byte, dim mode as byte) |
||||||
---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Display_Cursor(dim mode as byte) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Write_Char(dim c as char, dim x as word, dim y as word, dim mode as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Write_Text(dim byref str as string, dim x, y as word, dim mode as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Dot(dim x as word, dim y as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Line(dim x0, y0, x1, y1 as word, dim pcolor as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_H_Line(dim x_start, x_end, y_pos as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_V_Line(dim y_start, y_end, x_pos as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Rectangle(dim x0, y0, x1, y1 as word, dim pcolor as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Box(dim x0, y0, x1, y1 as word, dim pcolor as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Rectangle_Round_Edges(dim x_upper_left as word, dim y_upper_left as word, dim x_bottom_right as word, dim y_bottom_right as word, dim round_radius as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Rectangle_Round_Edges_Fill(dim x_upper_left as word, dim y_upper_left as word, dim x_bottom_right as word, dim y_bottom_right as word, dim round_radius as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Circle(dim x_center as word, dim y_center as word, dim radius as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Circle_Fill(dim x_center as word, dim y_center as word, dim radius as word, dim color as byte) |
||||||||
---|---|---|---|---|---|---|---|---|---|
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 |
sub procedure S1D13700_Image(dim image as ^const byte) |
---|---|
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 |
sub procedure S1D13700_PartialImage(dim x_left, y_top, width, height, picture_width, picture_height as word, dim image as ^const byte) |
---|---|
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!