Code: Select all
/*************************************************************************
* Function: ST_char8x8
* Input: character, row, column, mask (color)
* row 0..7; column 0..15
* if mask == 0, draws normal character (white on blue background),
* if mask == 0xff draws an inverted character
* Overview: Draws a 8x8 dots character on the screen
* Font set: CP1251 - 0x20..0x7F ASCII
* & 0xC0..0xFF Cyrillic characters
**************************************************************************/
Code: Select all
/*************************************************************************
* Function: ST_txt8x8
* Input: text_array, row, column, mask (color)
* row 0..7; column 0..15
* if mask == 0, draws normal text,
* if mask == 0xff draws an inverted text
* Overview: Puts the LCD in graphic mode to draw 8x8 dots characters.
* Font set: CP1251 - 0x20..0x7F ASCII
* & 0xC0..0xFF Cyrillic characters
* Optimized for speed - draws all characters in the text
* array together, much faster than calling ST_char8x8()
* in a loop.
**************************************************************************/
Code: Select all
/*************************************************************************
* Function: ST_txt8x16
* Input: text_array, row, column
* row 0..1; column 0..15
* Overview: Drives the LCD in text mode, using the internal 8x16
* character ROM (HCGROM) to type text. Check the ST7920
* datasheet for the charset.
**************************************************************************/
Code: Select all
/*************************************************************************
* Function: ST_chr16x32
* Precondition: Put ST7920 in EXTENDED Instruction Set before calling
* Input: character, row, column, mask (color)
* row 0..1; column 0..7
* if mask == 0, draws normal character,
* if mask == 0xff draws an inverted character
* Output: ~
* Overview: Draws a 16x32 dots character on the screen
* Font set: ASCII 0x2B..0x3E (digits and some signs)
* & 0x3F..0x46 animated hourglass
**************************************************************************/
Code: Select all
/*************************************************************************
* Function: ST_txt16x32
* Precondition: ~
* Input: character, row, column, mask (color)
* row 0..1; column 0..7
* if mask == 0, draws normal character,
* if mask == 0xff draws an inverted character
* Overview: Draws 16x32 dots character on the screen
* Font set: ASCII 0x2B..0x3E (digits and some signs)
* & 0x3F..0x46 animated hourglass
**************************************************************************/
Code: Select all
/*************************************************************************
* Function: ST_rect
* Input: row, column, length, height, color
* row 0..63; column 0..15
* length 1..16; height 1..64
* if mask == 0, draws empty (black) rectangle
* if mask == 0xff draws filled rectangle
* if mask == 0xaa, 0x55, 0x0f... draws rectangle filled
* with stripes
* Overview: Draws a rectangle at specified coordinates. Each column
* is 8 dots wide (limitation of the ST7920 design)
**************************************************************************/
Code: Select all
/*************************************************************************
* Function: ST_dot
* Input: x, y, color
* x 0..127; y 0..63
* if color == 1, draws a normal (white) dot
* if color == 0, draws an "empty" (black) dot
* if color == 2..255, inverts the dot at the specified
* coordinates
* Overview: Draws a dot at specified coordinates.
**************************************************************************/
To make the library more flexible and simple to use, I need to know how some MikroC libraries are written. For example the Sound_Init(char *snd_port, char snd_pin) library.
As the example in the help file states Sound_Init(&PORTC, 3) will Initialize the pin RC3 for playing sound. The library somehow manages to find the corresponding TRIS (TRISC3_bit) and sets it to output. This is what I am willing to do in my library, so instead of having
Code: Select all
sbit ST_RS at RB0_bit;
sbit ST_RS_TRIS at TRISB0_bit;
// and so on
Code: Select all
sbit ST_RS at RB0_bit;
Code: Select all
#if ST_RS == RB0
#define ST_RS_TRIS TRISB0
#endif
// and so on
Any ideas to solve this problem in a third way are very welcome.
I am also looking for people who have ST7920 128x64 LCD and are willing to test the library before release.