Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void ClearScreen(void)
void GLCD_Write_Data (unsigned char data){
Wait_Not_Busy();
GLCD_Data = [B]~(data)[/B];
b_GLCD_RS=1;
b_GLCD_RW=0;
b_GLCD_E=1;
Delay();
b_GLCD_E=0;
}
unsigned char GLCD_Read_Data(void){
Wait_Not_Busy();
TRIS_Data=0xff;
b_GLCD_RS=1;
b_GLCD_RW=1;
b_GLCD_E=1;
Delay();
W=[B]~(GLCD_Data)[/B];
b_GLCD_E=0;
TRIS_Data=0x00;
return W;
}
void GLCD_Write_Data (unsigned char data){
Wait_Not_Busy();
[B]GLCD_Data =~data;[/B]
b_GLCD_RS=1;
b_GLCD_RW=0;
b_GLCD_E=1;
Delay();
b_GLCD_E=0;
}
void glcd_Write8BitNumber(unsigned char num)
{
unsigned char hundreds = 0, tens = 0;
char szNum[4];
if (num >= 200)
{
hundreds += 2;
num -= 200;
}
else if (num >= 100)
{
hundreds++;
num -= 100;
}
while (num >= 10)
{
num -= 10;
tens++;
}
hundreds += 0x30;
tens += 0x30;
num += 0x30;
szNum[0] = hundreds;
szNum[1] = tens;
szNum[2] = num;
szNum[3] = 0;
PutMessage((rom char*) szNum);
}
while (1)
{
glcd_ClearScreen();
glcd_SetPosition(0, 0);
ADCON0 |= 0x02;
while(ADCON0 & 0x02);
glcd_PutMessage((rom char*) "The temperature is: ");
//glcd_Write8BitNumber(ADRESH);
//glcd_Write8BitNumber(ADRESL);
glcd_Write8BitNumber(20);
Delay10KTCYx(0);
}
void glcd_Write8BitNumber(unsigned char num)
{
char szNum[40]; // I think 40 is large enough
sprintf(szNum, "%d", num);
glcd_PutMessage((rom char*) szNum);
}
void glcd_Write8BitNumber(unsigned char num)
{
unsigned char szNum[40],i; // I think 40 is large enough
sprintf(szNum, "%d", num);
for(i=0;szNum[i]!=0;i++)
PutChar(szNum[i]);
}
void glcd_WriteInt(int num)
{
unsigned char szNum[7],i; //can contain up to 6 characters with the sign
sprintf(szNum, "%d", num);
for(i=0;szNum[i]!=0;i++)
PutChar(szNum[i]);
}