Shop OBEX P1 Docs P2 Docs Learn Events
BS2p24/BOE and LCD Terminal AppMod — Parallax Forums

BS2p24/BOE and LCD Terminal AppMod

Mike GMike G Posts: 2,702
edited 2006-10-27 15:26 in BASIC Stamp
I'm having a problem using the LCD Terminal Appmod with a BS2p24. Even the LCD_AppMod_Demo.BS2 found on the LCD Terminal Appmod page is not functioning properly. However, if I use the BS2 the LCD functions as expected. BTY not functioning means Blackish squares where chars should be. Yes, I tried adjusting the contrast POT cool.gif


Test code (from PBASIC help)



' {$STAMP BS2p}
' {$PBASIC 2.5}



Init_LCD:
PAUSE 1000 ' allow LCD to power-up
LCDCMD 1, 48 ' Send wake-up sequence (3x)
PAUSE 5
LCDCMD 1, 48
PAUSE 1
LCDCMD 1, 48
PAUSE 1
LCDCMD 1, 32 ' Set data bus to 4-bit mode
LCDCMD 1, 40 ' Set 2-line mode with 5x8 font
LCDCMD 1, 8 ' Turn display off
LCDCMD 1, 12 ' Turn display on without cursor
LCDCMD 1, 6 ' Auto-increment cursor
LCDCMD 1, 1 ' Clear the display



Main:
GOSUB Init_LCD - Oops - should have removed this line
LCDOUT 1, 1, [noparse][[/noparse]"Hello World!"]
STOP



Thanks a bunch

Mike

Post Edited (Mike Gebhard) : 10/26/2006 11:53:26 PM GMT

Comments

  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-10-26 12:03
    Mike Gebhard said...
    I'm having a problem using the LCD Terminal Appmod with a BS2p24. Even the LCD_AppMod_Demo.BS2 found on the LCD Terminal Appmod page is not functioning properly. However, if I use the BS2 the LCD functions as expected. BTY not functioning means Blackish squares where chars should be. Yes, I tried adjusting the contrast POT cool.gif


    Test code (from PBASIC help)



    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}



    Init_LCD:
    PAUSE 1000 ' allow LCD to power-up
    LCDCMD 1, 48 ' Send wake-up sequence (3x)
    PAUSE 5
    LCDCMD 1, 48
    PAUSE 1
    LCDCMD 1, 48
    PAUSE 1
    LCDCMD 1, 32 ' Set data bus to 4-bit mode
    LCDCMD 1, 40 ' Set 2-line mode with 5x8 font
    LCDCMD 1, 8 ' Turn display off
    LCDCMD 1, 12 ' Turn display on without cursor
    LCDCMD 1, 6 ' Auto-increment cursor
    LCDCMD 1, 1 ' Clear the display



    Main:
    GOSUB Init_LCD
    LCDOUT 1, 1, [noparse][[/noparse]"Hello World!"]
    STOP



    Thanks a bunch

    Mike

    The code is a little mixed up - no return from the Subroutine Init_LCD - and the main code was after the sub so as you presented it, it would go through the Init_LCD code, fall into Main when the Init_LCD is called again (without a return), etc.

    A couple of other observations,
    - there are distinctly different commands when using the BS2 vs BS2P - the code you used and the code below are for BS2P
    - LCDCMD for BS2P family
    - PULSOUT for BS2
    - the statement #DEFINE _LcdReady = ($STAMP = BS2P) OR ($STAMP = BS2PE) is key as it determines which to use based on the $STAMP definition

    - you may need to allow for Proc speed vs. LCD speed via PAUSESes (I'm not sure as I have been working exclusively with Serial LCD's.

    Try this (on your BS2P:

    
    ' {$STAMP BS2P}
    ' {$PBASIC 2.5}
    
    #SELECT $STAMP
       #CASE BS2, BS2E
         LCD_Pause CON 10  
       #CASE BS2SX, BS2P, BS2PE
         LCD_Pause CON 20
    #ENDSELECT
    
    #DEFINE _LcdReady = ($STAMP = BS2P) OR ($STAMP = BS2PE) 
     
    Main:
      #IF NOT _LCDReady #THEN
        DEBUG CR, "Commands for BS2 not implemented - please use BS2P", CR, CR
        END
      #ENDIF
      GOSUB Init_LCD
      LCDOUT 1, 1, [noparse][[/noparse]"Hello World!"]
      STOP
    
    Init_LCD:
      PAUSE 1000                            ' allow LCD to power-up
      LCDCMD 1, 48                          ' Send wake-up sequence (3x)
      PAUSE LCD_Pause
      LCDCMD 1, 48
      PAUSE LCD_Pause
      LCDCMD 1, 48
      PAUSE LCD_Pause
      LCDCMD 1, 32                          ' Set data bus to 4-bit mode
      LCDCMD 1, 40                          ' Set 2-line mode with 5x8 font
      LCDCMD 1, 8                           ' Turn display off
      LCDCMD 1, 12                          ' Turn display on without cursor
      LCDCMD 1, 6                           ' Auto-increment cursor
      LCDCMD 1, 1                           ' Clear the display
      PAUSE LCD_Pause
      RETURN
     
    
    

    Post Edited (Paul Sr.) : 10/26/2006 12:49:05 PM GMT
  • Mike GMike G Posts: 2,702
    edited 2006-10-26 13:50
    Thanks Paul,
    Your right I should have removed the sub call from main.· That was a mistake when I pasted into the forum.· The original was
    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}


    Main:
    · GOSUB Init_LCD
    · LCDOUT 1, 1, [noparse][[/noparse]"Hello World!"]
    · STOP

    Init_LCD:
    · PAUSE 1000··························· ' allow LCD to power-up
    · LCDCMD 1, 48························· ' Send wake-up sequence (3x)
    · PAUSE 5
    · LCDCMD 1, 48
    · PAUSE 1
    · LCDCMD 1, 48
    · PAUSE 1
    · LCDCMD 1, 32························· ' Set data bus to 4-bit mode
    · LCDCMD 1, 40························· ' Set 2-line mode with 5x8 font
    · LCDCMD 1, 8·························· ' Turn display off
    · LCDCMD 1, 12························· ' Turn display on without cursor
    · LCDCMD 1, 6·························· ' Auto-increment cursor
    · LCDCMD 1, 1·························· ' Clear the display
    REturn·

    Your code and the code above does not display "Hello World" when using a BS2p24/BOE and LCD Appmod revision A.· I can get the display working if I use·use a BS2.· Even the LCD_AppMod_Demo.BS2 found on the·LCD Terminal Appmod page is not functioning properly.· However, if I use a BS2/BOE·the LCD functions as expected.
    The attached code function perfectly with a BS2\LCD and was working on a BS2p\LCD.· To make matter worse, I've had many different LCD Terminal Appmods on several different projects.· So I'm not sure if this particular LCD ever functioned properly with a BS2p since it was attached to a BS2 project.
    Thanks,
    Mike
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-26 14:06
    Mike,
    ·
    ·· I can confirm that the following code works on our LCD AppMod on a BS2p24 as I just tested it now.· Try the attached file and see if that works for you.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Mike GMike G Posts: 2,702
    edited 2006-10-26 23:51
    Sorry Chris...
    The attached LcdAppmodDemo.BS2 is not working with my BS2p24/BOE - LCD Terminal Appmod setup. However, if I swap the BS2p for a BS2 it works fine confused.gif

    Thanks,
    Mike
  • Mike GMike G Posts: 2,702
    edited 2006-10-27 01:41
    Hey Chris,

    I found another LCD Terminal Appmod lying around plugged it in and it has the same problem. It works with a BS2 and not the BS2p24 using "LcdAppmodDemo.BS2".
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-27 03:39
    Mike,
    ·
    ·· This is strange, indeed!· I cannot reproduce your results at Parallax with the same exact hardware and software…What sort of power supply are you running this from?· I know it’s grasping, but something has to be the cause.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-10-27 12:34
    Another stretch - and don't be offended - you ARE changing the {$STAMP BS2} directive accordingly when you switch processors aren't you?
  • Mike GMike G Posts: 2,702
    edited 2006-10-27 14:06
    Yes, the tokenizer prompts when it finds a STAMP {directive mismatch}.

    I can send you my LCD/BS2p/BOE if you like.

    Mike
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-27 15:26
    Mike,
    ·
    ·· Contact me via e-mail regarding that.· My address is in the E-Mail icon to the left.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.