Epson S1D13700 Graphic Lcd Library
The mikroPascal 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 : |
---|---|---|
var S1D13700_DATA : byte; sfr; external; |
System data bus. | var S1D13700_DATA at PORTD; |
var S1D13700_WR : sbit; sfr; external; |
Write signal. | var S1D13700_WR : sbit at LATC2_bit; |
var S1D13700_RD : sbit; sfr; external; |
Read signal. | var S1D13700_RD : sbit at LATC1_bit; |
var S1D13700_A0 : sbit; sfr; external; |
System Address pin. | var S1D13700_A0 : sbit at LATC0_bit; |
var S1D13700_RES : sbit; sfr; external; |
Reset signal. | var S1D13700_RES : sbit at LATC3_bit; |
var S1D13700_CS : sbit; sfr; external; |
Chip select. | var S1D13700_CS : sbit at LATC4_bit; |
var S1D13700_DATA_Direction : byte; sfr; external; |
Direction of the system data bus pins. | var S1D13700_DATA_Direction sbit at PORTD; |
var S1D13700_WR_Direction : sbit; sfr; external; |
Direction of the Write pin. | var S1D13700_WR_Direction : sbit at TRISC2_bit; |
var S1D13700_RD_Direction : sbit; sfr; external; |
Direction of the Read pin. | var S1D13700_RD_Direction : sbit at TRISC1_bit; |
var S1D13700_A0_Direction : sbit; sfr; external; |
Direction of the System Address pin. | var S1D13700_A0_Direction : sbit at TRISC0_bit; |
var S1D13700_RES_Direction : sbit; sfr; external; |
Direction of the Reset pin. | var S1D13700_RES_Direction : sbit at TRISC3_bit; |
var S1D13700_CS_Direction : sbit; sfr; external; |
Direction of the Chip select pin. | var S1D13700_CS_Direction : 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 |
procedure S1D13700_Init(width : word; height : word); |
---|---|
Returns |
Nothing. |
Description |
Initializes S1D13700 Graphic Lcd controller. Parameters :
|
Requires |
Global variables :
|
Example |
// S1D13700 module connections var S1D13700_Data_Port : byte at PORTD; var S1D13700_WR : sbit at LATC2_bit; var S1D13700_RD : sbit at LATC1_bit; var S1D13700_A0 : sbit at LATC0_bit; var S1D13700_RES : sbit at LATC3_bit; var S1D13700_CS : sbit at LATC4_bit; var S1D13700_Data_Port_Direction : byte at PORTD; var S1D13700_WR_Direction : sbit at TRISC2_bit; var S1D13700_RD_Direction : sbit at TRISC1_bit; var S1D13700_A0_Direction : sbit at TRISC0_bit; var S1D13700_RES_Direction : sbit at TRISC3_bit; var S1D13700_CS_Direction : sbit at TRISC4_bit; // End of S1D13700 module connections ... // init display for 320 pixel width, 240 pixel height S1D13700_Init(320, 240); |
S1D13700_Write_Command
Prototype |
procedure S1D13700_Write_Command(command : 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 |
procedure S1D13700_Write_Parameter(parameter : 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 |
function S1D13700_Read_Parameter() : 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 |
procedure S1D13700_Fill(d : byte; start : word; len : 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 |
procedure S1D13700_GrFill(d : 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 |
procedure S1D13700_TxtFill(d : 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 |
<procedure S1D13700_Display_GrLayer(mode : 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 |
procedure S1D13700_Display_TxtLayer(mode : 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 |
procedure S1D13700_Set_Cursor(width : byte; height : byte; mode : 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 |
procedure S1D13700_Display_Cursor(mode : 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 |
procedure S1D13700_Write_Char(c : char; x : word; y : word; mode: 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 |
procedure S1D13700_Write_Text(var str : string; x, y : word; mode : 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 |
procedure S1D13700_Dot(x : word; y : word; color : 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 |
procedure S1D13700_Line(x0, y0, x1, y1 : word; pcolor : 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 |
procedure S1D13700_H_Line(x_start, x_end, y_pos : word; color : 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 |
procedure S1D13700_V_Line(y_start, y_end, x_pos : word; color : 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 |
procedure S1D13700_Rectangle(x0, y0, x1, y1 : word; pcolor : 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 |
procedure S1D13700_Box(x0, y0, x1, y1 : word; pcolor : 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 |
procedure S1D13700_Rectangle_Round_Edges(x_upper_left : word; y_upper_left : word; x_bottom_right : word; y_bottom_right : word; round_radius : word; color : 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 |
procedure S1D13700_Rectangle_Round_Edges_Fill(x_upper_left : word; y_upper_left : word; x_bottom_right : word; y_bottom_right : word; round_radius : word; color : 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 |
procedure S1D13700_Circle(x_center : word; y_center : word; radius : word; color : 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 |
procedure S1D13700_Circle_Fill(x_center: word; y_center: word; radius: word; color : 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 |
procedure S1D13700_Image(const image : ^byte); |
---|---|
Returns |
Nothing. |
Description |
Displays bitmap on Glcd. Parameters :
Note :
Image dimension must match the display dimension.
|
Requires |
Glcd module needs to be initialized. See the S1D13700_Init routine. |
Example |
S1D13700_Image(@image); |
S1D13700_PartialImage
Prototype |
procedure S1D13700_PartialImage(x_left, y_top, width, height, picture_width, picture_height : word; const image : ^byte); |
---|---|
Returns |
Nothing. |
Description |
Displays a partial area of the image on a desired location. Parameters :
Note :
Image dimension must match the display dimension.
|
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!