Skip to content

Matrix Orbital

Personal tools
You are here: Home » Application Notes » Javelin Stamp » Sending Commands

Sending Commands

Document Actions
Sending commands to a display from a Javelin Stamp.
Sending a Command to the display:

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.

Sending a command to the display is as easy as sending characters to the display except that you need to send it the command prefix '0xFE' first and then the command and any arguments if required. Note that you cannot use sendString to send a command to the display. You need to send each character individually.

For example to clear the screen...


// Uart.dirTransmit -> Uart will be used to transmit data only.
// CPU.pin0 -> Pin used to transmit data
// Uart.dontInvert -> data is not inverted
// Uart.speed19200 -> serial data transfer speed (baud rate)
// Uart.stop1 -> Number of stop bits used is 1

static Uart txUart = new Uart(Uart.dirTransmit, CPU.pin0, Uart.dontInvert, Uart.speed19200, Uart.stop1 );


txUart.sendByte(0xFE);     // Command Prefix in HEX
txUart.sendByte(0x58);     // Clear 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 HEX, if you prefer DECIMAL then don't include 0x.
i.e.
txUart.sendByte(254); // Command Prefix in DECIMAL


Setting the Backlight to go off in 2 minute:



// Uart.dirTransmit -> Uart will be used to transmit data only.
// CPU.pin0 -> Pin used to transmit data
// Uart.dontInvert -> data is not inverted
// Uart.speed19200 -> serial data transfer speed (baud rate)
// Uart.stop1 -> Number of stop bits used is 1

static Uart txUart = new Uart(Uart.dirTransmit, CPU.pin0, Uart.dontInvert, Uart.speed19200, Uart.stop1 );

txUart.sendByte(0xFE);     // Command Prefix
txUart.sendByte(0x42);     // Backlight ON command
txUart.sendByte(0x02);     // Stay ON for 2 minutes only


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 the backlight on case, the display knows to expect one more byte of information.


For technical discussions and questions, please visit ourforums
Created by Henry
Last modified 2005-08-06 08:56 PM
 

Powered by Plone

This site conforms to the following standards: