• AVR Freaks

Helpful ReplyHot!RA8835 Initialisation for a beginner

Author
Kris
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2020/12/04 14:16:10
  • Location: 0
  • Status: offline
2021/01/19 17:45:36 (permalink)
0

RA8835 Initialisation for a beginner

Hi Everyone,
 
Does anyone have any example code for the RA8835 Graphics LCD. I'm running MPLAB X V5.30 with XC8 V2.31. I am using a PIC18f46K80. I have been experimenting with the above screen for several days now, but without success.The First problem was as follows. For some bizarre reason the pic would initially only output to one port. For example, I was using Port B as the control port and Port D as the Databus. I could control these ports individually and they worked correctly (in different programs).
When I tried to control both ports from within the same program one or both ports wouldn't work. Has anyone come across this before? I have classified this as defective/blown pics. I would appreciate someone elses opinion on this.
 
I am now using the pic18f46k80, and the program appears to work correctly as programmed. Alas however, the screen remains blank. The code that I am using, has come from the manufacturers after exchanging a number of emails. I have adapted the 8051 code (I think its for the 8051 but no 100% sure) for the xc8 compiler. I don't need anthing fancy I just want to write text to the screen.
 
I am willing to upload their / my code but be warned its very simplistic and is uncommented, should anyone want to see it.
 
Thankyou all for reading.
 
best regards
Kris.
#1
ric
Super Member
  • Total Posts : 29870
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: RA8835 Initialisation for a beginner 2021/01/19 18:32:53 (permalink) ☄ Helpfulby Kris 2021/01/20 05:18:53
+2 (2)
It's more likely a bug in your code, which you have not shown.
Did you make sure that all bit set/clear operations are always directed at the LATx register, and not the matching PORTx register?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
Kris
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2020/12/04 14:16:10
  • Location: 0
  • Status: offline
Re: RA8835 Initialisation for a beginner 2021/01/20 05:20:58 (permalink)
0
Thanks for the reply ric.
 
Yes I can confirm that I'm addressing the LATx registers. I have posted the code I have modified for the xc8 compiler provided by the manufacturer below.
 

#include "mcc_generated_files/mcc.h"


#define lcd_RES     LATB4
#define lcd_A0      LATB2
#define lcd_WR      LATB1
#define lcd_RD      LATB0
#define lcd_CS      LATB3

void lcd_reset(void)
{
    lcd_RES = 1;
    __delay_ms(2);
    lcd_A0 = 0;
    lcd_WR = 1;
    lcd_RD = 1;
    lcd_CS = 1;
    __delay_ms(100);
    lcd_RES = 0;
    __delay_ms(1000);
    lcd_RES = 1;
    __delay_ms(500);
}
void lcd_cmdwrite(unsigned char cmdx)
{   
    LATD = cmdx;
    lcd_A0 = 1;
    lcd_CS = 0;
    lcd_WR = 0;
    __delay_ms(10);
    lcd_WR = 1;
    lcd_CS = 1;
    lcd_A0 = 0;
    __delay_ms(10);
    LATD=0;
}
unsigned char lcd_cmdread(void)
{   
    unsigned char address_cmd;
    TRISD=0xff;
    lcd_A0 = 0;
    lcd_CS = 0;
    lcd_RD = 0;
    __delay_ms(10);
    address_cmd = PORTD;
    lcd_RD = 1;
    lcd_CS = 1;
    lcd_A0 = 0;
    TRISD=0x00;
  return(address_cmd);
}
void lcd_chkbusy(void)
{
    unsigned char busy;
    do
    {
       busy =(lcd_cmdread() & 0x40);
    }
     while(busy);  
 
}
void lcd_datawrite(unsigned char datax)
{   
    lcd_chkbusy();

    lcd_A0 = 0;
    LATD = datax;
    lcd_CS = 0;
    lcd_WR = 0;
    __delay_ms(10);
    lcd_WR = 1;
    lcd_CS = 1;
    lcd_A0 = 1;
    __delay_ms(20);
    LATD=0;
}
void lcd_initial(void)
{
   lcd_cmdwrite(0x40);       //SYSTEM SET
   lcd_datawrite(0x30);      //p1
   lcd_datawrite(0x87);      //p2   
   lcd_datawrite(0x07);      //p3   
   lcd_datawrite(0x27);      //p4   
   lcd_datawrite(0x37);      //p5  
   lcd_datawrite(0xef);      //p6   
   lcd_datawrite(0x28);      //p7   
   lcd_datawrite(0x00);      //p8   
   

   lcd_cmdwrite(0x44);       //SCROLL
   lcd_datawrite(0x00);      //sa1-L, set the start address for the layer 1at 0x0000h
   lcd_datawrite(0x00);      //sa1-H
   lcd_datawrite(0xf0);      //sL1    
   lcd_datawrite(0x80);      //sa2-L, set the start address for the layer 2 at 0x2580h   
   lcd_datawrite(0x25);      //sa2-H  
   lcd_datawrite(0xf0);      //sL2  
   lcd_datawrite(0x00);      //sa3-L  
   lcd_datawrite(0x3a);      //sa3-H     
   lcd_datawrite(0x00);      //sa4-L
   lcd_datawrite(0x3a);      //sa4-H
      
   lcd_cmdwrite(0x5a);       //HDOT SCR
   lcd_datawrite(0x00);
       
   lcd_cmdwrite(0x58);       //DISP OFF
   lcd_datawrite(0x54);        
        
   lcd_cmdwrite(0x5d);       //CSR FORM
   lcd_datawrite(0x00);      //CRX
   lcd_datawrite(0x00);      //CRY
   
   lcd_cmdwrite(0x59);       //DISP ON
   lcd_datawrite(0x54);      
 
   lcd_cmdwrite(0x5b);       
   lcd_datawrite(0x00);      

  lcd_cmdwrite(0x4c);       // set cursor's direction, from left to right and top to bottom
}
void lcd_cursorxy(unsigned char x,unsigned char y)
{
    lcd_chkbusy();
    lcd_cmdwrite(0x46);
    lcd_datawrite(x);
    lcd_datawrite(y);
}
void lcd_clear(void)
{   
    unsigned int i;
    lcd_cursorxy(0x00,0x00);  
    lcd_cmdwrite(0x42);
    for(i=0;i<0xff;i++)
    {
        lcd_datawrite(0x00);
    }
}
void lcd_showbig(unsigned char *text, unsigned int x)
{
    while(*text != '\0')          
    {
        lcd_datawrite(*text);
        ++text;

        __delay_ms(0);
    }
}

void lcd_text_1(void)
{
    lcd_cursorxy(0x00,0x00);
    lcd_cmdwrite(0x42);       //MWRITE
    lcd_showbig("RAiO Technology Inc.",0);


}
void main(void)
{
    SYSTEM_Initialize();
    lcd_reset();
    lcd_initial();
    lcd_clear();
    lcd_text_1();

    while (1)
    {

        
    }
}
 

 
If you the need header files let me know. (They were created using MCC)
 
Thankyou for taking the time to help this newbie! It is appreciated.
 
Regards,
Kris
#3
Kris
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2020/12/04 14:16:10
  • Location: 0
  • Status: offline
Re: RA8835 Initialisation for a beginner 2021/01/22 16:53:59 (permalink)
0
Update:
 
Hi All,
 
I'm still having no success with this display. Is there nobody out there that can help with exprience of this display?
 
The board that is attached is ERM320240-2. The datasheet can be found at:
 
https://www.buydisplay.co...uivalent-white-on-blue
 
Any suggestions are welcomed, I am totally lost at this stage. The manufacturer seems to think that the problem is a communications problem between my dev board (A PIC_EK) and the display development board. I have checked that the pic is outputting both the control and data ports as required with an oscilloscope and/or logic probe. Even to the point of checking that the silk screen is connected to the chip as stated.
 
At this stage I am only trying to write text no graphics.
 
Once again thanks for taking the time to read and any help that you may be able to provide, it is appreciated.
 
Kris
#4
ALPL
Super Member
  • Total Posts : 312
  • Reward points : 0
  • Joined: 2006/12/30 02:52:11
  • Location: Austria
  • Status: offline
Re: RA8835 Initialisation for a beginner 2021/01/31 10:01:15 (permalink) ☄ Helpfulby Kris 2021/02/12 15:57:01
+1 (1)
Hello, I am also just at the beginning of my investigations about the RA8835-displays, so unfortunately I cannot give a working solution. But have a look at following page: http://en.radzio.dxp.pl/sed1335/ . Their library may be helpful for  you.
#5
ALPL
Super Member
  • Total Posts : 312
  • Reward points : 0
  • Joined: 2006/12/30 02:52:11
  • Location: Austria
  • Status: offline
Re: RA8835 Initialisation for a beginner 2021/01/31 10:11:52 (permalink) ☄ Helpfulby Kris 2021/02/12 15:56:12
+1 (1)
Just to see if a new product (sensor, display, IC, ...) is working and to get first "feelings" we often use the Arduino environment because it offers libraries for almost everything and within a few minutes the new product can be set up and tested. Then we start coding the PIC. For testing a RA8835-display on an Arduino there is following library (normally very reliable): https://www.arduinolibraries.info/libraries/u8g2 .
#6
ALPL
Super Member
  • Total Posts : 312
  • Reward points : 0
  • Joined: 2006/12/30 02:52:11
  • Location: Austria
  • Status: offline
Re: RA8835 Initialisation for a beginner 2021/01/31 11:07:29 (permalink)
0
Or here: http://www.ccsinfo.com/forum/viewtopic.php?t=39353 - you will find code in CCS C.
#7
Kris
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2020/12/04 14:16:10
  • Location: 0
  • Status: offline
Re: RA8835 Initialisation for a beginner 2021/02/12 15:55:23 (permalink)
0
Thanks ALPL for the information, I haven't had a lot of time lately due to studying for 3 online exams. I've sat one of 3 so it'll be some time yet before I get to enjoy that side of the hobby. I have an Arduino Uno so I can always revert to that for testing as you have suggested.
 
When I get to play again (2 to 3 weeks hopefully if exams go well), I'll post and let you know how I get on. I did look at the sed1335, but not to closely, again due to time. I will attempt to revisit it once my exams are done.
 
I hope, I'm able to get the display up and running. It would be such a shame because its a very big graphics display, that I should be able to see without too many problems.
 
Best regards,
Kris
#8
Jump to:
© 2021 APG vNext Commercial Version 4.5