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.

GLCD PCF8833 with ARM LPC2148

Status
Not open for further replies.

hbaocr

Full Member level 4
Joined
May 13, 2007
Messages
232
Helped
25
Reputation
48
Reaction score
4
Trophy points
1,298
Location
Hochiminh City university of technology (VietNam)
Activity points
2,765
pcf8833

hello;
I have project using GLCD( phillip chipset use for NOKIA 6100)! And I met a big problem when coding with it.I don't know why my code incorrect.Here that code
Code:
/****************************************************/

// LPC2148    ----->  GLCD(6100 display PCF8833)
// MOSI(P0.6) ------>  DATA(pin 3 )
// SCK(P0.4)  ------>  SCK
// MISO(P0.5) -------  NC
// P0.2    	  ------>  RS
// P0.7) ------------> CS
//P0.3--------------->Blink

#include "LPC214x.H" 	
/* pototype  section */                               	// LPC2148 MPU Register
//define for LCD
/*****************************************************************************
          Command of LCD NOKIA6100(phillips chipset)
*****************************************************************************/
#define NOP       0x00 // nop
#define SWRESET    0x01 // software reset
#define BSTROFF    0x02 // booster voltage OFF
#define BSTRON       0x03 // booster voltage ON
#define RDDIDIF    0x04 // read display identification
#define RDDST       0x09 // read display status
#define SLEEPIN    0x10 // sleep in
#define SLEEPOUT    0x11 // sleep out
#define PTLON       0x12 // partial display mode
#define NORON       0x13 // display normal mode
#define INVOFF      0x20 // inversion OFF
#define INVON       0x21 // inversion ON
#define DALO       0x22 // all pixel OFF
#define DAL       0x23 // all pixel ON
#define SETCON       0x25 // write contrast
#define DISPOFF    0x28 // display OFF
#define DISPON       0x29 // display ON
#define CASET       0x2A // column address set
#define PASET       0x2B // page address set
#define RAMWR       0x2C // memory write
#define RGBSET       0x2D // colour set
#define PTLAR       0x30 // partial area
#define VSCRDEF    0x33 // vertical scrolling definition
#define TEOFF       0x34 // test mode
#define TEON       0x35 // test mode
#define MADCTL       0x36 // memory access control
#define SEP       0x37 // vertical scrolling start address
#define IDMOFF       0x38 // idle mode OFF
#define IDMON       0x39 // idle mode ON
#define COLMOD       0x3A // interface pixel format
#define SETVOP       0xB0 // set Vop
#define BRS       0xB4 // bottom row swap
#define TRS       0xB6 // top row swap
#define DISCTR       0xB9 // display control
#define DOR       0xBA // data order
#define TCDFE       0xBD // enable/disable DF temperature compensation
#define TCVOPE       0xBF // enable/disable Vop temp comp
#define EC          0xC0 // internal or external oscillator
#define SETMUL       0xC2 // set multiplication factor
#define TCVOPAB    0xC3 // set TCVOP slopes A and B
#define TCVOPCD    0xC4 // set TCVOP slopes c and d
#define TCDF       0xC5 // set divider frequency
#define DF8COLOR    0xC6 // set divider frequency 8-color mode
#define SETBS       0xC7 // set bias system
#define RDTEMP       0xC8 // temperature read back
#define NLI       0xC9 // n-line inversion
#define RDID1       0xDA // read ID1
#define RDID2       0xDB // read ID2
#define RDID3       0xDC // read ID3
//define pin
#define RS (1<<2)
#define CS (1<<7)
#define BL (1<<3)
#define SDA       (1<<6) //MOSI
#define CLK       (1<<4) //CLK
//define program
//*****************************************************************************
//          Program definition
//*****************************************************************************/
#define CS0 IOCLR0 = CS
#define CS1 IOSET0 = CS
#define CLK0 IOCLR0 = CLK
#define CLK1 IOSET0 = CLK
#define SDA0 IOCLR0 = SDA
#define SDA1 IOSET0 = SDA
#define RESET0 IOCLR0 = RS
#define RESET1 IOSET0 = RS 

/* pototype  section */
//****************************************************************************
//          Program prototype
//****************************************************************************
void lcd_init(void);
void spi_init(void);
void sendData(unsigned char data);
void sendCMD(unsigned char com);
void LCD_put_pixel(unsigned char color, unsigned char x, unsigned char y); 

void delay_ms(unsigned long int);						// Delay Time Function
//main function

int main(void)
{
unsigned int i;
//int
IODIR0 =  CS|CLK|SDA|RS;
lcd_init(); 
while(1)
{
for(i=1;i<131;i++)
{
LCD_put_pixel(0xFC,i,50);
}
//test code
}
}	  
//=============spi int==================

void spi_init(void)
{
	PINSEL0 |= 0x00001500; // set port0.4-0.6 SPI0
 
 // SPI0 initial function LCD6100
  	S0SPCCR = 8;       // SPI0 clk = VPB clk /S0PCCR
                 //  7.5 MHz = 60 MHz /8
 // SPI0 Register control
  	S0SPCR = 0x00000924; // 9 bit data
     					// CPHA=0, CPOL=0
                       // MPU master
                      // MSB first    
                     // SPIF interrupts unable 
}
//=============end function==============

                     
/*****************************************************************************
          LCD initial Function
*****************************************************************************/
void lcd_init(void)
{
int i = 0;

  spi_init();

  /*** Hardware Reset LCD ***/
  RESET0;
  delay_ms(10);
  RESET1;
  delay_ms(10);
  /*** Initial state ***/
  CS0;				   // cho phep LCD 
  sendCMD(SWRESET);    // Software Reset LCD
  delay_ms(10);
  
  sendCMD(SLEEPOUT); // Sleep out
  delay_ms(10);
  //sendCMD(INVON);	//seem to be requires for this controller
  
  sendCMD(COLMOD);   // 8 bit color
  sendData(0x02);
  sendCMD(NORON);    // Normal Display
  sendCMD(MADCTL);    //   memory access control
  sendData(0x40);    // Miror X 

  sendCMD(SETCON);    // set contrast
  sendData(63);    
  delay_ms(10);

  sendCMD(DISPON);    // Display ON
  delay_ms(10);
   
   /*** Set Black Coulour to Backgound ***/
   sendCMD(CASET);   
   sendData(0);
   sendData(131);
   sendCMD(PASET);   
   sendData(1);     
   sendData(131);
   sendCMD(RAMWR);          
   for(i=0;i<(131*131);i++)
   {
      sendData(0);
    }
}

/*****************************************************************************
          Send command to LCD Function
*****************************************************************************/
void sendCMD(unsigned char com)
{   
   	 CS0;// chip select enable
     S0SPDR = com & ~0x0100;// For Command MSB "LOW"
     while((S0SPSR & 0x80)!= 0x80){;;}   // Wait SPIF = 1 (SPI Send Complete)
     CS1; //unselect
}

/*****************************************************************************
          Send Data to LCd function
*****************************************************************************/
void sendData(unsigned char data)
{
  CS0;
  S0SPDR  = data | 0x0100;// For Data MSB must "HIGH"
  while((S0SPSR & 0x80)!= 0x80){;;}   // Wait SPIF = 1 (SPI Send Complete)
  CS1;
}

/*****************************************************************************
          LCD plot pixel on LCD Function
*****************************************************************************/

void LCD_put_pixel(unsigned char color, unsigned char x, unsigned char y)
{
  sendCMD(PASET);   // page start/end ram  = Row
  sendData(y);
  sendData(131);
  sendCMD(CASET);   // column start/end ram = Colum
  sendData(x);     
  sendData(131);
  sendCMD(RAMWR);    // write DATA
  sendData(color);
} 
/***********************/
/* Delay Time Function */
/***********************/

void delay_ms(unsigned long int count1)
{
unsigned int i,k;
k=count1*2600;
  for(i=0;i<k;i++);							// Loop Decrease Counter	
}
 

glcd arm

you should describe your problem exactly. so people can help you.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top