Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Driving SED1330 with dSPic33FJ256GP710!

Status
Not open for further replies.

drkidd22

Newbie level 4
Joined
Apr 1, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,318
I have a LM6733 LCD module which has a SED1330 display controller. I'm trying to use the Explorer 16 to display some simple message on the screen just to get me started, but I have not been successful at it.

I have the lower 8 bits of PORTE on the pic set for the data lines and PORTA for the control lines. Below is the code of what I have so far and have not been able to display anything on the screen. I'm using the pictail PBC and have tested everything. 100% sure that the wiring is correct.

Code:
/**********************************************************************************
This part of the project contains all #Define directives and the LCD Initialization
Date: 03/25/2010
LCD Model: LM6733
LCD Controller: SED1330
***********************************************************************************/

#include "p33FJ256GP710.h"

_FOSCSEL(FNOSC_PRIPLL);
_FOSC(FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_XT);
_FWDT(FWDTEN_OFF);

#define LCD_DATA     PORTE   // Port for data transfer.(PIC RE0-RE7 <<------>> LCD DB0-DB7)
#define DDR_DATA      TRISE   // Port E Data direction controll

#define DDR_CTRL      TRISA   // Port A Data direction controll

#define GLCD_COMMAND   PORTAbits.RA0     /* A0 Pin       PIC RA0
#define GLCD_CS        PORTAbits.RA1     /* Chip Select  PIC RA1
#define GLCD_WR        PORTAbits.RA2     /* WR Pin       PIC RA2
#define GLCD_RD        PORTAbits.RA3     /* RD Pin       PIC RA3
#define GLCD_RESET     PORTAbits.RA4     /* Reset Pin    PIC RA4

#define  Hi     1   
#define  Lo     0   

#define LCD_RESX       320   /* Grafic resolution X */
#define LCD_RESY       240   /* Grafic resolution Y */
#define LCD_CHARPERROW 40    /* maximum is ( GLCD_RESX / GLCD_CHARWIDTH ) */
#define LCD_CHARROWS   16    /* should be calculated from RESY/CHARHEIGHT */
#define LCD_CHARWIDTH  8     /* = GLCD_RESX / GLCD_CHARPERROW */
#define LCD_CHARHEIGHT 8

#define SYSSET          0x40    /* System Set                              */
#define SLEEPIN          0x53    /* Enter standby mode                      */
#define DISPOFF       0x58    /* Display on                              */
#define DISPON        0x59    /* Display off                             */
#define SCROLL        0x44    /* Display Start Addr & Display regions    */
#define CSRFORM       0x5D    /* Set Cursor Type                         */
#define CGRAM         0x5C    /* Start Addr Char. Generator Ram          */
#define CSRDIR        0x4C    /* Direction of cursor movement            */
#define HDOTSCR       0x5A    /* Horizontal Scroll Position              */
#define OVERLAY       0x5B    /* Display Overlay format                  */
#define CSRW          0x46    /* Set Cursor Address                      */
#define CSRR          0x47    /* Read Cursor Address                     */
#define MWRITE        0x42    /* Write to Display Memory                 */
#define MREAD         0x43    /* Read from Display Memory                */

/*********************************************************/
/* send Command to Controler                             */
/*********************************************************/
void lcdSndCmd(unsigned  char command )
{
    LCD_RD = Hi;
    LCD_DATA  = command;

    LCD_COMMAND = Hi;
    LCD_CS = Lo;
    LCD_WR = Lo;
            //short_delay;
    LCD_CS = Hi;
    LCD_WR = Hi;
    LCD_COMMAND = Lo;
}

/*********************************************************/
/* send Data to Controller                               */
/*********************************************************/
void lcdSndData(unsigned char value )
{
    LCD_DATA    = value;

    LCD_COMMAND = Lo;
    LCD_RD = Hi;
    LCD_CS = Lo;
    LCD_WR = Lo;
            //short_delay;
    LCD_CS = Hi;
    LCD_WR = Hi;
}

/*********************************************************/
/* Reset Controller                                      */
/*********************************************************/
void LCD_Reset(void)
{
int i;
volatile int j;

    DDR_DATA = 0x00;
    DDR_CTRL = 0x00;

    LCD_RD = Hi;
    LCD_WR = Hi;
    LCD_DATA    = 255;
    LCD_COMMAND = Hi;

    LCD_RESET = Lo;
    for (i = 0; i < 1000; i++)
    {  j++;
       LCD_RESET = Lo;
    }
    for (i = 0; i < 1000; i++)
    {  j++;
       LCD_RESET = Hi;
    }

    LCD_RESET = Hi;
    LCD_CS = Hi;
}

void LCD_Init(void)
{
  DDR_DATA  = 0x00;
  DDR_CTRL  = 0x00;

  lcdSndCmd(SYSSET);
  lcdSndData(0x30);
  lcdSndData((LCD_CHARWIDTH-1)|0x80);    
  lcdSndData(LCD_CHARHEIGHT-1);       
  lcdSndData(LCD_CHARPERROW-1);       
  lcdSndData(LCD_CHARPERROW+4);       
  lcdSndData(LCD_RESY-1);             
  lcdSndData(LCD_CHARPERROW);         
  lcdSndData(0);                      

  lcdSndCmd(OVERLAY);
  lcdSndData(1);   
        
  lcdSndCmd(SCROLL);
  lcdSndData(0);           
  lcdSndData(0);           
  lcdSndData(LCD_RESY-1);    
  lcdSndData(0x80);        
  lcdSndData(0x02);        
  lcdSndData(LCD_RESY-1);
 
  lcdSndCmd(CSRFORM);
  lcdSndData(0x05);       
  lcdSndData(0x85);         

  lcdSndCmd(HDOTSCR);  
  lcdSndData(0x0);          

  lcdSndCmd(CSRDIR);    

  lcdSndCmd(DISPON);  
  lcdSndData(0x14);         
//  currTextx=0;
//  currTexty=0;

lcdSndCmd(MWRITE);
lcdSndData(0x4D);     //M
cdSndData(0x49);        //I
cdSndData(0x46);         //C
cdSndData(0x52);          //R
cdSndData(0x4F);           //O

}

int main(void)
{
        PLLFBD = 0x00A0;
        CLKDIV = 0x0048;

unsigned char c;
int i;

   //Init LCD Dispay
    LCD_Reset();
    LCD_Init();
}
MPLAB v8.46
ICD2
LED Jumper from explorer 16 removed
Any help will be appreciated.
 

Anyone? I would really appreciate some help here.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top