ST7920 controller.
Since Mikro C for PIC does not have any funtions for this display I went
looking to see how I could write a string to the display.
I came up with the code I show here. It works but I am not sure why.
Normally if I wanted to display a "T" I would look up the built in character
codes for it, 0x54, and send it to the display with Dat(0x54);
I don't see how the code I have come up with finds the codes to display
can anyone explain it to me?
Code: Select all
{GLCD_DataPort = N;
GLCD_RS = 1;
GLCD_EN = 1;
Delay_ms(1);
GLCD_EN = 0;
}
//------------------------------------------------------------------------
void Com(char N) //SEND DATA TO GLCD
{GLCD_DataPort = N;
GLCD_RS = 0;
GLCD_EN = 1;
Delay_ms(1); //>140 nano SECONDS
GLCD_EN = 0;
}
//-------------------------------------------------------------------------
// Write a string to GLCD WITH ST7920 CONTROLLER
void SendStr(unsigned char *ptString)
{
while((*ptString)!='\0') //'\0' is a n ull char automatically added to
//string if in double quotes
{
Dat(*ptString++); //INCREMENT THE STRING POINTER AND SEND CHAR TO DISPLAY
}
}
//------------------------------------------------------------------------
while(1)
{Com(0x30); //BASIC INSTRUCTION SET
Com(0x80); //1ST LINE //START OF FIRST LINE
SendStr("0123456789ABCDEFGH");
}
//-------------------------------------------------------------------------