27220 Parallax Inc, 27220 Datasheet - Page 91

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Write Code like a Pro
Where possible, take advantage of built-in PBASIC instructions instead of manually
coding them. The BS2p-family, for example, has instructions for handling parallel
LCD modules so the code presented in the standard BS2-version of this project would
use program space unnecessarily.
frequently able to write a program that will run identically on any BS2-type
microcontroller.
Using the following definition from the LCD program:
… we are able to write code that uses the LCD instructions available in the BS2p-
family. Here’s how the LCD_Cmd and LCD_Out subroutines could be updated to
reduce program memory requirements when a BS2p-family module is installed:
Note the use of the underscore in the labels LCD_Cmd and LCD_Out – this prevents
conflict with internal reserved words LCDCMD and LCDOUT while making very clear
the intent of the subroutine.
See SW21-EX11-LCD_Demo-All.BS2 for the complete listing.
#DEFINE _LcdReady = ($STAMP >= BS2P)
LCD_Cmd:
LCD_Out:
#IF _LcdReady #THEN
#ELSE
#ENDIF
#IF _LcdReady #THEN
#ELSE
#ENDIF
RETURN
LCDCMD E, char
RETURN
LOW RS
LCDOUT E, 0, [char]
LcdBus = char.HIGHNIB
PULSOUT E, 3
LcdBus = char.LOWNIB
PULSOUT E, 3
HIGH RS
By using conditional compilation we are
' send command to LCD
' return to program
' enter command mode
' output high nibble
' strobe the Enable line
' output low nibble
' return to character mode

Related parts for 27220