Basic Stamp Developers Guide...

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
Henry
OMNIPRESENT
OMNIPRESENT
Posts: 3002
Joined: Tue Aug 14, 2001 6:00 pm
Contact:

Basic Stamp Developers Guide...

Post by Henry »

BASIC Stamp Developers Guide...

We will be using the BS2 and BS2p Stamps... most of this demo software can be used on any of the Basic Stamps...

Basic Stamp 2
Image
  • *Programmable in simple PBASIC Lanuguage
    *16 I/O lines
    *Program memory for ~500 instructions
    *4000 instructions / sec. execution speed
    *50K baud serial I/O
    *24-pin DIP module
The BASIC Stamp 2 is perhaps the most popular Stamp ever. Its combination of features and price make it an excellent entry point into the world of microcontrollers.

Basic Stamp 2p
Image
  • *Programmable in simple PBASIC Lanuguage
    *16 I/O lines
    *Program memory ~ 4000 instructions
    *12,000 instructions/sec execution speed !
    *Polled Interrupts
    *38 Bytes RAM
    *Operates near 40mA
    *I2C and One-Wire Routines
    *24-pin DIP module is pin-for-pin compatible with the BASIC Satmp 2, 2e, 2SX
Exisisting BS2, BS2e, and BS2-SX code is easily converted.
The BASIC Stamp 2p-24 has several advantages over all previous BASIC Stamps. It is 3 times faster than a BS2 and 20% faster than the BS2-SX. Commands for interfacing with parallel LCDs, I2C devices and Dallas Semiconductor 1-Wire parts have been added along with a polled interrupt capability.

More information...
http://www.parallax.com/html_pages/prod ... stamps.asp
Last edited by Henry on Sat Dec 21, 2002 4:13 pm, edited 5 times in total.
Henry J.
President
Matrix Orbital

Henry
OMNIPRESENT
OMNIPRESENT
Posts: 3002
Joined: Tue Aug 14, 2001 6:00 pm
Contact:

The Basics...

Post by Henry »

Display text and sending commands to the BASIC Stamp 2.

Introduction:
First you need to set you LCD to 9600 baud, please consult your displays manual as to how to do this. Then you need to either set your LCD for TTL levels or add a RS232 chip to you circuit. For setting the LCD to TTL levels, please consult the manual for your display.

Setup:

You will need to connect the LCD to the Basic Stamp. We used one of our serial cables, cut the end off and then soldered connectors to pin #2, #3 and #5.

Pin #2 is connected to P0
Pin #3 is connected to P1
Pin #5 is connectod to Vss, which is ground

You can also communicate through the power header, please consult the displays manual to see if it's possible on the model you have.

Code Examples

Sending text to the screen:

Code: Select all


'{$STAMP BS2}

SEROUT 1, 84, ["HELLO WORLD"]

This will display HELLO WORLD on your display.

SEROUT : is the command to send serial information out
1 : is Serial Port #1
84 : is the speed at which the information is sent at, in our case 9600bps.

Sending a Command to the display:

Code: Select all

'{$STAMP BS2}

SEROUT 1, 84, [254]        'Command Prefix
SEROUT 1, 84, [88]         'Clear screen command
In this example the command to clear the screen is sent to the display. Every command requires a "Command Prefix". In Matrix Orbital displays, that's Hex: FE Decimal: 254 ASCII: 254, you can send these bytes in any format you want, as long as you do it properly. In our example we sent them as DECIMAL...

Setting the Backlight to go off in 2 minute:

Code: Select all

'{$STAMP BS2}

SEROUT 1, 84, [254]       'Command Prefix
SEROUT 1, 84, [66]        'Backlight ON command
SEROUT 1, 84, [2]         'Setting the number of minutes to be on
To permanently turn the backlight on, you would send 0 as the third byte. When the display recieves the command, it will know how many more bytes of information it should get. In th backlight on case, the display knows to expect one more byte of information.
Last edited by Henry on Fri Apr 16, 2004 12:55 pm, edited 6 times in total.
Henry J.
President
Matrix Orbital

Henry
OMNIPRESENT
OMNIPRESENT
Posts: 3002
Joined: Tue Aug 14, 2001 6:00 pm
Contact:

Displaying large digits...

Post by Henry »

Our Alphanumeric displays have the ability to display large digits. This is usefull if you want to see the temperature in large easy to read letters.

Introduction:
Large digits is a combination of the 8 custom characters a LCD/VFD has. These 8 custom characters are user defined and can be used how ever the user sees fit. You will have to note, that you cannot use Large Digits, Bar Graps or user defined Custom Characters at the same time. It has to be one or the other.

Code: Select all


'{$STAMP BS2} 

Digit         VAR          Byte   'Create the variables
Reps          VAR          NIB

Digit = 0                       'Make sure the variables are 0
Reps = 0

SEROUT 1, 84, [254]          'Command Prefix
SEROUT 1, 84, [88]           'Clear screen command

SEROUT 1, 84, [254]          'Command Prefix
SEROUT 1, 84, [110]          'Initilize Large Digits command

FOR Reps = 1 TO 10           'A loop to repeat it self 10 times
   
     SEROUT 1, 84, [254]     'Command Prefix
     SEROUT 1, 84, [35]      'Display large digit command
     SEROUT 1, 84, [1]       'Display large digit in column 1
     SEROUT 1, 84, [Digit]   'Display the large digit
     Digit = Digit + 1       'Incriment by 1
     PAUSE 1000              '1 second pause to see the text
NEXT

STOP
In this code, the LCD will display 10 large digits, starting with 0 and going to 9. You can expand on this by creating 2+ more numbers at the same time. This code is usefull for the digital thermometer we will be building next.
Henry J.
President
Matrix Orbital

Post Reply