Welcome to our support portal. We hope you like it and find what you need. For more up-to-date information and buy our products please visit our ecommerce site www.matrixorbital.com
Up

BASIC Stamp

Applications notes and examples for Matrix Orbital displays and Parallax BASIC Stamps.

Sending Text

Sending text to a display from a BASIC Stamp.

 

Sending Commands

Sending commands to a display from a BASIC Stamp.

 

Large DIgits

This Applications note shows how easy it is to utilize large digits that are built into Matrix Orbital displays.

 

Medium DIGITS

This Applications note shows how easy it is to utilize medium digits that are built into Matrix Orbital displays.

 

 I2C using a BS2 BASIC Stamp with "Bit Bash" Method

 

MOS QUICK INSTALL

A quick install for a MOS display and a BASIC Stamp.

The MOS Series of displays was specifically engineered to be low cost, easy to use and feature rich. In this Application Note, we show a MOS display being connected to a BASIC Stamp and display a line of text.

For technical discussions and questions, please visit our forums

 I2C using a BS2 BASIC Stamp with "Bit Bash" Method

This is a very simple example of using I2C to talk to a Matrix Orbital Display, using a BASIC Stamp 2 from Parallax.

Most BASIC Stamp 2* models do not have I2C support built in - so you have to "bit bash" a solution. You can use the I2C subroutines for other I2C based projects as well.

*BASIC Stamp 2p models have native I2C support, but this example still can be used.

BASIC Stamp: Any BASIC Stamp 2 models
Communication Type: I2C
Display Used: Any Matrix Orbital display that supports I2C such as the MOI or LK/VK/PK series.

In this example we are talking to a display at address 50 hex over I2C communication protocol.


'{$STAMP BS2}

'I2C test program. 27/4/2003 Ben Lennard
'Bit Bashing I2C on a Parallax BS2
'Write to a Matrix Orbital LCD via I2C on a BS2

'STAMP EEPROM DATA
Companyname DATA "Lennard Electronics "
URL DATA "www.lennard.net.nz "

'CONSTANTS
SDA CON 1'I2C Data line
SCL CON 0'I2C Clock line

'VARIABLES
ack VAR BIT'Acknowledge from the I2C bus
I2C_data VAR BYTE'Data to/from the I2C bus
i VAR BYTE'just a for loop variable
LCDcharacter VAR BYTE

DIRS=%0011111111111111

Main:
PAUSE 1000
'Give the MO Display time to initalise it's self - 1 seconds
GOSUB StartI2C
I2C_data = %01010000
'MO Display address for WRITING to
GOSUB Write_data
I2C_data = %11111110
'254 = command
GOSUB Write_data
I2C_data = %01011000
'88 = clear display
GOSUB Write_data

for i = Companyname to Companyname + 39
' this for loop writes the display message
READ i, LCDcharacter
I2C_data = LCDcharacter
GOSUB Write_data
next 
GOSUB StopI2C 
end
'^^^^^^^^^^^^^^ I2C SUBROUTINES ^^^^^^^^^^^^^^
'Start Procedure. Set start condition on bus: SDA Hi-Lo while SCL Hi
StartI2C:
HIGH SDA
HIGH SCL
LOW SDA
LOW SCL
RETURN

'Stop Procedure. Set stop condition on bus: SDA Lo-Hi while SCL Hi
StopI2C:
LOW SDA
HIGH SCL
HIGH SDA
RETURN

'Write Address/Data Procedure
Write_data:
shiftout SDA, SCL, msbfirst, [I2C_data] 
'Check for Receiver Acknowledge
RX_ACK:
HIGH SDA
DIRS=%0011111011111011
HIGH SCL
ack = IN2
LOW SCL
DIRS=%0011111111111111
'if ack = 1 then indicate_NO_ACK
'debug "Acknowledged", 13
'RETURN
'indicate_NO_ACK:
' debug "NO Acknowledge", 13
RETURN
'^^^^^^^^^^^^^^ I2C SUBROUTINES ^^^^^^^^^^^^^^


A special thanks to Ben Lennard for this great example. For technical discussions and questions, please visit our forums.

 

Medium Digits using Serial

This Applications note shows how easy it is to utilize medium digits that are built into Matrix Orbital displays using serial communication. Supported BASIC Stamp: All BASIC Stamp 2 models.

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

Introduction:

Medium 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.

BASIC Stamp: All BASIC Stamp 2 models
Communication Type: Serial
Display Used: Any 2 line Matrix Orbital alphanumeric display

In this example we are talking to a display at 9600bps using serial communication protocol.


' (C) Matrix Orbital
' Application notes: www.matrixorbital.ca
' Support: www.lcdforums.com/forums
' Written by: Tom Lam


'{$STAMP BS2}

Digit VAR Byte 'Create the variables
Reps VAR Nib

Digit = 0
Reps = 0

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

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [109] 'Initilize Medium Digits command

FOR Reps = 1 TO 10 'A loop to repeat it self 10 times

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [111] 'Display medium digit command
SEROUT 1, 240, [1] 'Display medium digit in row 1
SEROUT 1, 240, [1] 'Display medium digit in column 1
SEROUT 1, 240, [Digit] 'Display the medium digit
Digit = Digit + 1 'Increment by 1
PAUSE 1000 '1 second pause to see the text

NEXT

STOP


In this code, the LCD will display 10 medium 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.

For technical discussions and questions, please visit our forums

Large Digits using I2C

This Applications note shows how easy it is to utilize large digits that are built into Matrix Orbital displays using I2C communication. Supported BASIC Stamp: BASIC Stamp 2p model.

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 an alphanumeric display has. 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. Please refer to the Quick Install section in the BASIC Stamp Application notes for connection information.

BASIC Stamp: BASIC Stamp 2p model
Communication Type: I2C
Display Used: Any Matrix Orbital display that supports I2C such as the MOI or LK/VK/PK series.

In this example we are talking to a display at address 80 Decimal (50 hex) over I2C communication protocol.


' (C) Matrix Orbital
' Application notes: www.matrixorbital.ca
' Support: www.lcdforums.com/forums
' Written by: Henry Jakl

'{$STAMP BS2p}

Digit VAR Byte 'Create the variables
Reps VAR NIB

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

I2COUT 1, 80, [254] 'Command Prefix
I2COUT 1, 80, [88] 'Clear screen command

I2COUT 1, 80, [254] 'Command Prefix
I2COUT 1, 80, [110] 'Initilize Large Digits command

FOR Reps = 1 TO 10 'A loop to repeat it self 10 times

I2COUT 1, 80, [254] 'Command Prefix
I2COUT 1, 80, [35] 'Display large digit command
I2COUT 1, 80, [1] 'Display large digit in column 1
I2COUT 1, 80, [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 display 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.

For technical discussions and questions, please visit our forums

Large Digits using Serial

This Applications note shows how easy it is to utilize large digits that are built into Matrix Orbital displays using serial communication.

Supported BASIC Stamp: All BASIC Stamp 2 models.

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.

BASIC Stamp: All BASIC Stamp 2 models
Communication Type: Serial
Display Used: Any 4 line Matrix Orbital alphanumeric display

In this example we are talking to a display at 9600bps using serial communication protocol.


' (C) Matrix Orbital
' Application notes: www.matrixorbital.ca
' Support: www.lcdforums.com/forums
' Written by: Henry Jakl

'{$STAMP BS2}

Digit VAR Byte 'Create the variables
Reps VAR NIB

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

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

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

FOR Reps = 1 TO 10 'A loop to repeat it self 10 times

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [35] 'Display large digit command
SEROUT 1, 240, [1] 'Display large digit in column 1
SEROUT 1, 240, [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.

Sending commands to a display from a BASIC Stamp using I2C communication.

Supported BASIC Stamp: BASIC Stamp 2p models.

BASIC Stamp: BASIC Stamp 2p models
Communication Type: I2C
Display Used: Any Matrix Orbital display that supports I2C such as the MOI or LK/VK/PK series.

In this example we are talking to a display at address 80 Decimal (50 hex) over I2C communication protocol.


Sending a Command to the display:

'{$STAMP BS2p}

I2COUT 1, 80, [254] 'Command Prefix
I2COUT 1, 80, [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:

'{$STAMP BS2p}

I2COUT 1, 80, [254] 'Command Prefix
I2COUT 1, 80, [66] 'Backlight ON command
I2COUT 1, 80, [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.

For technical discussions and questions, please visit our forums

Sending commands to a display from a BASIC Stamp using serial communication.

Supported BASIC Stamp: All BASIC Stamp 2 models.

BASIC Stamp: All BASIC Stamp 2 models
Communication Type: Serial
Display Used: Any Matrix Orbital display that supports serial communication such as the MOS or LK/VK/PK series.

In this example we are talking to a display at 9600bps using serial communication protocol.


Sending a Command to the display:

'{$STAMP BS2}

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [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:

'{$STAMP BS2}

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [66] 'Backlight ON command
SEROUT 1, 240, [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.

For technical discussions and questions, please visit our forums

Sending text to a display from a BASIC Stamp using I2C communication.

Supported BASIC Stamp: BASIC Stamp 2p models.

Introduction:

First you need to get the I2C address of the display, please consult your displays manual as to how to do this. In this example we are using the LK204-25 display, which as a I2C address of 50 hex.

BASIC Stamp: BASIC Stamp 2p models
Communication Type: I2C
Display Used: Any Matrix Orbital display that supports I2C such as the MOI or LK/VK/PK series.

Setup:

You will need to connect the display to the Basic Stamp. We used one of our breadboard cables connected accordingly:

 Breadboard Cable Connection Basic Stamp Connection 
 Red (+5V)  Vdd
 Yellow (SCL)  P0
 Green (SDA)  P1
Black (Grnd) Vss

 

A 4.7K resistor was used as a pull up on both the SCL and SDA lines.

Code Examples

Sending text to the screen:


'{$STAMP BS2p}

I2COUT 1, 80, ["HELLO"]


This will display HELLO on your display followed by the Matrix Orbital Logo and startup screen. The Matrix Orbital logo and start up screen are default "on" at start up. You can remove the startup screen by sending the clear screen command, sending commands to the display is covered in the "Sending Commands" application note.

I2COUT : is the command to send information out by I2C
1 : is pin 1 on the BASIC Stamp, this is where the data will be sent from
80 : is the I2C address in DECIMAL form of the display, to which we are sending the data to.

 

LK204-25

 

Sending text to a display from a BASIC Stamp to a graphics display using serial communication.

Supported BASIC Stamp: All BASIC Stamp 2 models.

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.

BASIC Stamp: All BASIC Stamp 2 models
Communication Type: Serial
Display Used: Any Matrix Orbital Graphics displays. A GLK12232-25-SM was used in this example.

Setup:

You will need to connect the LCD to the Basic Stamp. We used one of our breadboard cables connected 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:


'{$STAMP BS2}

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

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [49] 'Set current font
SEROUT 1, 240, [1] 'The font id

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [50] 'Set font metrics
SEROUT 1, 240, [1] 'Left margin
SEROUT 1, 240, [1] 'Top margin
SEROUT 1, 240, [1] 'X space
SEROUT 1, 240, [1] 'Y space
SEROUT 1, 240, [32] 'Scroll start

SEROUT 1, 240, ["Hello "] 'Sending text

SEROUT 1, 240, [254] 'Command Prefix
SEROUT 1, 240, [49] 'Set current font
SEROUT 1, 240, [2] 'The font id was changed to 2

SEROUT 1, 240, ["world"] 'Sending text


This will display HELLO WORLD on your display. "Hello" will be a different font than "world" in this example.

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

For technical discussions and questions, please visit our forums

 

Sending text to a display from a BASIC Stamp using serial communication.

Supported BASIC Stamp: All BASIC Stamp 2 models.

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.

BASIC Stamp: All BASIC Stamp 2 models
Communication Type: Serial
Display Used: Any LK, VK, PK or MOS Matrix Orbital display

Setup:

You will need to connect the LCD to the Basic Stamp. We used one of our breadboard cables connected 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:


'{$STAMP BS2}

SEROUT 1, 240, ["HELLO WORLD"]


This will display HELLO WORLD on your display.

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

For technical discussions and questions, please visit our forums

 

 
 
Powered by Phoca Download