Thread: LCD vs Pled

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    7

    LCD vs Pled

    I have bought an Pled display from Winstar but when i replace the the LCD also winstar nothing happen.

    both HD44780 compatible

    why does the Pled not works

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    This is the wrong place to ask about such things.
    Try the Tech Board
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Indeed, so this thread has been moved.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Try adjusting the brightness
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Apr 2012
    Posts
    7
    Pled display does not use pin3 for
    brightness. It's not connected

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    an LED draws more current than an LCD. it's likely that your driver circuit can't handle the current draw. try adding a driver that can source more current.

  7. #7
    Registered User
    Join Date
    Apr 2012
    Posts
    7
    Sorry it's Oled instead of Pled

    see links
    WH1602L1-Character-WINSTAR Display Co., Ltd. (LCD)
    WEG010016B-OLED-WINSTAR Display Co., Ltd. (OLED)

  8. #8
    Registered User
    Join Date
    Apr 2012
    Posts
    7
    Hereby the code
    Code:
    ////////////////////////////////////////////////////////////////////////////
    ////                             LCDD.C                                 ////
    ////                 Driver for common LCD modules                      ////
    ////                                                                    ////
    ////  lcd_init()   Must be called before any other function.            ////
    ////                                                                    ////
    ////  lcd_putc(c)  Will display c on the next position of the LCD.      ////
    ////                     The following have special meaning:            ////
    ////                      \f  Clear display                             ////
    ////                      \n  Go to start of second line                ////
    ////                      \b  Move back one position                    ////
    ////                                                                    ////
    ////  lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1)     ////
    ////                                                                    ////
    ////  lcd_getc(x,y)   Returns character at position x,y on LCD          ////
    ////                                                                    ////
    ////////////////////////////////////////////////////////////////////////////
    #define lcd_type 2           // 0=5x7, 1=5x10, 2=2 lines
    #ifdef  LCD_16x4_lines
       #define lcd_line_1 0x00    // LCD RAM address for the first line  (16x4)
       #define lcd_line_2 0x40    // LCD RAM address for the second line (16x4)
       #define lcd_line_3 0x10    // LCD RAM address for the third line  (16x4)
       #define lcd_line_4 0x50    // LCD RAM address for the fourth line (16x4)
    #else //LCD_20x4_lines
       #define lcd_line_1 0x00    // LCD RAM address for the first line  (20x4)
       #define lcd_line_2 0x40    // LCD RAM address for the second line (20x4)
       #define lcd_line_3 0x14    // LCD RAM address for the third line  (20x4)
       #define lcd_line_4 0x54    // LCD RAM address for the fourth line (20x4)
    #endif
    // Comptible with 16,20,40x2 (default) but not for 40x4
    // *x1 or 8x2 LCD data types are NOT recommanded.
    
    byte CONST LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
                                 // These bytes need to be sent to the LCD
                                 // to start it up.
    #list
    byte lcd_read_byte() {
          byte low,high;
    #ifdef LCD_HIGH
          tris_lcd_port |= 0xf0;                 // Input High Pins
    #else
          tris_lcd_port |= 0X0f;                 // Input Low Pins
    #endif
          lcd_rw = 1;
          delay_cycles(1);
          lcd_enable = 1;
          delay_us(1);
          high = lcd_port;
          lcd_enable = 0;
          delay_cycles(2);
          lcd_enable = 1;
          delay_us(1);
          low = lcd_port;
          lcd_enable = 0;
    #ifdef LCD_HIGH
          tris_lcd_port &= 0x0f;                 // Output High Pins
    #ASM  MOVLW 0xF0
          ANDWF HIGH,F
          SWAPF LOW,W
          ANDLW 0x0F
          IORWF HIGH,F
    #ENDASM
          return(high);
    #else
          tris_lcd_port &= 0Xf0;                 // Output Low Pins
    #ASM
          MOVLW 0x0F
          ANDWF LOW,F
          SWAPF HIGH,W
          ANDLW 0xF0
          IORWF LOW,F
    #ENDASM
          return(low);
    #endif
    }
    
    void lcd_send_nibble( byte n ) {
    #ifdef LCD_HIGH
          tris_lcd_port &= 0x0f;                 // lcd_port direction = Output
          lcd_port &= 0b00001111;
    #else
          tris_lcd_port &= 0Xf0;                 // lcd_port direction = Output
          lcd_port &= 0b11110000;
    #endif
          lcd_port |= n;
          delay_cycles(1);
          lcd_enable = 1;
          delay_us(2);
          lcd_enable = 0;
    }
    
    void lcd_send_byte( byte address, byte n ) {
          byte i=0;                                   // Init 500ms. Counter for LCD Time_Out (NOT Implemented here).
          
          trisb &= 0b11100111;                        // RW and RS pins are Outputs.
          lcd_rs = 0;
          while(bit_test(lcd_read_byte(),7));
          lcd_rs = address;
          delay_cycles(1);
          lcd_rw = 0;
          delay_cycles(1);
          lcd_enable = 0;
    #ifdef LCD_HIGH
          lcd_send_nibble(n & 0xf0);                // Send High nibble...
          lcd_send_nibble(n << 4);
    #else
          lcd_send_nibble(n >> 4);                  // Send High nibble...
          lcd_send_nibble(n & 0x0f);
    #endif
    }
    
    void lcd_init() {
        byte i;
    #ifdef LCD_HIGH
        tris_lcd_port &= 0x0f;                      // Output High Pins
    #else
        tris_lcd_port &= 0Xf0;                      // Output Low Pins
    #endif
        trisb &= 0b11100111;                        // RW and RS pins are Outputs.
        delay_ms(15);
        for(i=1;i<=3;++i) {
           lcd_send_nibble(3);
           delay_ms(5);
        }
        lcd_send_nibble(2);
        for(i=0;i<=3;++i)
           lcd_send_byte(0,LCD_INIT_STRING[i]);
    }
    
    void lcd_gotoxy( byte x, byte y) {
       byte address;
       if (y == 1 || !y)                            // If y=0 or 1 chooses the first line.
          address=lcd_line_1;
       if (y == 2)
          address=lcd_line_2;
       if (y == 3)
          address=lcd_line_3;
       if (y == 4)
          address=lcd_line_4;
       address+=x-1;
       lcd_send_byte(0,0x80|address);
    }
    #separate
    void lcd_putc( char c) {
       switch (c) {
         case '\f'   : lcd_send_byte(0,1);
                       delay_ms(2);
                                               break;
         case '\n'   :
         case '\2'   : lcd_gotoxy(1,2);        break;
         case '\3'   : lcd_gotoxy(1,3);        break;
         case '\4'   : lcd_gotoxy(1,4);        break;
         case '\b'   : lcd_send_byte(0,0x10);  break;
         default     : lcd_send_byte(1,c);     break;
       }
    }
    char lcd_getc( byte x, byte y) {
       char value;
        lcd_gotoxy(x,y);
        lcd_rs=1;
        value = lcd_read_byte();
        lcd_rs=0;
        return(value);
    }
    #nolist

  9. #9
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    I suggest reading http://www.picaxe.com/docs/oled.pdf

    NOTE: The 500mS power on delay!

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  10. #10
    Registered User
    Join Date
    Apr 2012
    Posts
    7
    i have change the code, but still not OK only the upperline the lowerline on the Oled stays black

    see code
    Code:
    ////////////////////////////////////////////////////////////////////////////
    ////                             LCDD.C                                 ////
    ////                 Driver for common LCD modules                      ////
    ////                                                                    ////
    ////  lcd_init()   Must be called before any other function.            ////
    ////                                                                    ////
    ////  lcd_putc(c)  Will display c on the next position of the LCD.      ////
    ////                     The following have special meaning:            ////
    ////                      \f  Clear display                             ////
    ////                      \n  Go to start of second line                ////
    ////                      \b  Move back one position                    ////
    ////                                                                    ////
    ////  lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1)     ////
    ////                                                                    ////
    ////  lcd_getc(x,y)   Returns character at position x,y on LCD          ////
    ////                                                                    ////
    ////////////////////////////////////////////////////////////////////////////
     
    #ifdef  LCD_16x4_lines
       #define lcd_line_1 0x00    // LCD RAM address for the first line  (16x4)
       #define lcd_line_2 0x40    // LCD RAM address for the second line (16x4)
       #define lcd_line_3 0x10    // LCD RAM address for the third line  (16x4)
       #define lcd_line_4 0x50    // LCD RAM address for the fourth line (16x4)
    #else //LCD_20x4_lines
       #define lcd_line_1 0x00    // LCD RAM address for the first line  (20x4)
       #define lcd_line_2 0x40    // LCD RAM address for the second line (20x4)
       #define lcd_line_3 0x14    // LCD RAM address for the third line  (20x4)
       #define lcd_line_4 0x54    // LCD RAM address for the fourth line (20x4)
    #endif
    // Comptible with 16,20,40x2 (default) but not for 40x4
    // *x1 or 8x2 LCD data types are NOT recommanded.
     
     
    byte CONST LCD_INIT_STRING[6] = {
      0x08, //display off
      0x06, //entry mode set//need to configure this cmd or char will move left not move right
      0x17, //Character mode and internel power on (have to turn on internel power to get the best brightness)
      0x01, //clear display
      0x02, //return home
      0x0c  //display on
    };
                                 // These bytes need to be sent to the LCD
                                 // to start it up.
    #list
    byte lcd_read_byte() {
          byte low,high;
     
    #ifdef LCD_HIGH
          tris_lcd_port |= 0xf0;                 // Input High Pins
    #else
          tris_lcd_port |= 0X0f;                 // Input Low Pins
    #endif
          lcd_rw = 1;
          delay_cycles(1);
          lcd_enable = 1;
          delay_us(1);
          high = lcd_port;
          lcd_enable = 0;
          delay_cycles(2);
          lcd_enable = 1;
          delay_us(1);
          low = lcd_port;
          lcd_enable = 0;
     
    #ifdef LCD_HIGH
          tris_lcd_port &= 0x0f;                 // Output High Pins
    #ASM  MOVLW 0xF0
          ANDWF HIGH,F
          SWAPF LOW,W
          ANDLW 0x0F
          IORWF HIGH,F
    #ENDASM
          return(high);
    #else
          tris_lcd_port &= 0Xf0;                 // Output Low Pins
    #ASM
          MOVLW 0x0F
          ANDWF LOW,F
          SWAPF HIGH,W
          ANDLW 0xF0
          IORWF LOW,F
    #ENDASM
          return(low);
    #endif
    }
     
     
    void lcd_send_nibble( byte n ) {
     
    #ifdef LCD_HIGH
          tris_lcd_port &= 0x0f;                 // lcd_port direction = Output
          lcd_port &= 0b00001111;
    #else
          tris_lcd_port &= 0Xf0;                 // lcd_port direction = Output
          lcd_port &= 0b11110000;
    #endif
          lcd_port |= n;
          delay_cycles(1);
          lcd_enable = 1;
          delay_us(2);
          lcd_enable = 0;
    }
     
     
    void lcd_send_byte( byte address, byte n ) {
          byte i=0;                                   // Init 500ms. Counter for LCD Time_Out (NOT Implemented here).
     
          trisb &= 0b11100111;                        // RW and RS pins are Outputs.
          lcd_rs = 0;
          while(bit_test(lcd_read_byte(),7));
          lcd_rs = address;
          delay_cycles(1);
          lcd_rw = 0;
          delay_cycles(1);
          lcd_enable = 0;
    #ifdef LCD_HIGH
          lcd_send_nibble(n & 0xf0);                // Send High nibble...
          lcd_send_nibble(n << 4);
    #else
          lcd_send_nibble(n >> 4);                  // Send High nibble...
          lcd_send_nibble(n & 0x0f);
    #endif
    }
     
     
    void lcd_init() {
        byte i;
     
    #ifdef LCD_HIGH
        tris_lcd_port &= 0x0f;                      // Output High Pins
    #else
        tris_lcd_port &= 0Xf0;                      // Output Low Pins
    #endif
     
        trisb &= 0b11100111;                        // RW and RS pins are Outputs.
        delay_ms(15);
        for(i=1;i<=3;++i) {
           lcd_send_nibble(3);
           delay_ms(5);
        }
        lcd_send_nibble(2);
        for(i=0;i<6;++i)
           lcd_send_byte(0,LCD_INIT_STRING[i]);
    }
     
     
    void lcd_gotoxy( byte x, byte y) {
       byte address;
     
       if (y == 1 || !y)                            // If y=0 or 1 chooses the first line.
          address=lcd_line_1;
     
       if (y == 2)
          address=lcd_line_2;
     
       if (y == 3)
          address=lcd_line_3;
     
       if (y == 4)
          address=lcd_line_4;
     
       address+=x-1;
       lcd_send_byte(0,0x80|address);
    }
     
    #separate
    void lcd_putc( char c) {
     
       switch (c) {
         case '\f'   : lcd_send_byte(0,1);
                       delay_ms(2);
                                               break;
         case '\n'   :
         case '\2'   : lcd_gotoxy(1,2);        break;
         case '\3'   : lcd_gotoxy(1,3);        break;
         case '\4'   : lcd_gotoxy(1,4);        break;
     
         case '\b'   : lcd_send_byte(0,0x10);  break;
         default     : lcd_send_byte(1,c);     break;
       }
    }
     
    char lcd_getc( byte x, byte y) {
       char value;
     
        lcd_gotoxy(x,y);
        lcd_rs=1;
        value = lcd_read_byte();
        lcd_rs=0;
        return(value);
    }
    #nolist
    Last edited by Hendrik; 04-19-2012 at 02:39 AM.

  11. #11
    Registered User
    Join Date
    Apr 2012
    Posts
    44
    yeh try brightness

  12. #12
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    In the function lcd_init, I failed to see where you added the 500mS delay.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  13. #13
    Registered User
    Join Date
    Apr 2012
    Posts
    7
    Quote Originally Posted by stahta01 View Post
    In the function lcd_init, I failed to see where you added the 500mS delay.

    Tim S.
    i don't know where to put the 500ms delay

  14. #14
    Registered User
    Join Date
    Apr 2012
    Posts
    7
    Still no solutions

  15. #15
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    The solution most likely is that you need to wait 500ms the first thing you do after power-on. At least that's what the manual says and what has been said in this thread. Do you know where the initialization function starts and do you know how to wait 500 ms? Have you tried it?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed