Basic Stamp 2 Memory
microcontrolleruser
Posts: 1,194
in BASIC Stamp
I am going by the Help in Basic Stamp Editor here.
There is virtually no match up between Pbasic and PIC assembler with these instructions.
Should I just stop looking and just go with first Pbasic instruction I find that does 'what I want it to do"?
Saw something about a 16 bit word in Help. No. None of that with the PIC16F54 that stamp is made from.
Comments
Thanks Mike
Okay. Armed with that viewpoint I will putter around with some of this hardware here.
Is that Parallel I/O set of instructions what I think it is?
For using the old 14 pin LCD?
If so that is just what we need.
How about this?
Hook up the 14 pin LCD, run one of the instructions and see if it does anything.
We'll figure it out. Thanks anyhow.
You can't use the LCD in 8-bit mode because you will not have I/O pins to control the signals.
If you look at BS1 Application Notes, you will see if you use 4-bit mode then the LCD will use 6 pins and you will only be left with 2.
Serial LCDs cost more but they only need 1 I/O pins so you have 5 more pins that you can do other stuff with.
These typical use a microcontroller to control the LCD and receive commands from whatever device it's hooked up to.
Nuts and Volts #31 also uses the LCD in 4-bit mode.
Nuts and Volts #32 uses a 595 to save I/O pins and it also has code for other size LCDs since surplus modules may not be 16x2.
The 595 uses half the I/O pins and you can get modules with a 595 on it or buy a "backpack" that attaches to the back of the LCD.
Nuts and Volts #40 uses a 164 to save Input pins which might come in handy later.
Nuts and Volts #43 uses a 165 also saves input pins by taking Parallel inputs and making them Serial.
All of the above are in Volume #1.
Nuts and Volts #110 (Volume 5) uses a 595 to control 8 LEDs.
Volume #6
Nuts and Volts #119 uses a Ping Ultrasonic sensor and #120 uses an RFID Reader.
Nuts and Volts #126 uses a ULN2003 to make an electronic candle.
Nuts and Volts #135 (Volume #7) deals with Advanced BS1 Programming.
Thank you Genetix
Here's pic of 16X2 14 pin LCD
Here's dataheet
http://www.futurlec.com/LED/LCD16X2.shtml
It may be same as Parallax 14 pin LCD from way back.
Parallax one came with cable and single inline connector for breadboard.
This is from Basic Stamp Editor/Help menu/PBasic Language Reference/Commands by category/Paralllel I/O
Nuts and Volts #77 (Volume 3) has a diagram with all the LCD pins and it matches the link that you provided.
#80 and #87 use a BS2p with an LCD.
#109 (Volume 5) has an LCD connected to a BS2p through and I2C I/O expander so only 2 pins are needed; it uses the BS2p's I2C commands.
You will find all the BASIC Stamp commands and other information including examples in the BASIC Stamp Manual.
For the BS2, StampWorks is one of the best resources on programming and hooking up devices.
Most of the articles and books use the BS2.
I started with the BS2 and it's a great learning tool but the Propeller is so much better and a lot more versatile.
The Propeller can be programmed in Assembly, C, Forth, PropBASIC, and my favorite Spin which is a lot more powerful PBASIC-like language.
Genetix
Could I get you to slow down a little please?
I can only do one thing at a time.
Do the Pbasic programs have subroutines for each letter, A-Z and 0-9?
Is there an LCD sample program in Stamp Editor or Stamp Editor Help?
Most of the code for doing what you want is in the Parallax 2x16 LCD documentation.
https://www.parallax.com/downloads/2x16-parallel-lcd-product-documentation
https://www.parallax.com/downloads/2x16-parallel-lcd-basic-stamp-sample-code
The problem is that there isn't enough room on the display for everything that you want.
The display is 32 characters but is takes 36 to display both numbers and letters.
The programs are easy to change if you wanted to display just numbers or letters but not both.
Change the text inside the quotes in the EEPROM DATA section of the program to either all of the letters or all of the numbers.
Then in the PROGRAM CODE section of the program, change the ending value of the FOR from 27 to 25 if using letters or 9 if using numbers.
Just be sure to wire the LCD using the schematic on Page 2 or the code won't work.
Thank you!
"Most of the code for doing what you want is in the Parallax 2x16 LCD documentation."
THAT is what we were trying to think of!
"The problem is that there isn't enough room on the display for everything that you want.
The display is 32 characters but is takes 36 to display both numbers and letters."
Sorry. No that is not what I meant.
We have an assembler lesson coming up for Alpha Numeric Display (old name for LCD display).
Just want to relate this to PBasic way.
Genetix
Thank you for the LCD link!
That's the old 14 pin Parallel LCD.
Just what we were looking for.
We will just use the Serial LCD and look at the Pbasic 'Commands'.
Load the code for this LCD in editor.
https://www.parallax.com/product/27977
Hook up hardware. Our LCD may be non-backlit one.
Stare at code. Adjust to Pbasic commands. Including what is going on with memory registers.
Will have questions at that point.
#1 BASIC is a high-level language while Assembly works at the hardware level.
#2 The way the exercise wants you to write your program may be great for learning but it's extremely wasteful if you try to apply it.
#3 What exactly are you trying to do because PBASIC programming has few similarities with Assembly?
Also the commands will vary from chip to chip so you may have to do things differently on another device.
If you want to know all the gritty details then look at the Hitachi HD44780 datasheet because it's all in there except for code examples.
"There is no direct correspondence between PIC suggestions for driving the LCD vs. PBasic suggestions. "
Using Pbasic as is will be fine.
Thank you Genetix
"What exactly are you trying to do because PBASIC programming has few similarities with Assembly?"
I will settle for just doing the LCD experiments both ways. Albeit the PIC one is aways in the future. Doing inputs now.
Will do Stamp 2 sample code for non-backlit LCD.
I will probably get in trouble for saying this but it sounds like the Arduino may be a better fit for you.
You can get Arduino boards, sensor modules, and code all over the place.
I just purchased an Arduino starter kit recently so I can look at and run other people's code.
The Arduino uses C which is not my favorite language but the libraries make it very easy to write applications.
Could somebody explain this program please?
What is going to do?
Thanks Mike
" What don't you understand after looking at the program and its comments?"
Why it is all over the place with what it is doing.
Here. The code in this manual is more what I was expecting.
https://www.parallax.com/sites/default/files/downloads/27979-Parallax-Serial-LCDs-Product-Guide-v3.1.pdf
Here's one of two snippet codes from manual.
What don't you understand about using the LCD? There's more than enough documentation and code samples available, maybe not as well organized as you might want and in one place for what's essentially an obsolete product.
Your LCD is PARALLEL so any serial code will not work as is.
StampWorks has a whole chapter on using a Parallel LCD (p. 83) which uses much of the same information as Nuts and Volts #31 and 32.
https://www.parallax.com/downloads/stampworks-experiment-kit-manual
https://www.parallax.com/downloads/stampworks-basic-stamp-source-code
The code you use depends on which BASIC Stamp module you are using and is it a BS!, BS2, BS2sx, or a BS2p?
The code in StampWorks and in the Nuts and Volts articles follows the Hitachi HD44780 Chipset datasheet.
https://www.parallax.com/downloads/hitachi-hd44780-chipset-datasheet
And if you look on the Internet you will find code and very detailed explanations on how to use the HD44780.
Most LCDs use an HD44780 or an equivalent chip.
Serial LCDs have a microcontroller that acts as a 'bridge' between your uC and the HD44780 so that is why the code is much simpler.
The current Parallax Serial LCD has a small piezo speaker on it and there is a command to play tones from it; plain LCDs can't do this.
Thank you Genetix
"Your LCD is PARALLEL so any serial code will not work as is."
The LCD we already have is serial 27976.
The one on the way (soon) is bare one with pin header soldered on back.
Thank you Mike
"What don't you understand about using the LCD? There's more than enough documentation and code samples available"
While I'm waiting for parallel LCD I will run code on serial LCD we have.
When parallel one gets here will run Pbasic code on that one.
We have enough info on serial LCD.
I don't want to dig into Pbasic code right now.
Just run the samples and get an overview.
This text uses the Serial LCD and only the Hitachi HM55B compass is no longer available.
https://www.parallax.com/downloads/smart-sensors-and-applications-text
https://www.parallax.com/downloads/smart-sensors-code-and-spreadsheet
Chapter 1 is on the Serial LCD and Chapter 7 displays sensor data from the Ping ultrasonic sensor and the Memsic Accelerometer.
Parallax still sells the Ping and Memsic if you want to do most of the chapters.
https://www.parallax.com/product/28015
https://www.parallax.com/product/28017
Chapter 4 is on the Hitachi HM55B Compass Module which hasn't been available in years but might be on ebay.
Ours has the speaker on the back but it is not backlit like one sold now.
There is a note in manual about with or without speaker which code to use or something . About revisions.
Thank you for looking up all the manuals or documents.
Will get out a Homework board and connect up LCD.
Have Homework board and LCD on the workbench.
Any tips on how the pins are on power up?
Which is the equivalent of configuration on PIC only user does not do anything because Parallax did it already for you.
Still in process of looking all that up.
Will say Stamp 2 module uses PIC16F57 SSOP 28 pin device.
As PIC it has 20 I/O pins 4 PORTA, 8 PORTB and 8 PORTC.
ICSPDAT and ICSPCLK on are two of the pins, rest are available. Will look at Stamp2 module schematic.
Now it's getting fun!
You have to look at Parallax data sheets, not PIC. What is at the pins on a BS.. is up to what Parallax wanted to put there.
Thanks Publison
Here's manual for serial homework board. No schematic.
Where is the schematic for it?
https://www.parallax.com/sites/default/files/downloads/555-28188-HomeWork-Board-USB-Schem-v1.0.pdf
Lots of interesting stuff there.Very neat work they did.
PortA is for EEPROM and serial pins.
PORTB and PORTC end up as your I/O pins.
Those 16 pins.
Are they inputs or output at power up?
Are the outputs low or high?