Shop OBEX P1 Docs P2 Docs Learn Events
SXB Example: Serial LCD - Problem using a Futurlec Parallel LCD - SARAAL LC@ — Parallax Forums

SXB Example: Serial LCD - Problem using a Futurlec Parallel LCD - SARAAL LC@

T&E EngineerT&E Engineer Posts: 1,396
edited 2008-11-10 12:27 in General Discussion
Has anyone had any problems using other HD44780 based LCDs with this SX Example?

If I use my Professional Development Board (PDB) and the Parallax Parallel LCD with this example using an SX28 and a BS2, it works fine.

The working Parallax Parallel LCD displays on the first line SERIAL LCD
The working Parallax Parallel LCD displays on the 2nd line··········· WITH SXB
and then continues with its program as it should.


However, the Futurlec Parallel LCD ( http://www.futurlec.com/LED/LCD16x2BL.shtml ) only displays:

First line: SARAAL LC@
2nd line:{nothing}

after a few seconds the screen clears and starts over - probably the rest of the program trying to run but can't.

I do have the backlight on the Futurlec LCD but that is not related.

Is there a different Display / RAM locations between different types of HD44780 based displays? I would hope not.

Has anyone seen this before or know how to fix this?

Basically - what I am trying to do is to keep the cost down and use this low cost Parallel LCD with an SX48 because I have lot's of I/O available. I have my project working already with a Parallax Serial LCD but my client wanted to see if it can be done cheaper with this Futurlec Parallel LCD. I can't believe I am the first one that has had issues with other OEM LCDs but after doing a search on the forum, I didn't really come up with anything. Do I have to use a Parallax serial LCD afterall?

Post Edited (T&E Engineer) : 11/9/2008 8:22:18 PM GMT

Comments

  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-11-09 22:56
    I have stripped down the SXB Parallel to Serial LCD program (do not need a BS2 either) - to make it easier to figure out and read.

    ' =========================================================================
    ' TEST using a Futurlec 16x2 Parallel LCD with backlight
    ' -------------------------------------------------------------------------
    ' Device Settings
    ' -------------------------------------------------------------------------
    DEVICE   SX28, OSCXT2, TURBO, STACKX, OPTIONX
    FREQ   20_000_000  'use a 20 MHz resonator 
    ID   "SLCD"
    ' -------------------------------------------------------------------------
    ' IO Pins
    ' -------------------------------------------------------------------------
    
    LcdE         PIN  RA.1    ' pull-down via 4.7K
    LcdRW        PIN  RA.2
    LcdRS        PIN  RA.3
    TRIS_Ctrl    VAR  TRIS_A
    LcdBus       PIN  RB    ' RB.0 --> DB0, ...
    TRIS_Lcd     VAR  TRIS_B
    
    ' -------------------------------------------------------------------------
    ' Constants
    ' -------------------------------------------------------------------------
    Baud   CON  "OT9600"   ' open for single wire
    ' -------------------------------------------------------------------------
    ' Variables
    ' -------------------------------------------------------------------------
    tmpW1   VAR  Word
    char  VAR Byte
    idx  VAR Byte
    ' =========================================================================
     PROGRAM Start
    ' =========================================================================
    Msg0:
      DATA "Hello ", 0          ' Up to 32 (255 max) character message, 0
    ' -------------------------------------------------------------------------
    ' Subroutine Declarations
    ' -------------------------------------------------------------------------
    DELAY    SUB  1, 2    ' delay in milliseconds
    DELAY_US SUB  1, 2    ' delay in microseconds
    BLIP     SUB  0       ' move bus to/from LCD
    LCDINIT  SUB  0       ' initialize LCD
    LCDCMD   SUB  1       ' command byte --> LCD
    LCDOUT   SUB  1       ' byteVar --> LCD
    LCD_PUT  SUB  1       ' byteVar --> LCD
    
    ' -------------------------------------------------------------------------
    ' Program Code
    ' -------------------------------------------------------------------------
    Start:
      TRIS_Ctrl = %0000     
      LCDINIT
    Main:
      char = 0  
      FOR idx = 0 TO 32           ' 32 (255 max)
       READ Msg0 + idx, char                    
       IF char = 0 THEN GoHere0                  
       LCDOUT char 
      NEXT
    GoHere0:
    DELAY 1000
      GOTO Main
    
    ' -------------------------------------------------------------------------
    ' Subroutine Code
    ' -------------------------------------------------------------------------
    ' Use: DELAY ms
    ' -- 'ms' is delay in milliseconds, 1 - 65535
    SUB DELAY
      IF __PARAMCNT = 1 THEN
        tmpW1 = __PARAM1     ' save byte value
      ELSE
        tmpW1 = __WPARAM12     ' save word value
      ENDIF
      PAUSE tmpW1
    ENDSUB
     
    ' -------------------------------------------------------------------------
    ' Use: DELAY us
    ' -- 'us' is delay in microseconds, 1 - 65535
    SUB DELAY_US
      IF __PARAMCNT = 1 THEN
        tmpW1 = __PARAM1     ' save byte value
      ELSE
        tmpW1 = __WPARAM12     ' save word value
      ENDIF
      PAUSEUS tmpW1
    ENDSUB
     
    ' -------------------------------------------------------------------------
    ' Use: LCDCMD cmdByte
    ' -- send 'cmdByte' to LCD with RS line low
    SUB LCDCMD       ' write command byte
      LcdRS = 0
      Lcd_Put __PARAM1
    ENDSUB
     
    ' -------------------------------------------------------------------------
    ' Use: LCDOUT char
    ' -- send 'char' to LCD with RS line high
    SUB LCDOUT       ' write character byte
      LcdRS = 1
      Lcd_Put __PARAM1
    ENDSUB __PARAM1
    
    ' -------------------------------------------------------------------------
    SUB Lcd_Put        ' byte --> LCD bus
      LcdBus = __PARAM1
      BLIP
    ENDSUB
     
    ' -------------------------------------------------------------------------
    SUB BLIP           ' move bus into LCD
      LcdE = 1
      DELAY_US 2
      LcdE = 0
      DELAY_US 40      ' instruction delay
    ENDSUB
    
    ' -------------------------------------------------------------------------
    ' Use: LCDINIT
    ' -- initialize LCD for 8-bit, 2-line interface
    SUB LCDINIT
      DELAY 15                 ' power-up delay, 15 ms
      TRIS_Lcd = %00000000     ' all outputs
      LcdBus = %00110000       ' 8-bit interface
      BLIP
      DELAY 5                  ' delay 4.5 ms (min)
      BLIP
      DELAY_US 100
      BLIP
      LCDCMD %00111000     ' multi-line, 5x7 font
      LCDCMD %00001100     ' display on, no cursor
      LCDCMD %00000110     ' auto-increment cursor
      LCDCMD %00000001     ' clear and home LCD
    ENDSUB
     
    

    On a Parallax Parallel LCD it displays Hello Hello Hello ...· and then carries over to the 2nd line and repeats Hello Hello ...

    On a Futurlec Parallel LCD it displays @allo @allo @allo ... and then writes over itself on the first line. Then 2nd line remains blank.

    It also appears that after the·4th character it repeats the first·4 characters over and over. For example, If the message is: 0123456789· then it displays as 0123012301

    How can 2 Hitachi HD44780 Parallel LCDs act so different?
  • JonnyMacJonnyMac Posts: 9,214
    edited 2008-11-09 23:49
    Maybe you have a bad display....
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-11-10 00:45
    Jonny Mac does it again!

    Luckily, I had another new one. I soldered on my cable and low and behold I now see:

    0123456789012345

    0123456789012345

    I guess I never thought that a new product could be bad - but it was.

    Now its time to clean up the code and get it to work in my application.

    Thanks so much!
  • mojorizingmojorizing Posts: 249
    edited 2008-11-10 01:31
    Hi Tim,
    Interesting find. This probably being a one time event as far as the failure is concerned (hopefully), how would you compare the quality of the Futurlec's display versus Parallax?

    Thanks, Kevin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-11-10 02:14
    I still have to do some tweaking but they are comparable from what I can see so far. I did have to buy a 10K mini-pot from radio shack, a couple of resistors, IDC connectors, extended waiting time for shipping from China, etc. Also keep in mind that the parallel LCDs do require quite a bit of I/O and that is one reason I am using an SX48 proto board. Still all in all for the pain it has taken me - my choice would be the Parallax serial LCD! Much easier to code and set up.
  • BeanBean Posts: 8,129
    edited 2008-11-10 12:27
    One advantage the parallel interface has it that it doesn't require strict timing. So if you have an interrupt routine it will not affect communication with a parallel LCD.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    "The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.