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 CCS Technical Support

320x240 graphic lcd (IC - ra8835)

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



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

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

320x240 graphic lcd (IC - ra8835)
PostPosted: Wed Jan 29, 2020 2:52 am     Reply with quote

Hi
I want to turn off the flashing cursor of 320x240 graphic lcd.
(IC- ra8835). I couldn't find a note about him in Datasheet? Would you appreciate if you could help?
_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 3:24 am     Reply with quote

Don't know what driver you are using, so what commands you will need to
use, but the FC bits in the display control register handle this. These set
the flashing rate, and the four settings give cursor off, cursor on (not
flashing), and two flash rates. Obviously you need to select the first of
these options to disable the cursor.
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

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

PostPosted: Wed Jan 29, 2020 4:09 am     Reply with quote

the driver file I use.

Code:

#define GLCD_RST PIN_A5
#define GLCD_RD PIN_A1
#define GLCD_WR PIN_A0
#define GLCD_CS PIN_A2
#define GLCD_A0 PIN_A3

#DEFINE GLCD_DB0 PIN_B5
#DEFINE GLCD_DB1 PIN_B4
#DEFINE GLCD_DB2 PIN_B3
#DEFINE GLCD_DB3 PIN_B2
#DEFINE GLCD_DB4 PIN_B1
#DEFINE GLCD_DB5 PIN_B0
#DEFINE GLCD_DB6 PIN_C4
#DEFINE GLCD_DB7 PIN_C3

#define GLCD_WIDTH         320
#define GLCD_HEIGHT        240
#define GLCD_CHAR_WIDTH    8
#define GLCD_CHAR_HEIGHT   8

#define ON                 1
#define OFF                0
#define COMMAND_MODE   output_high(GLCD_A0);
#define DATA_MODE       output_low(GLCD_A0);

#DEFINE RA8835_GRAPHICSTART 0x2580

void GlcdPutData(INT8 data);
int8 TakeData(void);
void GLCD_WriteCommand(int8 commandToWrite);
void GLCD_WriteData(int8 dataToWrite);
int8 GLCD_ReadData(void);
void setCursorAddress(int16 addr);
void GlcdGotoTextXY(int16 x, int16 y);
void GlcdPutC(char c);
void FillText(char cara);
void FillGraphic(int1 parameter);
void glcd_RAinit(void);
int8 GLCD_ReadStatus(void);

void GlcdPutData(int8 data)
   {
   output_bit(GLCD_DB0, bit_test(data,0));     
   output_bit(GLCD_DB1, bit_test(data,1));                   
   output_bit(GLCD_DB2, bit_test(data,2));                   
   output_bit(GLCD_DB3, bit_test(data,3));
   output_bit(GLCD_DB4, bit_test(data,4));
   output_bit(GLCD_DB5, bit_test(data,5));                   
   output_bit(GLCD_DB6, bit_test(data,6));                 
   output_bit(GLCD_DB7, bit_test(data,7));
   }
   

   
int8 TakeData(VOID)
   {
   INT8 data = 0;
   data += input (GLCD_DB0);
   data += input (GLCD_DB1) * 2;
   data += input (GLCD_DB2) * 4;
   data += input (GLCD_DB3) * 8;
   data += input (GLCD_DB4) * 16;
   data += input (GLCD_DB5) * 32;
   data += input (GLCD_DB6) * 64;
   data += input (GLCD_DB7) * 128;
   RETURN data;
   }

void GLCD_WriteCommand(int8 commandToWrite)
{
GlcdPutData(commandToWrite);

COMMAND_MODE

output_low(GLCD_WR);
output_low(GLCD_CS);

delay_cycles(1);

output_high(GLCD_WR);
output_high(GLCD_CS);
}

void GLCD_WriteData(int8 dataToWrite)
{
GlcdPutData(dataToWrite);

DATA_MODE

output_low(GLCD_WR);
output_low(GLCD_CS);

delay_cycles(1);

output_high(GLCD_WR);
output_high(GLCD_CS);
}

int8 GLCD_ReadData(void)
{
int8 tmp;

output_low(GLCD_RD);
output_low(GLCD_CS);
delay_cycles(4);
tmp = TakeData();
output_high(GLCD_RD);
output_high(GLCD_CS);

return tmp;
}

void glcd_RAinit(void)
{
 
   output_high(GLCD_RST);
   output_high(GLCD_CS);
   output_high(GLCD_RD);
   output_high(GLCD_WR);
   
   //system set
   GLCD_WriteCommand(0x40);
   GLCD_WriteData(0x30);
   GLCD_WriteData(0x87);
   GLCD_WriteData(0x07);
   GLCD_WriteData(0x27);
   GLCD_WriteData(0x2F);
   GLCD_WriteData(0xEF);
   GLCD_WriteData(0x28);
   GLCD_WriteData(0x00);
   
   //scroll
   GLCD_WriteCommand(0x44);
   GLCD_WriteData(0x00);
   GLCD_WriteData(0x00);
   GLCD_WriteData(0xF0);
   GLCD_WriteData(0x80);
   GLCD_WriteData(0x25);
   GLCD_WriteData(0xF0);
   GLCD_WriteData(0x00);
   GLCD_WriteData(0x4B);
   GLCD_WriteData(0x00);
   GLCD_WriteData(0x00);
   //HDOT SCR
   
   GLCD_WriteCommand(0x5A);
   GLCD_WriteData(0x00);
   
   //OVLAY
   GLCD_WriteCommand(0x5B);
   GLCD_WriteData(0x01);
   
   //erase all screen
   FillGraphic(OFF);
   FillText(' ');
   
   //DISP ON
   GLCD_WriteCommand(0x58);
   GLCD_WriteData(0x56);
   
   //CSRFORM
   GLCD_WriteCommand(0x5D);
   GLCD_WriteData(0x04);   
   GLCD_WriteData(0x86);
   
   //DISP ON
   GLCD_WriteCommand(0x59);
   
   //CSDIR
   GLCD_WriteCommand(0x4C);
   
   //CSRW
   setCursorAddress(0x0000);
}


void FillGraphic(int1 parameter)
   {
   long count;
   //set cursor to 2580h
   setCursorAddress(0x2580);
   //put 00h in all graphic space
   count = 9600;
   GLCD_WriteCommand(0x42);
   while(count != 0)
      {
       GLCD_WriteData(0xFF * parameter);
      count--;
      }
   }
   
void FillText(char cara)
   {
   long count;
   //set cursor to 0000h
   setCursorAddress(0x0000);
   //put 00h in all text space
   count = 1200;
   GLCD_WriteCommand(0x42);
   while(count != 0)
      {
       GLCD_WriteData(cara);
      count--;
      }
   }
   
void GlcdPutC(char c)
   {
   GLCD_WriteCommand(0x42);
   GLCD_WriteData(c);
   }
   
//x and y : 1 to max   
void GlcdGotoTextXY(int16 x, int16 y)
   {
   int16 adress = 0;
   adress = (y-1)*40;
   adress = adress+ x-1;
   setCursorAddress(adress);
   }
   
void setCursorAddress(int16 addr)
{
   int8 adress;
   GLCD_WriteCommand(0x46);
   adress = addr & 0xFF;
   GLCD_WriteData(adress);
   adress = addr >> 8;
   GLCD_WriteData(adress);
}

void GLCD_Pixel(int16 x,int16 y, int1 color)
{
int8 tmp = 0;
int16 address = 0;

address = RA8835_GRAPHICSTART + (40 * y) + (x/8);
setCursorAddress(address);

GLCD_WriteCommand(0x43);
tmp = GLCD_ReadData();

if(color == ON)
  tmp |= (1 << (7 - (x % 8)));
else
  tmp &= ~(1 << (7 - (x % 8)));

setCursorAddress(address);
GLCD_WriteCommand(0x42);
GLCD_WriteData(tmp);
}

void GLCD_GraphicGoTo(int16 x,int16 y)
{
setCursorAddress(RA8835_GRAPHICSTART + (y * 40) + x/8);
}

int8 GLCD_ReadStatus(void)
{
int8 tmp;

output_low(GLCD_RD);
output_low(GLCD_CS);
output_low(GLCD_A0);
delay_cycles(1);
tmp = takedata();
output_high(GLCD_RD);
output_high(GLCD_CS);
output_high(GLCD_A0);

return tmp;
}

_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 4:22 am     Reply with quote

OK:
Code:

   GLCD_WriteCommand(0x40);
   GLCD_WriteData(0x30);
   GLCD_WriteData(0x87); //Change this to 0x84


I think that is right.
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

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

PostPosted: Wed Jan 29, 2020 4:37 am     Reply with quote

I've tried. It not happened and the cursor is still blinking. Writings on the screen are broken.
_________________
Es
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 5:05 am     Reply with quote

OK. I must have got the wrong setting. You are going to have to work through
the driver and work out which register each part is setting, and find the FC
bits. I know these are what do the change (have used the display on
another processor), but not how your driver works.
temtronic



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

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 6:05 am     Reply with quote

this code....
//CSRFORM
GLCD_WriteCommand(0x5D);
GLCD_WriteData(0x04);
GLCD_WriteData(0x86);

Controls the 'blinking' BUT it doesn't agree with a datasheet I downloaded ! I don't use that GLCD but I'd change the 0x86 to 0x87 and see what happens.
I don't KNOW if this driver was actually written FOR this GLCD device.
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 8:18 am     Reply with quote

Have to disagree.
The CSRFORM setting controls the size of the cursor, not it's visibility.
You can change the number of pixels and the number of lines, but '0' for
the number of pixels is illegal,so you can't make it disappear.
I remember playing with this.
The only one I found to make it disappear was the FC setting.
It should be the display on/off command last two bits.

Just checked the code again, and this is the right part:

//DISP ON
GLCD_WriteCommand(0x58);
GLCD_WriteData(0x56); //Change to 0x54

Currently '2' is being put into these bits, which is flash at about 2HZ.

I must admit I always prefer to use #defines for all the register name
constants, since this avoids me finding the wrong register... Smile
ertansuluagac



Joined: 13 Jul 2017
Posts: 135
Location: IZMIR

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

PostPosted: Wed Jan 29, 2020 8:27 am     Reply with quote

Yes, it happened. Thank you very much.
_________________
Es
temtronic



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

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 9:26 am     Reply with quote

arrrgh....
I 'assumed' CRSFORM of the driver was the SAME as CRSFORM in the datasheet, silly me..... chapter 6-3, table 9 is what I was looking at
DISP ON should only turn the entire display on or off...
It seems there's 2 bytes that are used, 1st for 'display control', the 2nd for 'cursor' control

What's missing from the datasheet I downloaded is a nice CHART of 'registers' and their bits.... It'd also be nice if they included a 'typical' example...

sigh, I'm getting too old for this ..... Smile

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed Jan 29, 2020 12:56 pm     Reply with quote

It's funny when you look at the quality of some datasheets in the past,
then look at the current offerings.
Whimpering becomes compulsory in some cases.... Very Happy
I had fun getting this controller to work.
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