CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Help with glcd_text57() function in GLCD.c

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
vinay



Joined: 30 Sep 2012
Posts: 7

View user's profile Send private message

Help with glcd_text57() function in GLCD.c
PostPosted: Mon Oct 01, 2012 2:52 am     Reply with quote

I am using glcd_text57() function to display text on an 128X64 Ampire GLCD(ks1080 based), but some of the pixels are missing. I have attached the driver program(I have made changes to CS1 and CS2 as active low in the driver) and the main() function that I am using, also I have attached a screenshot of the output I am getting.
compiler version 4.114
Pls suggest any corrections to get proper output.

Code:
/////////////////////////////////////////////////////////////////////////
////                           GLCD.C                                ////
////                                                                 ////


void glcd_writeByte(char chip, BYTE data)
{
   if(chip == GLCD_CS1)       // Choose which chip to write to
      output_low(GLCD_CS1);
   else
      output_low(GLCD_CS2);
  .
  .
  .
   output_high(GLCD_CS1);      // Reset the chip select lines
   output_high(GLCD_CS2);
}


// Purpose:       Reads a byte of data from the specified chip
// Ouputs:        A byte of data read from the chip
BYTE glcd_readByte(BYTE chip)
{
   BYTE data;                 // Stores the data read from the LCD
   if(chip == GLCD_CS1)       // Choose which chip to read from
      output_low(GLCD_CS1);
   else
      output_low(GLCD_CS2);
  .
  .
  .
   output_high(GLCD_CS1);      // Reset the chip select lines
   output_high(GLCD_CS2);
   return data;               // Return the read data
}


+++++++++++++++++++
Most glcd.c driver code removed. Only changes left.

Reason: Forum rule #10

10. Don't post the CCS example code or drivers

- Forum Moderator
+++++++++++++++++++



[/img]


Code:
char hello[]={"HELLO!"};
void main()
{
   glcd_init(ON);
   delay_ms(500);
   glcd_text57(0,0,hello,2,ON);
}
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Mon Oct 01, 2012 6:35 pm     Reply with quote

We need to see the rest of the code in main, but I bet this will have something to do with the oscillator set at a speed above 20Mhz or Proteus doing something stupid with timings.

Try to run the pic at 20Mhz or change the delays in glcd_writeByte to a higher number and see how you go.

Have Fun
vinay



Joined: 30 Sep 2012
Posts: 7

View user's profile Send private message

rest of code !!!
PostPosted: Wed Oct 03, 2012 12:07 am     Reply with quote

Code:

#include <16F877A.h>
#device adc=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOPROTECT                //Code not protected from reading

#use delay(clock=4000000)
vinay



Joined: 30 Sep 2012
Posts: 7

View user's profile Send private message

Solved it !!!!
PostPosted: Wed Oct 03, 2012 5:03 am     Reply with quote

Finally solved the prob Very Happy
there is read problem in glcd_readbyte(), the enable pin is not pulsed properly. I am attaching the code through which I got proper output
Code:
// Purpose:       Reads a byte of data from the specified chip
// Ouputs:        A byte of data read from the chip
BYTE glcd_readByte(BYTE chip)
{
   BYTE data;                 // Stores the data read from the LCD
   if(chip == GLCD_CS1)       // Choose which chip to read from
      output_low(GLCD_CS1);
   else
      output_low(GLCD_CS2);

   //input_d();                 // Set port d to input
   set_tris_d(0xFF);
   output_high(GLCD_RW);      // Set for reading
   output_low(GLCD_E);
   delay_us(10);
   output_high(GLCD_E);       // Pulse the enable pin
   delay_us(10);
   output_low(GLCD_E);
   delay_us(10);
   output_high(GLCD_E);
   data = input_d();          // Get the data from the display's output register
   output_low(GLCD_E);
   
   output_high(GLCD_CS1);      // Reset the chip select lines
   output_high(GLCD_CS2);
   return data;               // Return the read data
   
}


Smile Smile Smile
MARKDEM, thank you for your reply.
Smile Smile Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group