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

RA8835 driver
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
murtis



Joined: 12 Aug 2007
Posts: 41

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

PostPosted: Wed Aug 06, 2008 9:10 am     Reply with quote

I tried to use the memory of the microcontroller. And, i saw that it needs to time very much for one dot on glcd screen. So, we need to use memory of the glcd that is very bg problem...
_________________
MurtiS
sliders_alpha



Joined: 03 Mar 2008
Posts: 55

View user's profile Send private message

PostPosted: Thu Jun 18, 2009 5:14 am     Reply with quote

hi

I've just tied these with a RA8835 and whatever I do after the init, my screen is just displaying random pixel, some are on some are off.

I don't think it's a wiring error since if I do (on purpose) a wiring error my screen is displaying vertical line.

I have just modified the SED1335.C for my application. Data were put on a full port, I'm putting them on separate pins like this :
Code:

To place data on the bus

   output_bit(LCD_DB0, !!(data & 1));     
   output_bit(LCD_DB1, !!(data & 2));                   
   output_bit(LCD_DB2, !!(data & 4));                   
   output_bit(LCD_DB3, !!(data & 8));
   output_bit(LCD_DB4, !!(data & 16));
   output_bit(LCD_DB5, !!(data & 32));                   
   output_bit(LCD_DB6, !!(data & 64));                 
   output_bit(LCD_DB7, !!(data & 128));

and reading them, like this :
Code:

int8 glcd_readByte()
{
to read data from the bus
   data = input(LCD_DB0) + data;
   data = input(LCD_DB1)*2 + data;
   data = input(LCD_DB2)*4 + data;
   data = input(LCD_DB3)*8 + data;
   data = input(LCD_DB4)*16 + data;
   data = input(LCD_DB5)*32 + data;
   data = input(LCD_DB6)*64 + data;
   data = input(LCD_DB7)*128 + data;


Here is my code :
Code:

#include <16F876A.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 20000000)

#include <sed1335_for_me.c>
#include <graphics.c>

void main(void)
   {
   glcd_init(ON);
   delay_ms(250);
  // glcd_fillScreen(ON);
  glcd_fillScreenText('A');
   }

I'm using A0,A1,A2,A3,A5,C3,C4,B0-B5.

Any idea?

thanks
_________________
yup, i know, i don't speak english very well

CCS V4.057
sliders_alpha



Joined: 03 Mar 2008
Posts: 55

View user's profile Send private message

PostPosted: Fri Jun 19, 2009 2:05 am     Reply with quote

so, a demo board was given with my screen, and i've notice that you can solder on it a 6pin connecter to allow re-programming of it's 16F57

so now, faulty wiring is impossible.

here i've took two pictures, the first is the LCD initialised with nothing done
the second it the lcd initialised with an fillscreen(on) done

the upper part did not change, it's because i used a 2$ camera and moved a little

the upper part is made of random pixel and the lower part of random character





my code :

Code:

#include <16F57.H>
#fuses RC, NOWDT, NOPROTECT
#use delay(clock = 5200000)

#define LARGE_LCD 1
#include <SED1335.C>
#include <graphics.c>

void main(void)
   {
   glcd_init(on);
   delay_ms(1000);
   glcd_fillScreen(1);
   }


i'm using this screen

CCS V4.057

and those pin :

data port : port C

RST PIN_B0
RD PIN_A1
WR PIN_A0
CS PIN_A2
A0 PIN_A3
_________________
yup, i know, i don't speak english very well

CCS V4.057
repepon



Joined: 19 Feb 2010
Posts: 1

View user's profile Send private message

PostPosted: Fri Feb 19, 2010 7:21 am     Reply with quote

Hi, I know its been a while but I am having the same problem with the source code.
The problem is the reading byte from the LCD memory display not the pixel write.
Has anyone solved it? Has anyone have correct a reading routine?

Thanks!
josi2257



Joined: 01 Dec 2010
Posts: 1

View user's profile Send private message

PostPosted: Wed Dec 01, 2010 8:53 pm     Reply with quote

Hello!
First of all, I'm sorry for my english. I can see that this post is very old, but perhaps I've made something that may help someone.
I've found the library for the RA8835 Controller that "sliders_alpha" did, and I tried to use it with my GLCD. I found the code in "RA8835 drivers for 320x240 LCD":
http://www.ccsinfo.com/forum/viewtopic.php?t=39353
My LCD model is: WG-320240-C0-TFH (with RA8835).
I spend so many days trying to make it work, and I had the same problem that "murdis", that mistake on the reading cycle. I realized today that my LCD was in "6800 mode", by measuring the pins SEL1 y SEL2 from the RA8835 chip (you can see the location of these pins in the datasheet of RA8835). The code is written for "8080 mode". However, it works the same way for the writing cycle, but is different for the reading cycle.
In my LCD board, the pin 53 (SEL1) had 5V and the pin 52 (SEL2) had ground.
So I've modified sliders_alpha's code for using with the LCD in "6800 mode". It doesn't change too much, but, as you could see, a little character of your code can always make the difference. The change is to use the ENABLE_CLOCK pin instead of the READ pin, and use the WRITE pin as a READ/WRITE pin (it's all in the datasheets). Besides I wrote some lines for the correct reading of the data bus (you can see this in the glcd_pixel routine). I have this routine working right in my GLCD. I use a PIC18F4550, with 48MHz of clock frecuency (look out the delays). The pins between the LCD and the PIC were also changed, you can choose were you want them and change them in the begining of the code.
I hope it's useful for someone, because I've seen that many people had the same problem than me (reading corrupted data), and it's very possible that the problem was the "6800 mode".
I always find solutions in this forum, and today is the first time that I (try to) give solutions. I'm glad... Thank you for everything!

Code:


// "sliders_alpha" original file
// Modified for working with the "6800 mode"

#ifdef DELAYS_48MHZ
#define delay_xt  5
#endif

#ifdef DELAYS_20MHZ
#define delay_xt  1
#endif


#define GLCD_RW PIN_A0         // Changes
#define GLCD_E  PIN_A1         // Changes
#define GLCD_CS PIN_A2
#define GLCD_A0 PIN_A3
#define GLCD_RST PIN_A4

#DEFINE GLCD_DB0 PIN_D0
#DEFINE GLCD_DB1 PIN_D1
#DEFINE GLCD_DB2 PIN_D2
#DEFINE GLCD_DB3 PIN_D3
#DEFINE GLCD_DB4 PIN_D4
#DEFINE GLCD_DB5 PIN_D5
#DEFINE GLCD_DB6 PIN_D6
#DEFINE GLCD_DB7 PIN_D7

#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)      // Changes
{
GlcdPutData(commandToWrite);
output_low(GLCD_E);
COMMAND_MODE

output_low(GLCD_RW);
output_low(GLCD_CS);

delay_cycles(delay_xt);
output_high(GLCD_E);
delay_cycles(delay_xt);
output_low(GLCD_E);

output_high(GLCD_RW);
output_high(GLCD_CS);
}

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

output_low(GLCD_E);

DATA_MODE

output_low(GLCD_RW);
output_low(GLCD_CS);

delay_cycles(delay_xt);
output_high(GLCD_E);
delay_cycles(delay_xt);
output_low(GLCD_E);

output_high(GLCD_RW);
output_high(GLCD_CS);
}

int8 GLCD_ReadData(void)            // Changes
{
int8 tmp;

output_low(GLCD_E);

output_low(GLCD_CS);
output_high(GLCD_A0);
output_high(GLCD_RW);

delay_cycles(delay_xt);
output_high(GLCD_E);
delay_cycles(delay_xt);
tmp = TakeData();
output_low(GLCD_E);

output_high(GLCD_CS);

return tmp;
}

void glcd_RAinit(void)
{
 
   output_high(GLCD_RST);
   output_high(GLCD_CS);
   output_high(GLCD_E);
   output_high(GLCD_RW);
   
   //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);

GLCDPutData(0x00);

set_tris_d(0xFF);         // Set the Port D as inputs before I call
               // GLCD_ReadData; it doesn't work
               // without this line.
               // The rest is the same.
tmp = GLCD_ReadData();
set_tris_d(0x00);         // Port D as outputs again.

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_E);
output_low(GLCD_CS);
output_low(GLCD_A0);
delay_cycles(delay_xt);
output_high(GLCD_E);
delay_cycles(delay_xt);
delay_cycles(delay_xt);
tmp = takedata();
output_low(GLCD_E);
output_high(GLCD_CS);
output_high(GLCD_A0);

return tmp;
}

_________________
Josi
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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