CODING

HELLO I WORK WITH LPC2129 I DEFINITE a VARIABLE

#define D4 16 //P1.16

#define D5 17 //P1.17

#define D6 18 //P1.18

#define D7 19 //P1.19

#define D0 20 //P1.20

#define D1 21 //P1.21

#define D2 22 //P1.22

#define D3 23 //P1.23

#define DATA(D0|D1|D2|D3|D4|D5|D6|D7)

MY QUESTION HOW TO MAKE TO CHARGE FOR EXAMPLE VALUE 55 IN DATA (OR a LETTER)

THANK YOU FOR the ASSISTANCE

#define DATA(D0|D1|D2|D3|D4|D5|D6|D7)

This definition doesn’t make any sense with your definitions for D0, D1 … D7. You may want something more like this:

#define DATA ((1<<D0)|\
              (1<<D1)|\
              /* ... */
              (1<<D7))

But without seeing more of your program, it’s hard to tell.

hello

I tested your configuration, it is the good thanks,

I am always on the LCD, the output are compatible with the control words but my LCD still off

I you joint the code


#include “lpc21xx_keil.h”

///////////////////////////////////////////////////////////////////////////

#define LCD_D0 17 //P1.16

#define LCD_D1 18 //P1.17

#define LCD_D2 19 //P1.18

#define LCD_D3 20 //P1.19

#define LCD_D4 21 //P1.20

#define LCD_D5 22 //P1.21

#define LCD_D6 23 //P1.22

#define LCD_D7 24 //p1.23

#define LCD_RS 28 //P0.28

#define LCD_RW 29 //P0.29

#define LCD_EN 30 //P0.30

#define LCD_DATA ((1<<LCD_D0)|(1<<LCD_D1)|(1<<LCD_D2)|(1<<LCD_D3)|(1<<LCD_D4)|(1<<LCD_D5)|(1<<LCD_D6)|(1<<LCD_D7))

#define LCD_COM ((1<<LCD_RS)|(1<<LCD_RW)|(1<<LCD_EN))

////////////////////////////////////////////////////////////////////////////////////////

#define lcd_rs_set() IOSET0 = (1<<LCD_RS)

#define lcd_rs_clr() IOCLR0 = (1<<LCD_RS)

#define lcd_en_set() IOSET0 = (1<<LCD_EN)

#define lcd_en_clr() IOCLR0 = (1<<LCD_EN)

#define lcd_rw_set() IOSET0 = (1<<LCD_RW)

#define lcd_rw_clr() IOCLR0 = (1<<LCD_RW)

////////////////////////////////////////////////////////////////////////////////////////

void out(unsigned char);

void lcd_control(unsigned char);

void lcd_putchar(unsigned char);

void lcd_print(unsigned char*);

/////////////////////////////////////////////////////////////////////////////////////////

void wait(){

int loop=2800;

while(loop–);

}

void out(unsigned char val)

{

IOCLR1 = (LCD_DATA);

IOSET1 =((val)&0xff)<<LCD_D0;

wait();

}

void lcd_control(unsigned char val){

lcd_rs_clr();

out(val);

}

void lcd_init()

{

lcd_rs_clr();

lcd_rw_clr();

lcd_en_set();

wait();

wait();

lcd_control(0x38);

lcd_control(0x30);

lcd_control(0x30);

lcd_control(0x30);

lcd_control(0x02);

wait();

lcd_control(0x0E);

lcd_control(0x01);

lcd_control(0x06);

}

void lcd_putchar(unsigned char c)

{

lcd_rs_set();

out(c);

}

void lcd_print(unsigned char* str)

{

int i;

for (i=0;i<16 && str*!=0;i++)*

  • {*
    lcd_putchar(str);
    }
    }
    /////////////////////////////////////////////////////////////////////////////////////
    main(void)
    {
    PINSEL1 = 0x00000000; //IO
    PINSEL2 = 0x0; //IO
    IODIR0 = (LCD_COM); //SORTIE
    IODIR1 = (LCD_DATA); //SORTIE
    /////////////////////////////////////////////////////////////////////// /////////////
    ///////////////////////// configuration PLL///////////////////////////////////////
    * MAMCR = 2; // accelerateur memoir activé*
    * PLLCFG = 0x23;// calcul de frequence , CPU a 64 Mhz*
    * PLLFEED = 0xAA;// application de pllcfg*
    * PLLFEED = 0x55;// application de pllcfg*
    * PLLCON = 0x1;//activation pll*
    * PLLFEED = 0xAA;// application de pllcfg*
    * PLLFEED = 0x55;// application de pllcfg*
    * while(!(PLLSTAT & 0x400)){}*
    * PLLCON=0x3;//connexion pll*
    * PLLFEED=0xAA;*
    * PLLFEED=0x55;*
    ////////////////////////////////////////////////////////////////////////////////////
    lcd_init();
    lcd_print(“hello”);
    }