Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help with GLCD.c modification

Status
Not open for further replies.

alarasi

Junior Member level 1
Joined
Mar 13, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
malaysia
Activity points
1,415
hello guys
I'm new here and really need your help!

I'm developing a GLCD oscilloscope project that's been found online (**broken link removed**)

I have finished the hardware part and made all the connections and also tried it with a ready given hex file by the designer and the it worked nicely.

But when I tried to test the project by making some modifications to the code itself, I wasn't able to get the correct output! The code is compiled successfully but the displayed output is wrong! In other words it worked with the given hex file but not by generating the hex file from the code!!

The designer mentioned something about modifying the GLCD.C driver of the ccs compiler and he showed the steps to do it but although I followed the steps I got wrong output!

Here is the GLCD.C modification steps stated by the designer!
Code:

Code:
/////////////////////////////////////////////////////////////////////// 
//                     GLCD - modified.C 
// 
//  How to use: 1. Create a new file in your CCS C library folder 
//              titled 'GLCD - modified.C' 
//              2. Copy all of the code from your 'GLCD.C' file to the 
//              new 'GLCD - modified.C' file. 
//              3. Paste the following code into the appropriate places 
//              4. Replace all "output_D" with "output_B" 
//              5. Replace all "input_D" with "input_B" 
// 
//  Why all this work?  The GLCD.C file is copyrighted Custom Computer 
//  Services, so I cannot distribute the library to other individuals 
//  unless they are licensed users of the CCS C compiler.  Sorry! 
// 
//  Version 1.1 08/21/2006 
//              Steven Cholewiak ([url]www.semifluid.com[/url]) modified the 
//              code for operation with a PIC18F2550 by changing 
//              control lines and changing the data port to Port B. 
//              He also added a 3x5 font, which was based upon the 
//              font format from [url]https://instruct1.cit.cornell.edu/[/url] 
//              courses/ee476/video/Video32v2.c and modified to 
//              include characters defined from [url]https://mckoss.com/[/url] 
//              jscript/tinyalice.htm 
/////////////////////////////////////////////////////////////////////// 


//================================ 
// Paste in the top of your 'GLCD - modified.C' file! 
//================================ 
#define GLCD_DI  PIN_C0   // Data or Instruction input 
#define GLCD_RW  PIN_C1   // Read/Write 
#define GLCD_E   PIN_C2   // Enable 
#define GLCD_CS1 PIN_A3   // Chip Selection 1 
#define GLCD_CS2 PIN_A4   // Chip Selection 2 
#define GLCD_RST PIN_A5   // Reset 

//================================ 
// Paste above "const int8 TEXT[51][5]" 
//================================ 
//3x5 Font packed two per definition 
//Original format from [url]https://instruct1.cit.cornell.edu/courses/ee476/video/Video32v2.c[/url] 
// - Modified by Steven Cholewiak ([url]www.semifluid.com[/url]) 
//    - 08/08/06 - Included punctuation characters 
const int8 TEXT35[95][5]={                                                                                                                       0b00000000,   0b00000000, 0b00000000,  0b00000000,   0b00000000, //SPACE 
   0b01000100,   0b01000100,   0b01000100,   0b00000000,   0b01000100, //! 
   0b10101010,   0b10101010,   0b00000000,   0b00000000,   0b00000000, //" 
   0b10101010,   0b11101110,   0b10101010,   0b11101110,   0b10101010, //# 
   0b01100110,   0b11001100,   0b11001100,   0b01100110,   0b11101110, //$ 
   0b10101010,   0b00100010,   0b01000100,   0b10001000,   0b10101010, //% 
   0b01000100,   0b10101010,   0b01000100,   0b10101010,   0b01100110, //& 
   0b01000100,   0b01000100,   0b00000000,   0b00000000,   0b00000000, //' 
   0b01000100,   0b10001000,   0b10001000,   0b10001000,   0b01000100, //( 
   0b01000100,   0b00100010,   0b00100010,   0b00100010,   0b01000100, //) 
   0b00000000,   0b10101010,   0b01000100,   0b10101010,   0b00000000, //* 
   0b00000000,   0b01000100,   0b11101110,   0b01000100,   0b00000000, //+ 
   0b00000000,   0b00000000,   0b00000000,   0b01000100,   0b10001000, //, 
   0b00000000,   0b00000000,   0b11101110,   0b00000000,   0b00000000, //- 
   0b00000000,   0b00000000,   0b00000000,   0b00000000,   0b01000100, //. 
   0b00100010,   0b00100010,   0b01000100,   0b10001000,   0b10001000, /// 
   0b11101110,   0b10101010,   0b10101010,   0b10101010,   0b11101110, //0 
   0b01000100,   0b11001100,   0b01000100,   0b01000100,   0b11101110, //1 
   0b11101110,   0b00100010,   0b11101110,   0b10001000,   0b11101110, //2 
   0b11101110,   0b00100010,   0b11101110,   0b00100010,   0b11101110, //3 
   0b10101010,   0b10101010,   0b11101110,   0b00100010,   0b00100010, //4 
   0b11101110,   0b10001000,   0b11101110,   0b00100010,   0b11101110, //5 
   0b11001100,   0b10001000,   0b11101110,   0b10101010,   0b11101110, //6 
   0b11101110,   0b00100010,   0b01000100,   0b10001000,   0b10001000, //7 
   0b11101110,   0b10101010,   0b11101110,   0b10101010,   0b11101110, //8 
   0b11101110,   0b10101010,   0b11101110,   0b00100010,   0b01100110, //9 
   0b00000000,   0b01000100,   0b00000000,   0b01000100,   0b00000000, //: 
   0b00000000,   0b01000100,   0b00000000,   0b01000100,   0b10001000, //; 
   0b00100010,   0b01000100,   0b10001000,   0b01000100,   0b00100010, //< 
   0b00000000,   0b11101110,   0b00000000,   0b11101110,   0b00000000, //= 
   0b10001000,   0b01000100,   0b00100010,   0b01000100,   0b10001000, //> 
   0b11001100,   0b00100010,   0b01100110,   0b00000000,   0b01000100, //? 
   0b01000100,   0b10101010,   0b11101110,   0b10001000,   0b01100110, //@ 
   0b11101110,   0b10101010,   0b11101110,   0b10101010,   0b10101010, //A 
   0b11001100,   0b10101010,   0b11101110,   0b10101010,   0b11001100, //B 
   0b11101110,   0b10001000,   0b10001000,   0b10001000,   0b11101110, //C 
   0b11001100,   0b10101010,   0b10101010,   0b10101010,   0b11001100, //D 
   0b11101110,   0b10001000,   0b11101110,   0b10001000,   0b11101110, //E 
   0b11101110,   0b10001000,   0b11101110,   0b10001000,   0b10001000, //F 
   0b11101110,   0b10001000,   0b10001000,   0b10101010,   0b11101110, //G 
   0b10101010,   0b10101010,   0b11101110,   0b10101010,   0b10101010, //H 
   0b11101110,   0b01000100,   0b01000100,   0b01000100,   0b11101110, //I 
   0b00100010,   0b00100010,   0b00100010,   0b10101010,   0b11101110, //J 
   0b10001000,   0b10101010,   0b11001100,   0b11001100,   0b10101010, //K 
   0b10001000,   0b10001000,   0b10001000,   0b10001000,   0b11101110, //L 
   0b10101010,   0b11101110,   0b11101110,   0b10101010,   0b10101010, //M 
   0b00000000,   0b11001100,   0b10101010,   0b10101010,   0b10101010, //N 
   0b01000100,   0b10101010,   0b10101010,   0b10101010,   0b01000100, //O 
   0b11101110,   0b10101010,   0b11101110,   0b10001000,   0b10001000, //P 
   0b01000100,   0b10101010,   0b10101010,   0b11101110,   0b01100110, //Q 
   0b11101110,   0b10101010,   0b11001100,   0b11101110,   0b10101010, //R 
   0b11101110,   0b10001000,   0b11101110,   0b00100010,   0b11101110, //S 
   0b11101110,   0b01000100,   0b01000100,   0b01000100,   0b01000100, //T 
   0b10101010,   0b10101010,   0b10101010,   0b10101010,   0b11101110, //U 
   0b10101010,   0b10101010,   0b10101010,   0b10101010,   0b01000100, //V 
   0b10101010,   0b10101010,   0b11101110,   0b11101110,   0b10101010, //W 
   0b00000000,   0b10101010,   0b01000100,   0b01000100,   0b10101010, //X 
   0b10101010,   0b10101010,   0b01000100,   0b01000100,   0b01000100, //Y 
   0b11101110,   0b00100010,   0b01000100,   0b10001000,   0b11101110, //Z 
   0b11101110,   0b10001000,   0b10001000,   0b10001000,   0b11101110, //[ 
   0b10001000,   0b10001000,   0b01000100,   0b00100010,   0b00100010, //\ 
   0b11101110,   0b00100010,   0b00100010,   0b00100010,   0b11101110, //] 
   0b01000100,   0b10101010,   0b00000000,   0b00000000,   0b00000000, //^ 
   0b00000000,   0b00000000,   0b00000000,   0b00000000,   0b11101110, //_ 
   0b10001000,   0b01000100,   0b00000000,   0b00000000,   0b00000000, //` 
   0b00000000, 0b01000100, 0b10101010, 0b10101010, 0b01100110, //a 
   0b10001000, 0b11001100, 0b10101010, 0b10101010, 0b11001100, //b 
   0b00000000,   0b01100110, 0b10001000, 0b10001000, 0b01100110, //c 
   0b00100010,   0b01100110, 0b10101010, 0b10101010, 0b01100110, //d 
   0b00000000, 0b01000100, 0b10101010, 0b11001100, 0b01100110, //e 
   0b01100110,   0b01000100, 0b11101110, 0b01000100, 0b01000100, //f 
   0b00000000, 0b01000100, 0b10101010, 0b01100110, 0b11001100, //g 
   0b10001000, 0b11001100, 0b10101010, 0b10101010, 0b10101010, //h 
   0b01000100,   0b00000000, 0b01000100, 0b01000100, 0b01000100, //i 
   0b01000100, 0b00000000, 0b01000100, 0b01000100, 0b10001000, //j 
   0b10001000,   0b10001000, 0b10101010, 0b11001100, 0b10101010, //k 
   0b01000100,   0b01000100, 0b01000100, 0b01000100, 0b01000100, //l 
   0b00000000,   0b11101110, 0b11101110, 0b10101010, 0b10101010, //m 
   0b00000000,   0b11001100, 0b10101010, 0b10101010, 0b10101010, //n 
   0b00000000,   0b01000100, 0b10101010, 0b10101010, 0b01000100, //o 
   0b00000000,   0b11001100, 0b10101010, 0b11001100, 0b10001000, //p 
   0b00000000,   0b01100110, 0b10101010, 0b01100110, 0b00100010, //q 
   0b00000000,   0b10001000, 0b11101110, 0b10001000, 0b10001000, //r 
   0b00000000, 0b01100110, 0b11001100, 0b00100010, 0b11001100, //s 
   0b01000100,   0b11101110, 0b01000100, 0b01000100, 0b01000100, //t 
   0b00000000, 0b10101010, 0b10101010, 0b10101010, 0b01000100, //u 
   0b00000000, 0b10101010, 0b10101010, 0b01000100, 0b01000100, //v 
   0b00000000,   0b10101010, 0b10101010, 0b11101110, 0b10101010, //w 
   0b00000000,   0b10101010, 0b01000100, 0b01000100, 0b10101010, //x 
   0b00000000,   0b10101010, 0b10101010, 0b01100110, 0b11001100, //y 
   0b00000000, 0b11101110, 0b01100110, 0b11001100, 0b11101110, //z 
   0b00100010,   0b01000100,   0b11001100,   0b01000100,   0b00100010, //{ 
   0b01000100,   0b01000100,   0b01000100,   0b01000100,   0b01000100, //| 
   0b10001000,   0b01000100,   0b01100110,   0b01000100,   0b10001000, //} 
   0b00000000,   0b11001100,   0b10101010,   0b00000000,   0b00000000  //~ 
   }; 

//================================ 
// Paste above "glcd_fillScreen(int1 color)" 
//================================ 
// Purpose:       Write small text on a graphic LCD 
// Inputs:        (x,y) - The upper left coordinate of the first letter 
//                textptr - A pointer to an array of text to display 
//                color - ON or OFF 

//char characterSet[] = " !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; 
void glcd_text35(int8 x, int8 y, char* textptr, int1 color) 
{ 
   int i, j, k;                           // Loop counters 
   BYTE pixelData[5];                     // Stores character data 

   for(i=0; textptr[i] != '\0'; ++i, ++x) // Loop through the passed string 
   { 
      if((textptr[i] >= ' ') && (textptr[i] <= '~')) 
         memcpy(pixelData, TEXT35[textptr[i]-' '], 5); 
      else 
         memcpy(pixelData, TEXT35[0], 5); // Default to space 

      if(x+3 >= GLCD_WIDTH)          // Performs character wrapping 
      { 
         x = 0;                           // Set x at far left position 
         y += 5 + 1;                      // Set y at next position down 
      } 
      for(j=3; j>0; j--, x++)             // Loop through character byte data 
      { 
         for(k=0; k<5; k++)               // Loop through the vertical pixels 
         { 
            if(bit_test(pixelData[k], j)) // Check if the pixel should be set 
            { 
               glcd_pixel(x, y+k, color); // Draws the pixel 
            } 
         } 
      } 
   } 
}


i followed the steps exactly with the GLCD.C driver in my ccs compiler but still i get wrong output signal!? only one difference i noticed between the instruction given by the designer and the GLCD.C which is here
the designer mentioned
Code:
//================================ 
// Paste above "const int8 TEXT[51][5]" 
//================================

means above that part in GLCD.C folder but in the GLCD.C folder it's actully written as
Code:
const BYTE TEXT[51][5]
i don't know if it makes a real difference!!?

can u pls help me modifying the GLCD.C sp that i be able to get the correct hex file?

i'm expecting you to have the GLCD.C file so that i didn't upload its code!

thank you
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top