I'm using the CCS C Compiler to program my PIC 16F877A to display results of a voltage measurement. I'm using TOPWAY's LM12864DDY. I used the functions that were available in the glcd.c file in the "Examples" folder of PICC.
This is my code:
#include<16F877A.h>
#include"pic_GLCD.h"
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000) //crystal 20 Mhz
char voltText[]="VOLTS";
void drawFrame(x,y,w,h)
{
int i = 0;
glcd_rect(x, y, w, h, NO, ON); // Outline the frame
glcd_text57(48, 57, voltText, 1, ON); // Display "Volts"
for (i=5;i<=w;i+=10) // Draw some fancy markers :)
{ // horizontal
glcd_line(i,h,i,h+5,ON); // every 10 pixel
}
for (i=y; i<=h;i+=10) // vertical
{
glcd_line(1,i,5,i,ON);
}
}
void main (void)
{
//LCD PORTS
SET_TRIS_C(0x00);
SET_TRIS_E(0x00);
//CS1,CS2,RST PORT
SET_TRIS_A(0xD3);
glcd_init(ON);
drawFrame(5,0,125,51);
}
Can't really figure out what is it that I'm doing wrong. Why am I getting scattered dots in my display?