Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Serial LCD 2 rows x 16 characters, Non-back lit, with Piezospeaker (#27976) — Parallax Forums

Parallax Serial LCD 2 rows x 16 characters, Non-back lit, with Piezospeaker (#27976)


Already did the self test. It works.

Here's manual link.

https://www.parallax.com/sites/default/files/downloads/27979-Parallax-Serial-LCDs-Product-Guide-v3.1.pdf

What difference does it make what baudrate you run it at?

We lean towards the slow speed.

Here are the speeds.

"You have three choices: 2400, 9600, and 19,200 baud."

Comments

  • kwinnkwinn Posts: 8,697

    What difference does it make what baudrate you run it at?

    "You have three choices: 2400, 9600, and 19,200 baud."

    None, other than how fast the screen updates, as long the data rate matches the LCD settings.
  • The various Basic Stamp models have limits on the maximum Baud they reliably can handle. For the BS1, it's 2400 Baud. For the BS2, it's 9600 Baud. For the BS2p series, it's 19200 Baud. Generally, they can transmit faster than they can receive and using the "formatters" adds additional overhead limiting the maximum rate. Unless you're using a BS1 or other slow microcontroller, stick with 9600 Baud.

  • Thank you kwinn and Mike

    "None, other than how fast the screen updates, as long the data rate matches the LCD settings. "

    Will do.

    " For the BS1, it's 2400 Baud. For the BS2, it's 9600 Baud. For the BS2p series"

    Good info. BS2p series. That is a good one. p24 p40 and px.

  • microcontrolleruser,

    Make sure that the baud rate you select on the LCD and the baud rate in your program are the same otherwise you might get garbage or nothing.

  • Thank you Genetix

    Mismatching the baudrates sounds kind of fun really.

    For future troubleshooting it might be a good idea to see how that problem looks.

    Long as it does not damage anything.

  • Next up in manual is running this code.
    ' {$STAMP BS2} 
    ' {$PBASIC 2.5} 
    TxPin         CON    0 
    Baud19200    CON    32 
      HIGH TxPin  
                  ' Set pin high to be a serial port 
      PAUSE 100                 ' Pause for Serial LCD to initialize 
      SEROUT TxPin, Baud19200, ["Hello, this text will wrap."]
    

    Just putting the text string in square brackets sends it to the LCD?

    Of course there is the SEROUT command there too. Will read Help in editor for that command.
  • microcontrolleruser,

    No, it's not fun!
    Sooner or later you run into a device that either has an odd baud rate or that you don't know what baud rate it uses.

    Look at the table of baudrate values for SEROUT in the BASIC Stamp Manual (page 423) and keep the same baud rate speed but use something else.
    Try Inverted instead of True or 7-bit even-parity instead of 8-bit no-parity.
  • The LCD uses 8-bit no-parity. The Stamp sends a start bit (0), 8 data bits, and a stop bit (1). This is what the LCD expects. The resting (idle) state of the I/O pin is 1 (true mode). If you use RS232 drivers, this signal gets inverted at the sending end, then inverted again at the receiving end. You can often use a Stamp I/O pin to transmit to an RS232 device even though the voltage levels aren't quite right. In this case, the Stamp has to do the inversion in software ... that's inverted mode. The Manual discusses this and shows how to do it on the receiving end as well (SEROUT and SERIN chapters).
  • Mike Green wrote: »
    The LCD uses 8-bit no-parity. The Stamp sends a start bit (0), 8 data bits, and a stop bit (1). This is what the LCD expects. The resting (idle) state of the I/O pin is 1 (true mode). If you use RS232 drivers, this signal gets inverted at the sending end, then inverted again at the receiving end. You can often use a Stamp I/O pin to transmit to an RS232 device even though the voltage levels aren't quite right. In this case, the Stamp has to do the inversion in software ... that's inverted mode. The Manual discusses this and shows how to do it on the receiving end as well (SEROUT and SERIN chapters).

    I can't add anything to that, but I will:
    The board for the LCD responds rather well, regardless of which Stamp I used it will display characters properly. The only thing I can further add is to adhere to the flow of instructions used by the examples when setting things up.
    ----
    And this message is being sponsored by the Big Foot watcher community, proudly watching people in NoCal for the past many years, when not playing Chess with their Yeti family members.
  • Buck,

    That is to be expected since the LCD has no idea what device it will be connected to.
    I would expect it to work fine with a PC or a different microcontroller such as an Arduino.

    microcontrolleruser,

    In that little segment of code that you posted just remember that the LCD only has 16 characters to a line so anything more will not be displayed.
    Also, the constant 32 that is used by SEROUT is not in the tables on page 423 but it shows up on pages 433 and 434 with values that are.
    32 is listed at 19.2K and 84 as T9600.
    On page 423, 84 is listed as 9600 baud, 8 bit, no parity, true so that would make 32 as 19.2K (19,200 baud), 8 bit, no parity, true.
    If you look at the bottom of page 422 you will see a set of formulas to determine this constant value.
    Also notice the last setting is for driven or open but since the constants are small it must be using driven.
    So using the formula for the BS2:
    INT(1,000,000 / baud rate) – 20 = INT(1,000,000 / 19,200) - 20 = INT(52.08333...) - 20 = 52 - 20 = 32
    INT means that we only keep the integer or whole number part and drop the decimal part.

    I myself like to comment everything that the SERIN/OUT constants control since sometimes you need different modes.
  • microcontrollerusermicrocontrolleruser Posts: 1,194
    edited 2018-11-20 06:23
    Thank you Genetix Mike and Buck

    Ran the code above from manual.

    Worked as expected.

    That lesson was called "Displaying Text".

    Tomorrow morning will run next lesson called "Custom Characters".

    Here is the code.
    ' {$STAMP BS2} 
    ' {$PBASIC 2.5} 
    TxPin         CON    0 
    Baud19200    CON    32 
      HIGH TxPin  
                                ' Set pin high to be a serial port 
      PAUSE 100                               ' Pause for Serial LCD to initialize 
      SEROUT TxPin, Baud19200, [250]  
           ' Define custom character 2 
                                       ' Now send the eight data bytes 
      SEROUT TxPin, Baud19200, [%00000]     ' %00000 = 
      SEROUT TxPin, Baud19200, [%00100]     ' %00100 = * 
      SEROUT TxPin, Baud19200, [%01110]     ' %01110 = * * * 
      SEROUT TxPin, Baud19200, [%11111]     ' %11111 = * * * * * 
      SEROUT TxPin, Baud19200, [%01110]     ' %01110 = * * * 
      SEROUT TxPin, Baud19200, [%00100]     ' %00100 = * 
      SEROUT TxPin, Baud19200, [%00000]     ' %00000 = 
      SEROUT TxPin, Baud19200, [%00000]     ' %00000 = 
      SEROUT TxPin, Baud19200, [2]          ' Display the new custom character 2
    

    This is from manual.

    "The Serial LCDs should be powered from an extern
    al regulated 5 V power supply. Make sure the power
    supply has an adequate current rating to power the
    Serial LCD and the BASIC Stamp, Propeller chip, or
    whichever microcontroller and other devices you are using. "

    Anybody think that 5v sounds like the way to power a circuit or breadboard not a Parallax dev board?

    That would be power coming straight from the 5v power supply in to your micro circuit or breadboard no regulator.

    Power supply to a Parallax dev board should be a few volts above it's 5v regulated onboard voltage.


  • microcontrolleruser,

    Wow, 1000 posts!

    The Propeller runs at 3.3V so there needs to be a resistor between the I/O pin and LCD.
    5V is too much for the Propeller but not for the Stamp or a breadboard.

    Also note that with the backlight on the LCD needs about 80 mA otherwise it just needs 20 mA.

  • Genetix

    "Wow, 1000 posts!"

    Oh. It's just my way of supporting Parallax in some little way.

    "5V is too much for the Propeller but not for the Stamp or a breadboard."

    What I meant was the manual sounds like it wants you to power the LCD with a 5v power supply.

    Like the one we use for soldered up dev boards and breadboard controller circuits.

    Manual does not say word one about using LCD with any of the Parallax dev boards.

    I kind of like it. Keeps things simple.


  • Completed running the BS2 example code programs.

    Up next are the Propeller programs.

Sign In or Register to comment.