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

GLCD writing problem

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



Joined: 25 Oct 2016
Posts: 62

View user's profile Send private message

GLCD writing problem
PostPosted: Thu Jan 26, 2017 5:25 am     Reply with quote

Code:

void glcd_blank() {
   unsigned int16 p = 0, c = 0;

   for(p = 0; p < 8; p++)
   {
      glcd_command(0xB0 | p);

      for(c = 0; c < 129; c++)
      {
         glcd_command(0x10 | (c & 0xf));
         glcd_command(0x00 | ((c >> 4) & 0xf));
         glcd_data(0x00);
      }     
   }
}


I have worked out how to initialize the GLCD and attached above you'll see the code in order to clear the display. But I haven't find out how to write stuff at the screen. This is the code I am using. Help!
Code:

glcd_init();
   delay_ms(1000);
   glcd_blank();
   delay_ms(1000);
   glcd_contrast(3, 25);
   while(1)
   {
     glcd_pixel(1, 1, 1);
     glcd_pixel(2, 1, 1);
     glcd_pixel(1, 2, 1);
     glcd_pixel(2, 2, 1);
     delay_ms(2000);


      // Clear a pixel in the RAM buffer
      glcd_pixel(64, 64, 0);

      delay_ms(1000);
      glcd_refresh();
   }
temtronic



Joined: 01 Jul 2010
Posts: 9199
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 26, 2017 6:45 am     Reply with quote

One HUGE problem is that WE do not know what GLCD you're using ! We can't test your code as the commands may not be the same. Also we need to know the PIC, compiler version and if this is real hardware or a 'simulation'.
There are GLCD drivers for CCS,again need to know what GLCD you're using.
Simple start though...does the GLCD power up into reset and look 'ready'. Now how that is supposed to be, again is in the datasheet.
If you have a 162 or 204 LCD module does that work with your PIC?
perhaps the PIC is bad? a wiring issue ?

bottom line we need a lot more information before we can help !

Jay
jamalavedra



Joined: 25 Oct 2016
Posts: 62

View user's profile Send private message

PostPosted: Thu Jan 26, 2017 6:48 am     Reply with quote

totally my fault. I am using the 18F2685 PIC and the GLCD I am using is the EA DOGM128W-6, datasheet avaliable in the following link http://www.qscomp.cz/Pdf/dogm128e.pdf.
The inicialitazion voltatges at every pin are fine and the clear screen process seems to work just fine, but the writting process is apparently a problem right now.
temtronic



Joined: 01 Jul 2010
Posts: 9199
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 26, 2017 7:21 am     Reply with quote

This is easy....

5 volt PIC, 3 volt GLCD

That PIC will NOT function at 3 volts, so you need to either

1) choose the 'L' version of that PIC

2) choose a real 3 volt PIC ( like 18F46K22)

3) add logic level conversion devices to properly covert 5 to 3 and 3 to 5.

4) buy a GLCD that IS rated for 5 volt operation

5) ??

You'll find that most peripheral devices these days(GLCD,GPS,etc...) are designed for 3 volts so it is CRITCAL to design the project with the
correct interface to whatever PIC you've chosen to use.

Perhaps the easiest solution is to use the 'L' version.That way your code is 100% compatible and no additional wiring of parts to the project.

Jay
jamalavedra



Joined: 25 Oct 2016
Posts: 62

View user's profile Send private message

PostPosted: Thu Jan 26, 2017 7:30 am     Reply with quote

I see your point, but this PIC can work at 3V. I have been trying it out and the PIC has been working fine with a 3V source. Thus, the outputs connected to the display are also 3V. I believe this shouldnt be a problem and the mistake has to be in the code.
temtronic



Joined: 01 Jul 2010
Posts: 9199
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 26, 2017 8:28 am     Reply with quote

According to Figure 21-1 of the datasheet 39761b.pdf that PIC is NOT designed or rated to run at less than 4.2 volts. Just because yours 'works' now doesn't mean it will tomorrow or another one will today. Several of the internal peripherals,like the ADC, will not be operating 'right' and over time and or temperature, the PIC will fail or give 'odd' results.

Jay
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