BS2 to serial LCD 4 x 20 board.

I think a simple answer is available? Not familiar with the Arduino code yet. Ok, with Pbasic. :

Trying to run a LCD with a serial IC board. (MPJ 4 x 20) I have down loaded Arduino files to a UNO board and I works the display no problem. I have written PBASIC stuff to work the Parallax serial LCD with no problem.

No success with PBASIC to the MPJ board. ( https://www.mpja.com/download/35054opdata.pdf ) I have run the "scanner" Arduino program and have found the board "address" 0x27. Then used example Arduino programs to easily write to the LCD. With PBASIC I think the issue is the address required to send to the board ? Not real familiar with the code in Arduino I cant see where and when I put the 0x27 into the data stream to get the LCD to work.

Simplified here is my code :

SEROUT TX, LcdBaud, [LcdBLoff, LcdOn1, LcdCls]
PAUSE 250
SEROUT TX, LcdBaud, ["THE BASIC STAMP"]

Somewhere I assume I have to send the 0x27 ?

This seems simple but I am confused?

YES, I know it's easier without the serial board, but I am low on pins and don't want to run 6 foot of cable from my LCD to the STAMP board. Also is there an easy way to cripple the address requirement on the serial board?

Thanks
Jim

Comments

  • All of those Pbasic commands work with the parallax LCD. Take a look at the parallax LCD data sheet. And the C simple ide for the parallax display.
  • This is not a Parallax display with serial. It is the MPJ one described above. It requires the 0x27 address. I have used a Parallax board OK, but apparently it doesn't use the address.

    Here is the Arduino code I used and it works fine. It appears to me that i need the address in my PBASIC data. I am not sure how I do that. Maybe I didn't understand your answer?

    #include "Wire.h"
    #include "LCD.h"
    #include "LiquidCrystal_I2C.h"
    #include "NewPing.h"

    #define I2C_ADDR 0x27 // Add your address here.
    #define Rs_pin 0
    #define Rw_pin 1
    #define En_pin 2
    #define BACKLIGHT_PIN 3
    #define D4_pin 4
    #define D5_pin 5
    #define D6_pin 6
    #define D7_pin 7


    LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

    void setup()
    {
    lcd.begin (20,4); // our LCD is a 20x4, change for your LCD if needed

    // LCD Backlight ON
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);

    lcd.home (); // go home on LCD
    lcd.print ("Hello world");
    }

    Jim

  • From the data sheet, it looks like an I2C, not serial, device.
  • sracingsracing Posts: 5
    edited 2020-06-12 - 18:10:06
    Huh?

    " Serial LCD for Arduino
    LCM2004 LCD using Serial I2C/SPI communication
    with microcontroller. Installed Backpack board with the PCF8574 chip. "

    Works fine using Arduino SERIAL connections.. The IC2 IS a serial back board for the LCD.

    Jim
  • tomcrawfordtomcrawford Posts: 1,082
    edited 2020-06-12 - 20:17:31
    I stand corrected. But, if it is configured for serial, the I2C address ought to be irrelevant.
  • ? I THINK that is the purpose of the address. Like with most serial devices you can attach multiples on the same pin(s) and select which you are sending data to. Those not addressed will ignore the data. (Which appears to be exactly what mine is doing.) It requires the 0x27 somewhere/sometime in it's data steam. The standard serial Parallax serial LCD does not use an address. (So you can't put multiples on the same pin(s). I was sure someone would be using PBASIC with one of these serial boards and would know what the data stream should look like. I could be wrong in total, but so far this is what it looks like to me. As I said it works fine with Arduino sample sketches, but not with any PBASIC I can or write. (Except to the Parallax versions that don't use the address.)

    So, any more advice to this newby?
  • I2C doesn't work on the BS2 only the BS2P etc. So you will have to stay with SPI. The 0x27 is used in I2C, but try 0x3F just for kicks. I don't have a serial MPJA LCD to try it out.
  • Ignore
  • I2COUT
  • sracingsracing Posts: 5
    edited 2020-06-13 - 02:03:53
    Thanks DigitalBob,

    I ran a Arduino scan sketch and it did respond with 0x27 as the address so I think that is OK.
    I think you are correct re: the processor. I do have a BS2P, so I can put it in the same board? Then PIN 0 provides the clocking (SCL) ? and data is SDA? I will have to look at the BS2P chip. It has other additional functions? Thanks for your help. Will let you know how that works out.

    {EDIT}
    I will try to use my BS2P24 only because this thing bugs me. I think I will just get a Parallax 27979 (4 x 20) as the final solution since it works with the BS2 and it's a cheaper route.

    Jim


  • JonnyMacJonnyMac Posts: 6,737
    edited 2020-06-13 - 16:20:40
    I tend to focus on the Propeller, so I am late to this thread.

    Whomever wrote that documentation for MPJA should be throttled. Full stop. That display is I2C; not serial, not SPI (terms used in the docs). My techno-monster side would say, "But, Jon, I2C is a form of serial -- it's synchronous serial." While technically correct, it's not practical because we associate the term "serial" with asynchronous serial coms.

    The schematic for the interface shows the PCF8574; this chip uses I2C coms. Not [asynchronous] serial. Not SPI. Just I2C.
    I2C doesn't work on the BS2 only the BS2P etc.
    The BS2P series has I2C commands built in. That said, you can in fact "bit bang" I2C with a stock BS2 using a little code. You can find that in my StampWorks book

    Given the opportunity, seek clarity -- beware meaningless accuracy. Technically, asynchronous serial, I2C, and SPI are all forms of serial communications. For clarity, though, we refer to them as serial, I2C, and SPI.
Sign In or Register to comment.