BS2 to serial LCD 4 x 20 board.
sracing
Posts: 5
in BASIC Stamp
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
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
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
" 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
So, any more advice to this newby?
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
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.
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.