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:


#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

void main (void)
    //CS1,CS2,RST PORT




and my output is this: enter image description here

Can't really figure out what is it that I'm doing wrong. Why am I getting scattered dots in my display?

  • 1
    \$\begingroup\$ Things are basically, but not quite, in working order, suggesting you need to tweak pic_GLCD.h to match your special LCD display \$\endgroup\$ Feb 22 '16 at 16:19
  • \$\begingroup\$ It's been a while since I used CCS C, but don't you need a while(1){}; loop at the end of main()? \$\endgroup\$
    – Tut
    Feb 22 '16 at 16:24
  • \$\begingroup\$ Hey Scott could you give me some hints? what kinds of tweaks? \$\endgroup\$ Feb 22 '16 at 16:26
  • 2
    \$\begingroup\$ No, I can't. You'll have to look in the file and see what it says. When these types of drivers are built, such stuff is often made clear in comments. You should consider drivers like this as a framework for what you need to accomplish, and not gospel. \$\endgroup\$ Feb 22 '16 at 16:29
  • 1
    \$\begingroup\$ THANKS Scott!!!!! IT WORKED. Turned out my driver needed a delay cycle change ! \$\endgroup\$ Feb 22 '16 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.