This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GLCD interfacing ARM7- LPC2148

I am getting a problem while burning the code in LPC2148 interfacing with GLCD. Flash Magic is showing an error- failed to autobaud.
I want to know if we can directly connect GPIO pins of LPC2148 to 8 pin data bus of 128*64 GLCD????
Please reply immediately or as soon as possible...... I have to summit my project within a week.

Parents
  • I have connected PO.0 - P0.7 of LPC2148 to 8 pin data bus of GLCD
    and RS, RW, EN, CS1, CS2 to P1.16 - P1.20 respectively of LPC2148.

    The code we are using....
    #include <LPC214X.H>

    #include "font.h"

    unsigned char c;
    unsigned char z=0;

    void ctrloff()
    {

    IOSET1=0x00000000; //rs=rw=en=cs1=cs2=0;
    }

    //DELAY FUNCTION
    void delay(unsigned int j)
    { int k; for(k=0;k<=j;k++) { long i; for(i=0;i<90000;i++);
    } }

    void displayon()
    { ctrloff(); IOSET0=0x0000003F; IOSET1=0x001C0000; delay(5); IOSET0=0x0000003F; IOSET1=0x000C0000;
    }

    void displayoff()
    { ctrloff(); IOSET0=0x0000003E; IOSET1=0x001C0000; delay(5); IOSET0=0x0000003E; IOSET1=0x000C0000;
    }

    void setcolumn(unsigned char y)
    { if(y<64) { ctrloff(); c=y; IOSET0=0x00000040 |(y&63); //0x40 represents Column 0 IOSET1=0x00140000; delay(5); IOSET0=0x00000040 |(y&63); IOSET1=0x00040000; } else { ctrloff(); c=y; IOSET0=0x00000040|((y-64)&63); //0x40 represents Column 0 IOSET1=0x00180000; delay(5); IOSET0=0x00000040|((y-64)&63); IOSET1=0X00080000; }
    }

    void setpage(unsigned char x)
    { ctrloff(); IOSET0=0x000000B8|x; //0xb8 represents Page 0 IOSET0=0x001C0000; delay(5); IOSET0=0x000000B8|x; //0xb8 represents Page 0 IOSET1=0x000C0000;
    }

    //Function to Scroll Strings
    void setstartline(unsigned char z)
    { ctrloff(); IOSET0=0x000000C0|z; //0xc0 represents Line 0 IOSET1=0x001C0000; delay(5); IOSET0=0x000000C0|z; //0xc0 represents Line 0 IOSET1=0x000C0000;
    }

    void lcddata(unsigned char *value,unsigned int limit)
    { unsigned int i; for(i=0;i<limit;i++) { if(c<64) { IOSET0=value[i]; IOSET1=0x00150000; delay(5); IOSET0=value[i]; IOSET1=0x00050000; c++; } else { setcolumn(c); IOSET0=value[i]; IOSET1=0x00160000; delay(5); IOSET0=value[i]; IOSET1=0x00060000; c++; } if(c>127) return; }
    }

    void lcdputs(unsigned char y,unsigned char x,unsigned char *str)
    { unsigned char i; unsigned int a; setcolumn(y); setpage(x); for(i=0;str[i]!=0;i++) { a=(*(str+i)-32); a*=5; lcddata(&font5x7[a],5); }
    }

    void clrlcd()
    { unsigned char i,j; for (i=0;i < 8;i++) { setpage(i); setcolumn(0); for (j= 0 ;j < 128; j++) lcddata(&z,1); }
    }

    unsigned char ar0[]="*************** ";
    unsigned char ar1[]="MINOR PROJECT";
    unsigned char ar2[]="ELECTRONICS AND COMMUNICATION ";
    unsigned char ar3[]="************** ";

    int main()
    { IODIR1=0xffffffff; IOCLR1=0xffffffff; IODIR0=0xffffffff; IOCLR0=0xffffffff; { unsigned char i; clrlcd(); displayon(); setcolumn(0); setpage(0); lcdputs(0,1,ar0); lcdputs(0,2,ar1); lcdputs(0,3,ar2); lcdputs(0,4,ar3); delay(65); delay(65);

    for(i=0;i<5;i++) { displayoff(); delay(65); displayon(); delay(65); delay(65); } i=0; while(1) { setstartline(i++); //Function to Scroll Strings delay(40); }
    } }

Reply
  • I have connected PO.0 - P0.7 of LPC2148 to 8 pin data bus of GLCD
    and RS, RW, EN, CS1, CS2 to P1.16 - P1.20 respectively of LPC2148.

    The code we are using....
    #include <LPC214X.H>

    #include "font.h"

    unsigned char c;
    unsigned char z=0;

    void ctrloff()
    {

    IOSET1=0x00000000; //rs=rw=en=cs1=cs2=0;
    }

    //DELAY FUNCTION
    void delay(unsigned int j)
    { int k; for(k=0;k<=j;k++) { long i; for(i=0;i<90000;i++);
    } }

    void displayon()
    { ctrloff(); IOSET0=0x0000003F; IOSET1=0x001C0000; delay(5); IOSET0=0x0000003F; IOSET1=0x000C0000;
    }

    void displayoff()
    { ctrloff(); IOSET0=0x0000003E; IOSET1=0x001C0000; delay(5); IOSET0=0x0000003E; IOSET1=0x000C0000;
    }

    void setcolumn(unsigned char y)
    { if(y<64) { ctrloff(); c=y; IOSET0=0x00000040 |(y&63); //0x40 represents Column 0 IOSET1=0x00140000; delay(5); IOSET0=0x00000040 |(y&63); IOSET1=0x00040000; } else { ctrloff(); c=y; IOSET0=0x00000040|((y-64)&63); //0x40 represents Column 0 IOSET1=0x00180000; delay(5); IOSET0=0x00000040|((y-64)&63); IOSET1=0X00080000; }
    }

    void setpage(unsigned char x)
    { ctrloff(); IOSET0=0x000000B8|x; //0xb8 represents Page 0 IOSET0=0x001C0000; delay(5); IOSET0=0x000000B8|x; //0xb8 represents Page 0 IOSET1=0x000C0000;
    }

    //Function to Scroll Strings
    void setstartline(unsigned char z)
    { ctrloff(); IOSET0=0x000000C0|z; //0xc0 represents Line 0 IOSET1=0x001C0000; delay(5); IOSET0=0x000000C0|z; //0xc0 represents Line 0 IOSET1=0x000C0000;
    }

    void lcddata(unsigned char *value,unsigned int limit)
    { unsigned int i; for(i=0;i<limit;i++) { if(c<64) { IOSET0=value[i]; IOSET1=0x00150000; delay(5); IOSET0=value[i]; IOSET1=0x00050000; c++; } else { setcolumn(c); IOSET0=value[i]; IOSET1=0x00160000; delay(5); IOSET0=value[i]; IOSET1=0x00060000; c++; } if(c>127) return; }
    }

    void lcdputs(unsigned char y,unsigned char x,unsigned char *str)
    { unsigned char i; unsigned int a; setcolumn(y); setpage(x); for(i=0;str[i]!=0;i++) { a=(*(str+i)-32); a*=5; lcddata(&font5x7[a],5); }
    }

    void clrlcd()
    { unsigned char i,j; for (i=0;i < 8;i++) { setpage(i); setcolumn(0); for (j= 0 ;j < 128; j++) lcddata(&z,1); }
    }

    unsigned char ar0[]="*************** ";
    unsigned char ar1[]="MINOR PROJECT";
    unsigned char ar2[]="ELECTRONICS AND COMMUNICATION ";
    unsigned char ar3[]="************** ";

    int main()
    { IODIR1=0xffffffff; IOCLR1=0xffffffff; IODIR0=0xffffffff; IOCLR0=0xffffffff; { unsigned char i; clrlcd(); displayon(); setcolumn(0); setpage(0); lcdputs(0,1,ar0); lcdputs(0,2,ar1); lcdputs(0,3,ar2); lcdputs(0,4,ar3); delay(65); delay(65);

    for(i=0;i<5;i++) { displayoff(); delay(65); displayon(); delay(65); delay(65); } i=0; while(1) { setstartline(i++); //Function to Scroll Strings delay(40); }
    } }

Children
  • A day later and hardly any of my questions covered.

    Do you feel like your source code would affect the ability of the boot loader to interface with Flash Magic - before the processor have run a single instruction from your application code? How did you come to that conclusion?

    By the way - can we assume that you have read the datasheets for your processor and graphics module as carefully as you read the instructions on how to post source code on this forum?

    What have you done in response to processor note for P0.2 and P0.3?

    And why do you avoid talking about voltages, despite me specifically asking?

    If the GLCD is powered by 5V, it expects at least 3.5V as logic high. The nominal supply voltage for the processor is 3.3V - what supply voltage do you use for the processor? All the way to 3.6V? And what supply voltage do you use for the GLCD? And in what order are the voltages supplied? And when will the processor be released from reset?

    Do you think people will bother to care about your issues if you don't care about giving proper answers to received questions?

  • It is clear from your posts that you don't know what you are doing.

    I will not waste any more of my time helping you.

  • It is clear from your posts that you don't know what you are doing.

    a likely cause is inability to read. TWO attempts to post code without even taking the time to read how to do it.

    Erik

  • Would we know how you have connected the display to the processor?
    - I have directly connected the display pin to the GPIO pin of LPC2148.
    Would we know if you have verified if the supply voltages are ok?
    - I have verified the supply voltage of ARM7 but not GLCD. ARM7 header board programming module having USB cable for power supply.
    Would we know what you do with the external interrupt pin used to request that you want to enter programming mode?
    - Sorry, but i didn't get this.
    Would we know if the processor have a proper reset circuit?
    - yes reset circuit is correct. i have tested this.
    Would we know what voltages you supply the processor and the GLCD with?
    - i have tested voltage supply. It is 3.6 V on the processor.
    Would we know if you have selected to use any series resistors for signals between processor or GLCD?
    - I haven't used any resistor. They directly connected without any intermediate components.
    Would we know if you have spent some time with an oscilloscope to try to deduce what differences you can see on the different processor pins when it's in reset without and with the GLCD connected?
    - I haven't tested or spent time on oscilloscope.
    What have you done in response to processor note for P0.2 and P0.3?
    - The data bus pin of GLCD are connected to the P0.2 and P0.3.

  • "Would we know what voltages you supply the processor and the GLCD with?
    - i have tested voltage supply. It is 3.6 V on the processor."

    Interesting. Are you really sure that you should power the processor with 3.6V? The nominal voltage to the processor is 3.3V and 3.6V is an "Absolute Maximum Rating" value. So instead of having 0.3V safety margin, you power the processor with a voltage where the slightest manufacturing precision of the voltage regulator or temperature drift will push the voltage outside the allowed range.

    Next thing: Didn't you notice that my question said "and the GLCD"?
    So why did you not tell us what voltages it gets?

    "Would we know if the processor have a proper reset circuit?
    - yes reset circuit is correct. i have tested this."
    How have you tested this? Was there any difference when the GLCD was connected or not? Do spend some words on actually describing what you have done instead of just giving us your conclusions. Your device doesn't work, so your conclusions may be wrong.

    "Would we know what you do with the external interrupt pin used to request that you want to enter programming mode?
    - Sorry, but i didn't get this."
    I take it then, that you haven't read the user manual for the processor, regarding the requirements for the processor to stay in the boot loader and wait for someone to upload a new firmware using Flash Magic?

    There is a full chapter covering the flash memory. One thing to note there is:

    A LOW level after reset at the P0.14 pin is considered as an external hardware request
    to start the ISP command handler.
    

    "- I haven't tested or spent time on oscilloscope."
    Any reason why? You don't own an oscilloscope? So if not - then what other tests have you done on the individual pins of the processor to compare what differs if the GLCD is connected or not?

    "Would we know if you have selected to use any series resistors for signals between processor or GLCD?"
    - I haven't used any resistor. They directly connected without any intermediate components.

    Remember that some signals are dual-direction. So if your processor happens to have the IO-pins still set as outputs when the GLCD thinks it's time to send data to the processor (which is the reason for the R/W signal) then the processor and GLCD will fight. That is a good reason to make use of a series resistor to reduce the currents involved. Another thing is that the processor pins may be 5V tolerant, but that is only when the pins do not fight with some external hardware at the same time. The datasheet mentions short-circuit currents of up to -45mA and +50mA for a single pin.

    "What have you done in response to processor note for P0.2 and P0.3?
    - The data bus pin of GLCD are connected to the P0.2 and P0.3."

    Yes - you have already told us that P0.2 and P0.3 are connected to the GLCD. But what about the note in the processor documentation about P0.2 and P0.3 that can be found in both datasheet and user manual for the processor? The note [3] for these two pins says:

    I2C Pad; 400kHz Specification; Open Drain; 5V Tolerant.
    


    Open Drain might be something for you to consider.