| Smart Star User's Manual |
Appendix B. LCD/Keypad Module
An optional LCD/keypad module is available for the Smart Star. Appendix B describes the LCD/keypad module and provides the software APIs to make full use of the LCD/keypad module.
B.1 Specifications
Table B-1 lists the electrical, mechanical, and environmental specifications for the LCD/keypad module.
Figure B-1 shows the mechanical dimensions for the LCD/keypad module and its bezel.
NOTE All measurements are in inches followed by millimeters enclosed in parentheses. B.2 Keypad Labeling
The keypad may be labeled according to your needs. A template is provided in Figure B-2 to allow you to design your own keypad label insert.
To replace the keypad legend, remove the old legend and insert your new legend prepared according to the template in Figure B-2. The keypad legend is located under the blue keypad matte, and is accessible from the left only as shown in Figure B-3.
B.3 Header Pinouts
Figure B-4 shows the pinouts for the LCD/keypad module.
B.3.1 I/O Address Assignments
The LCD and keypad on the LCD/keypad module are addressed by the /CS chip select as explained in Table B-2.
B.4 Mounting LCD/Keypad Module
B.4.1 Installation Guidelines
When possible, following these guidelines when mounting the LCD/keypad module.
- Leave sufficient ventilation space
- Do not install the LCD/keypad module directly above machinery that radiates a lot of heat (for example, heaters, transformers, and high-power resistors).
- Leave at least 8" (20 cm) distance from electric power lines and even more from high-voltage devices.
- When installing the LCD/keypad module near devices with strong electrical or magnetic fields (such as solenoids), allow a least 3" (8 cm), more if necessary.
The LCD/keypad module has strong environmental resistance and high reliability, but you can maximize system reliability by avoiding or eliminating the following conditions at the installation site.
- Abrupt temperature changes and condensation
- Ambient temperatures exceeding a range of 0°C to 50°C
- Relative humidity exceeding a range of 5% to 95%
- Strong magnetism or high voltage
- Corrosive gases
- Direct vibration or shock
- Excessive iron dust or salt
- Spray from harsh chemicals
B.4.2 Mounting Instructions
A bezel and a gasket are included with the LCD/keypad module. When properly mounted in a panel, the LCD/keypad module bezel is designed to meet NEMA 4 specifications for water resistance.
Since the LCD/keypad module employs an LCD display, the viewing angle must be considered when mounting the display. Install the LCD/keypad module at a height and angle that makes it easy for the operator to see the screen.
B.4.2.1 Bezel-Mount Installation
This section describes and illustrates how to bezel-mount the LCD/keypad module. Follow these steps for bezel-mount installation.
- Cut mounting holes in the mounting panel in accordance with the recommended dimensions in Figure B-5, then use the bezel faceplate to mount the LCD/keypad module onto the panel.
- Carefully "drop in" the LCD/keypad module with the bezel and gasket attached.
- Fasten the unit with the four 4-40 screws and washers included with the LCD/keypad module. If your panel is thick, use a 4-40 screw that is approximately 3/16" (5 mm) longer than the thickness of the panel.
Carefully tighten the screws until the gasket is compressed and the plastic bezel faceplate is touching the panel.
Do not tighten each screw fully before moving on to the next screw. Apply only one or two turns to each screw in sequence until all are tightened manually as far as they can be so that the gasket is compressed and the plastic bezel faceplate is touching the panel.
B.5 Connecting LCD/Keypad Module to Smart Star Backplane
The LCD/keypad module can be located as far as 2 ft. (60 cm) away from the Smart Star backplane, and is connected via a ribbon cable as shown in Figure B-7.
Note the locations and connections for pin 1 on both the backplane and the LCD/keypad module.
The SR9050 backplane can also be panel-mounted behind the LCD/keypad module.
- Prepare a cutout and install the LCD/keypad module in the cutout as explained in Section B.4.2.1.
- Use brackets to secure the LCD/keypad module to the panel using the four 4-40 screws and washers included with the LCD/keypad module. The four screw positions are indicated with the number 1 in Figure B-8. If your panel is thick, use a 4-40 screw that is approximately 3/16" (5 mm) longer than the thickness of the panel.
- Use a ribbon cable to connect header J6 on the backplane to header J1 on the LCD/keypad module. Note the pin 1 positions reflected by the red-colored line in the ribbon cable shown in Figure B-8.
- Secure the Smart Star backplane using four 4-40 × ½" or 6-32 × ½" screws at the screw positions indicated with the number 2 in Figure B-8.
Brackets and ribbon cables are sold separately. Note that only a Smart Star assembly using the SR9050 backplane can be panel-mounted.
B.6 Font and Bitmap Converter
A Font and Bitmap Converter tool is available to convert Windows fonts and monochrome bitmaps to a library file format compatible with Z-World's Dynamic C applications and graphical displays. Non-Roman characters can also be converted by applying the monochrome bitmap converter to their bitmaps.
Start the Font and Bitmap Converter tool by double-clicking on the
fbmcnvtr.exefile in the Dynamic C directory. You then select and convert existing fonts or bitmaps. Complete instructions are available via the Help menu that is in the Font and Bitmap Converter tool.Once you are done, the converted file is displayed in the editing window. Editing may be done, but should not be necessary. Save the file as libraryfilename
.lib, where libraryfilename is a file name of your choice.Add the library file(s) to applications with the statement
#uselibraryfilename.lib, or by cutting and pasting from the library file(s) you created into the application program.
NOTE If you used the #uselibraryfilename.libstatement, remember to enter libraryfilename.libintolib.dir, which is located in your Dynamic C directory.You are now ready to add the font or bitmap to your application using the
glXFontInitor theglXPutBitmapfunction calls.B.7 LCD/Keypad Module Function APIs
B.7.1 LEDs
When power is applied to the LCD/keypad module for the first time, the red LED (DS1) will come on, indicating that power is being applied to the LCD/keypad module. The red LED is turned off when the brdInit function executes.
One function is available to control the LEDs, and can be found in the
SMRTSTAR.LIBlibrary.
void ledOut(int led, int value);
PARAMETERS
- LED on/off control. This function will only work when the LCD/keypad module is installed on the Smart Star.
- led is the LED to control.
0 = LED DS1
1 = LED DS2
2 = LED DS3
3 = LED DS4
4 = LED DS5
5 = LED DS6
6 = LED DS7RETURN VALUE
- value is the value used to control whether the LED is on or off (0 or 1).
SEE ALSO
- None.
brdInitB.7.2 LCD Display
The functions used to control the LCD display are contained in the
GRAPHIC.LIBlibrary located in the Dynamic CDISPLAYS\GRAPHIClibrary directory.
void glInit(void);
RETURN VALUE
- Initializes the display devices, clears the screen.
SEE ALSO
- None.
glDispOnOFF, glBacklight, glSetContrast, glPlotDot, glBlock, glPlotDot, glPlotPolygon, glPlotCircle, glHScroll, glVScroll, glXFontInit, glPrintf, glPutChar, glSetBrushType, glBuffLock, glBuffUnlock, glPlotLine
void glBackLight(int onOff);
PARAMETER
- Sets the intensity of the backlight, if circuitry is installed.
RETURN VALUE
- :
onOffreflects the low to high values (typically 0 to 255, depending on the board design) to set the backlight intensity (0 will turn the backlight off completely.)
SEE ALSO
- None.
glInit, glDispOnoff, glSetContrast
void glDispOnOff(int onOff);
PARAMETER
- Sets the LCD screen on or off. Data will not be cleared from the screen.
onOffturns the LCD screen on or off1--turn the LCD screen on
RETURN VALUE
0--turn the LCD screen off
SEE ALSO
- None.
glInit, glSetContrast, glBackLight
void glSetContrast(unsigned level);
PARAMETER
- Sets display contrast (the circuitry is not installed on the LCD/keypad module used with the Smart Star).
RETURN VALUE
levelreflects low to high values (typically 0 to 255, depending on the board design) to give high to low contrast respectively.
SEE ALSO
- None.
glInit, glBacklight, glDispOnoff
void glFillScreen(char pattern);
PARAMETER
- Fills the LCD display screen with a pattern.
RETURN VALUE
- The screen will be set to all black if
patternis 0xFF, all white ifpatternis 0x00, and vertical stripes for any other pattern.
SEE ALSO
- None.
glBlock, glBlankScreen, glPlotPolygon, glPlotCircle
void glBlankScreen(void);
RETURN VALUE
- Blanks the LCD display screen (sets LCD display screen to white).
SEE ALSO
- None.
glFillScreen, glBlock, glPlotPolygon, glPlotCircle
void glBlock(int x, int y, int bmWidth, int bmHeight);
PARAMETERS
- Draws a rectangular block in the page buffer and on the LCD if the buffer is unlocked. Any portion of the block that is outside the LCD display area will be clipped.
xis the x coordinate of the upper left corner of the block.
yis the y coordinate of the left top corner of the block.
bmWidthis the width of the block.RETURN VALUE
bmWidthis the height of the block.
SEE ALSO
- None.
glFillScreen, glBlankScreen, glPlotPolygon, glPlotCircle
void glPlotVPolygon(int n, int *pFirstCoord);
PARAMETERS
- Plots the outline of a polygon in the LCD page buffer, and on the LCD if the buffer is unlocked. Any portion of the polygon that is outside the LCD display area will be clipped. The function will also return, doing nothing, if there are less than 3 vertices.
nis the number of vertices.RETURN VALUE
*pFirstCoordis a pointer to array of vertex coordinates:x1,y1,x2,y2,x3,y3,...
SEE ALSO
- None.
glPlotPolygon, glFillPolygon, glFillVPolygon
void glPlotPolygon(int n, int y1, int x2, int y2, ...);
PARAMETERS
- Plots the outline of a polygon in the LCD page buffer and on the LCD if the buffer is unlocked. Any portion of the polygon that is outside the LCD display area will be clipped. The function will also return, doing nothing, if there are less than 3 vertices.
nis the number of vertices.
y1is the y coordinate of the first vertex.
x1is the x coordinate of the first vertex.
y2is the y coordinate of the second vertex.
x2is the x coordinate of the second vertex.RETURN VALUE
...are the coordinates of additional vertices.
SEE ALSO
- None.
glPlotVPolygon, glFillPolygon, glFillVPolygon
void glFillVPolygon(int n, int *pFirstCoord);
PARAMETERS
- Fills a polygon in the LCD page buffer and on the LCD screen if the buffer is unlocked. Any portion of the polygon that is outside the LCD display area will be clipped. The function will also return, doing nothing, if there are less than 3 vertices.
- n is the number of vertices.
RETURN VALUE
- *pFirstCoord is a pointer to array of vertex coordinates:
x1,y1,x2,y2,x3,y3,...
SEE ALSO
- None.
glFillPolygon, glPlotPolygon, glPlotVPolygon
void glFillPolygon(int n, int x1, int y1, int x2, int y2, ...);
PARAMETERS
- Fills a polygon in the LCD page buffer and on the LCD if the buffer is unlocked. Any portion of the polygon that is outside the LCD display area will be clipped.
nis the number of vertices.
x1is the x coordinate of the first vertex.
y1is the y coordinate of the first vertex.
x2is the x coordinate of the second vertex.
y2is the y coordinate of the second vertex.RETURN VALUE
...are the coordinates of additional vertices.
SEE ALSO
- None.
glFillVPolygon, glPlotPolygon, glPlotVPolygon
void glPlotCircle(int xc, int yc, int rad);
PARAMETERS
- Draws a circle in the LCD page buffer and on the LCD if the buffer is unlocked. Any portion of the circle that is outside the LCD display area will be clipped.
xcis the x coordinate of the center of the circle.
ycis the y coordinate of the center of the circle.RETURN VALUE
radis the radius of the center of the circle (in pixels).
SEE ALSO
- None.
glFillCircle, glPlotPolygon, glFillPolygon
void glFillCircle(int xc, int yc, int rad);
PARAMETERS
- Draws a filled circle in the LCD page buffer and on the LCD if the buffer is unlocked. Any portion of the circle that is outside the LCD display area will be clipped.
xcis the x coordinate of the center of the circle.
ycis the y coordinate of the center of the circle.RETURN VALUE
radis the radius of the center of the circle (in pixels).
SEE ALSO
- None.
glPlotCircle, glPlotPolygon, glFillPolygon
void glXFontInit(fontInfo *pInfo, char pixWidth, char pixHeight, unsigned startChar, unsigned endChar, unsigned long xmemBuffer);
PARAMETERS
- Initializes the font descriptor structure, where the font is stored in xmem. Each font character's bitmap is column major and byte-aligned.
*pInfois a pointer to the font descriptor to be initialized.
pixWidthis the width (in pixels) of each font item.
pixHeightis the height (in pixels) of each font item.
startCharis the value of the first printable character in the font character set.
endCharis the value of the last printable character in the font character set.RETURN VALUE
xmemBufferis thexmempointer to a linear array of font bitmaps.
SEE ALSO
- None.
glPrinf
unsigned long glFontCharAddr(fontInfo *pInfo, char letter);
PARAMETERS
- Returns the
xmemaddress of the character from the specified font set.
*pInfois thexmemaddress of the bitmap font set.RETURN VALUE
letteris an ASCII character.
SEE ALSO
xmemaddress of bitmap character font, column major, and byte-aligned.
glPutFont, glPrintf
void glPutFont(int x, int y, fontInfo *pInfo, char code);
PARAMETERS
- Puts an entry from the font table to the page buffer and on the LCD if the buffer is unlocked. Each font character's bitmap is column major and byte-aligned. Any portion of the bitmap character that is outside the LCD display area will be clipped.
xis the x coordinate (column) of the upper left corner of the text.
yis the y coordinate (row) of the left top corner of the text.
*pInfois a pointer to the font descriptor.RETURN VALUE
codeis the ASCII character to display.
SEE ALSO
- None.
glFontCharAddr, glPrintf
void glSetPfStep(int stepX, int stepY);
PARAMETERS
- Sets the
glPrintf()printing step direction. The x and y step directions are independent signed values. The actual step increments depend on the height and width of the font being displayed, which are multiplied by the step values.
stepXis theglPrintfx step valueRETURN VALUE
stepYis theglPrintfy step value
SEE ALSO
- None.
- Use
glGetPfStep()to examine the current x and y printing step direction.
int glGetPfStep(void);
RETURN VALUE
- Gets the current
glPrintf()printing step direction. Each step direction is independent of the other, and is treated as an 8-bit signed value. The actual step increments depends on the height and width of the font being displayed, which are multiplied by the step values.
SEE ALSO
- The x step is returned in the MSB, and the y step is returned in the LSB of the integer result.
- Use
glGetPfStep()to control the x and y printing step direction.
void glPutChar(char ch, char *ptr, int *cnt, glPutCharInst *pInst)
PARAMETERS
- Provides an interface between the STDIO string-handling functions and the graphic library. The STDIO string-formatting function will call this function, one character at a time, until the entire formatted string has been parsed. Any portion of the bitmap character that is outside the LCD display area will be clipped.
chis the character to be displayed on the LCD.
*ptris not used, but is a place holder for STDIO string functions.
*cntis not used, is a place holder for STDIO string functions.RETURN VALUE
*pInstis a font descriptor pointer.
SEE ALSO
- None.
glPrintf, glPutFont, doprnt
void glPrintf(int x, int y, fontInfo *pInfo, char *fmt, ...);
PARAMETERS
- Prints a formatted string (much like
printf) on the LCD screen. Only the character codes that exist in the font set are printed, all others are skipped. For example, '\b', '\t', '\n' and '\r' (ASCII backspace, tab, new line, and carriage return, respectively) will be printed if they exist in the font set, but will not have any effect as control characters. Any portion of the bitmap character that is outside the LCD display area will be clipped.
xis the x coordinate (column) of the upper left corner of the text.
yis the y coordinate (row) of the upper left corner of the text.
*pInfois a font descriptor pointer.
*fmtis a formatted string.EXAMPLE
...are formatted string conversion parameter(s).
glprintf(0,0, &fi12x16, "Test %d\n", count);RETURN VALUE
SEE ALSO
- None.
glXFontInit
void glBuffLock(void);
- Increments LCD screen locking counter. Graphic calls are recorded in the LCD memory buffer and are not transferred to the LCD if the counter is non-zero.
SEE ALSO
- None.
glBuffUnlock, glSwap
void glBuffUnlock(void);
RETURN VALUE
- Decrements the LCD screen locking counter. The contents of the LCD buffer are transferred to the LCD if the counter goes to zero.
SEE ALSO
- None.
glBuffLock, glSwap
void glSwap(void);
RETURN VALUE
- Checks the LCD screen locking counter. The contents of the LCD buffer are transferred to the LCD if the counter is zero.
SEE ALSO
- None.
glBuffUnlock, glBuffLock, _glSwapData (located in the library specifically for the LCD that you are using)
void glSetBrushType(int type);
PARAMETER
- Sets the drawing method (or color) of pixels drawn by subsequent graphic calls.
typevalue can be one of the following macros.RETURN VALUE
PIXBLACKdraws black pixels.
PIXWHITEdraws white pixels.
PIXXORdraws old pixel XOR'ed with the new pixel.
SEE ALSO
- None.
glGetBrushType
int glGetBrushType(void);
RETURN VALUE
- Gets the current method (or color) of pixels drawn by subsequent graphic calls.
SEE ALSO
- The current brush type.
glSetBrushType
void glPlotDot(int x, int y);
PARAMETERS
- Draws a single pixel in the LCD buffer, and on the LCD if the buffer is unlocked. If the coordinates are outside the LCD display area, the dot will not be plotted.
xis the x coordinate of the dot.RETURN VALUE
yis the y coordinate of the dot.
SEE ALSO
- None.
glPlotline, glPlotPolygon, glPlotCircle
void glPlotLine(int x0, int y0, int x1, int y1);
PARAMETERS
- Draws a line in the LCD buffer, and on the LCD if the buffer is unlocked. Any portion of the line that is beyond the LCD display area will be clipped.
x0is the x coordinate of one endpoint of the line.
y0is the y coordinate of one endpoint of the line.
x1is the x coordinate of the other endpoint of the line.RETURN VALUE
y1is the y coordinate of the other endpoint of the line.
SEE ALSO
- None.
glPlotDot, glPlotPolygon, glPlotCircle
void glLeft1(int left, int top, int cols, int rows);
PARAMETERS
- Scrolls byte-aligned window left one pixel, right column is filled by current pixel type (color).
leftis the upper left corner of bitmap, must be evenly divisible by 8.
topis the left top corner of the bitmap.
colsis the number of columns in the window, must be evenly divisible by 8.RETURN VALUE
rowsis the number of rows in the window.
SEE ALSO
- None.
glHScroll, glRight1
void glRight1(int left, int top, int cols, int rows);
PARAMETERS
- Scrolls byte-aligned window right one pixel, left column is filled by current pixel type (color).
leftis the upper left corner of bitmap, must be evenly divisible by 8.
topis the left top corner of the bitmap.
colsis the number of columns in the window, must be evenly divisible by 8.RETURN VALUE
rowsis the number of rows in the window.
SEE ALSO
- None.
glHScroll, glLeft1
void glUp1(int left, int top, int cols, int rows);
PARAMETERS
- Scrolls byte-aligned window up one pixel, bottom column is filled by current pixel type (color).
leftis the upper left corner of bitmap, must be evenly divisible by 8.
topis the left top corner of the bitmap.
colsis the number of columns in the window, must be evenly divisible by 8.RETURN VALUE
rowsis the number of rows in the window.
SEE ALSO
- None.
glVScroll, glDown1
void glDown1(int left, int top, int cols, int rows);
PARAMETERS
- Scrolls byte-aligned window down one pixel, top column is filled by current pixel type (color).
leftis the upper left corner of bitmap, must be evenly divisible by 8.
topis the left top corner of the bitmap.
colsis the number of columns in the window, must be evenly divisible by 8.RETURN VALUE
rowsis the number of rows in the window.
SEE ALSO
- None.
glVScroll, glUp1
void glHScroll(int left, int top, int cols, int rows, int nPix);
- Scrolls right or left, within the defined window by x number of pixels. The opposite edge of the scrolled window will be filled in with white pixels. The window must be byte-aligned.
- Parameters will be verified for the following:
1. The
leftandcolsparameters will be verified that they are evenly divisible by 8. If not, they will be changed to a value that is a multiple of 8.2. Parameters will be checked to verify that the scrolling area is valid. The minimum scrolling area is a width of 8 pixels and a height of one row.
PARAMETERS
leftis the upper left corner of bitmap, must be evenly divisible by 8.
topis the left top corner of the bitmap.
colsis the number of columns in the window, must be evenly divisible by 8.
rowsis the number of rows in the window.RETURN VALUE
nPixis the number of pixels to scroll within the defined window (a negative value will produce a scroll to the left).
SEE ALSO
- None.
glVScroll
void glVScroll(int left, int top, int cols, int rows, int nPix);
- Scrolls up or down, within the defined window by x number of pixels. The opposite edge of the scrolled window will be filled in with white pixels. The window must be byte-aligned.
- Parameters will be verified for the following:
1. The
leftandcolsparameters will be verified that they are evenly divisible by 8. If not, they will be changed to a value that is a multiple of 8.2. Parameters will be checked to verify that the scrolling area is valid. The minimum scrolling area is a width of 8 pixels and a height of one row.
PARAMETERS
leftis the upper left corner of bitmap, must be evenly divisible by 8.
topis the left top corner of the bitmap.
colsis the number of columns in the window, must be evenly divisible by 8.
rowsis the number of rows in the window.RETURN VALUE
nPixis the number of pixels to scroll within the defined window (a negative value will produce a scroll up).
SEE ALSO
- None.
glHScroll
void glXPutBitmap(int left, int top, int width, int height, unsigned long bitmap);
- Draws bitmap in the specified space. The data for the bitmap are stored in
xmem. This function callsglXPutFastmapautomatically if the bitmap is byte-aligned (the left edge and the width are each evenly divisible by 8).PARAMETERS
- Any portion of a bitmap image or character that is outside the LCD display area will be clipped.
leftis the upper left corner of the bitmap.
topis the upper left corner of the bitmap.
widthis the width of the bitmap.
heightis the height of the bitmap.RETURN VALUE
bitmapis the address of the bitmap inxmem.
SEE ALSO
- None.
glXPutFastmap, glPrintf
void glXPutFastmap(int left, int top, int width, int height, unsigned long bitmap);
- Draws bitmap in the specified space. The data for the bitmap are stored in xmem. This function is like
glXPutBitmap, except that it is faster. The restriction is that the bitmap must be byte-aligned.PARAMETERS
- Any portion of a bitmap image or character that is outside the LCD display area will be clipped.
leftis the upper left corner of the bitmap, must be evenly divisible by 8.
topis the upper left corner of the bitmap.
widthis the width of the bitmap, must be evenly divisible by 8.
heightis the height of the bitmap.RETURN VALUE
bitmapis the address of the bitmap inxmem.
SEE ALSO
- None.
glXPutBitmap, glPrintf
int TextWindowFrame(windowFrame *window, fontInfo *pFont, int x, int y, int winWidth, int winHeight)
- Defines a text-only display window. This function provides a way to display characters within the text window using only character row and column coordinates. The text window feature provides end-of-line wrapping and clipping after the character in the last column and row is displayed.
PARAMETERS
NOTE Execute the TextWindowFramefunction before otherText...functions.
*windowis a window frame descriptor pointer.
*pFontis a font descriptor pointer.
xis the x coordinate of where the text window frame is to start.
yis the y coordinate of where the text window frame is to start.
winWidthis the width of the text window frame.RETURN VALUE
winHeightis the height of the text window frame.
0--window frame was successfully created.
-1--x coordinate + width has exceeded the display boundary.
-2--y coordinate + height has exceeded the display boundary.
void TextGotoXY(windowFrame *window, int col, int row);
- Sets the cursor location on the display of where to display the next character. The display location is based on the height and width of the character to be displayed.
PARAMETERS
NOTE Execute the TextWindowFramefunction before using this function.
*windowis a pointer to a font descriptor.
colis a character column location.RETURN VALUE
rowis a character row location.
SEE ALSO
- None.
TextPutChar, TextPrintf, TextWindowFrame
void TextCursorLocation(windowFrame *window, int *col, int *row);
- Gets the current cursor location that was set by a Graphic
Text...function.PARAMETERS
NOTE Execute the TextWindowFramefunction before using this function.
*windowis a pointer to a font descriptor.
*colis a pointer to cursor column variable.RETURN VALUE
*rowis a pointer to cursor row variable.
Lower word = Cursor Row location
SEE ALSO
Upper word = Cursor Column location
TextGotoXY, TextPrintf, TextWindowFrame, TextCursorLocation
void TextPutChar(struct windowFrame *window, char ch);
- Displays a character on the display where the cursor is currently pointing. If any portion of a bitmap character is outside the LCD display area, the character will not be displayed.
PARAMETERS
NOTE Execute the TextWindowFramefunction before using this function.
*windowis a pointer to a font descriptor.RETURN VALUE
chis a character to be displayed on the LCD.
SEE ALSO
- None.
TextGotoXY, TextPrintf, TextWindowFrame, TextCursorLocation
void TextPrintf(struct windowFrame *window, char *fmt, ...);
- Prints a formatted string (much like
printf) on the LCD screen. Only printable characters in the font set are printed, also escape sequences, '\r' and '\n' are recognized. All other escape sequences will be skipped over; for example, '\b' and 't' will print if they exist in the font set, but will not have any effect as control characters.
- The text window feature provides end-of-line wrapping and clipping after the character in the last column and row is displayed.
PARAMETERS
NOTE Execute the TextWindowFramefunction before using this function.
*windowis a pointer to a font descriptor.
*fmtis a formatted string.EXAMPLE
...are formatted string conversion parameter(s).
TextPrintf(&TextWindow, "Test %d\n", count);RETURN VALUE
SEE ALSO
- None.
TextGotoXY, TextPutChar, TextWindowFrame, TextCursorLocationB.7.3 Keypad
The functions used to control the keypad are contained in the KEYPAD7.LIB library located in the Dynamic C KEYPADS library directory.
void keyInit(void);
RETURN VALUE
- Initializes keypad process
SEE ALSO
- None.
brdInit
void keyConfig(char cRaw, char cPress, char cRelease, char cCntHold, char cSpdLo, char cCntLo, char cSpdHi);
PARAMETERS
- Assigns each key with key press and release codes, and hold and repeat ticks for auto repeat and debouncing.
cRawis a raw key code index.1x7 keypad matrix with raw key code index assignments (in brackets):
- User Keypad Interface
cPressis a key press codeAn 8-bit value is returned when a key is pressed.
0 = Unused.See
keypadDef()for default press codes.
cReleaseis a key release code.An 8-bit value is returned when a key is pressed.
0 = Unused.
cCntHoldis a hold tick.How long to hold before repeating.
0 = No Repeat.
cSpdLois a low-speed repeat tick.How many times to repeat.
0 = None.
cCntLois a low-speed hold tick.How long to hold before going to high-speed repeat.
0 = Slow Only.
cSpdHiis a high-speed repeat tick.How many times to repeat after low speed repeat.
RETURN VALUE
0 = None.
SEE ALSO
- None.
keyProcess, keyGet, keypadDef
void keyProcess(void);
- Scans and processes keypad data for key assignment, debouncing, press and release, and repeat.
RETURN VALUE
NOTE This function is also able to process an 8 × 8 matrix keypad.
SEE ALSO
- None
keyConfig, keyGet, keypadDef
char keyGet(void);
RETURN VALUE
- Get next keypress
SEE ALSO
- The next keypress, or 0 if none
keyConfig, keyProcess, keypadDef
int keyUnget(char cKey);
PARAMETER
- Push keypress on top of input queue
RETURN VALUE
cKeyis the key being pressed
SEE ALSO
- None.
keyGet
void keypadDef();
- Configures the physical layout of the keypad with the desired ASCII return key codes.
where
'E' represents the ENTER key
'D' represents Down Scroll
'U' represents Up Scroll
'R' represents Right Scroll
'L' represents Left Scroll
- Example: Do the following for the above physical vs. ASCII return key codes.
keyConfig ( 3,'R',0, 0, 0, 0, 0 );
keyConfig ( 6,'E',0, 0, 0, 0, 0 );
keyConfig ( 2,'D',0, 0, 0, 0, 0 );
keyConfig ( 4,'-',0, 0, 0, 0, 0 );
keyConfig ( 1,'U',0, 0, 0, 0, 0 );
keyConfig ( 5,'+',0, 0, 0, 0, 0 );
keyConfig ( 0,'L',0, 0, 0, 0, 0 );RETURN VALUE
- Characters are returned upon keypress with no repeat.
SEE ALSO
- None.
keyConfig, keyGet, keyProcess
void keyScan(char *pcKeys);
- Writes "1" to each row and reads the value. The position of a keypress is indicated by a zero value in a bit position.
- PARAMETER
RETURN VALUE
*pcKeysis the address of the value read.
SEE ALSO
- None.
keyConfig, keyGet, keypadDef, keyProcess
B.8 Sample Programs
The following sample programs are found in the
122x32_1x7subdirectory inSAMPLES\LCD_Keypad.
ALPHANUM.C--Demonstrates how to create messages using the keypad and then displaying them on the LCD display.
COFTERMA.C--Demonstrates cofunctions, the cofunction serial library, and using a serial ANSI terminal such as Hyperterminal from an available COM port connection.
DISPPONG.C--Demonstrates output to LCD display.
DKADEMO1.C--Demonstrates some of the LCD/keypad module font and bitmap manipulation features with horizontal and vertical scrolling, and using theGRAPHIC.LIBlibrary.
FUN.C--Demonstrates drawing primitive features (lines, circles, polygons) using theGRAPHIC.LIBlibrary
KEYBASIC.C--Demonstrates the following keypad functions in the STDIO display window:- default ASCII keypad return values.
- custom ASCII keypad return values.
- keypad repeat functionality.
KEYMENU.C--Demonstrates how to implement a menu system using a highlight bar on a graphic LCD display. The menu options for this sample are as follows.
LED.C--Demonstrates how to toggle the LEDs on the LCD/keypad module.
SCROLLING.C--Demonstrates scrolling features of theGRAPHIC.LIBlibrary.
TEXT.C--Demonstrates the text functions in theGRAPHIC.LIBlibrary. Here is a list of what is demonstrated.2. Text window initialization.
3. Text window, end-of-line wraparound, end-of-text window clipping, line feed, and carriage return.
The following sample programs, found in the
TCPIPsubdirectory inSAMPLES/LCD_Keypad/122x32_1x7, are targeted at the Ethernet-enabled versions of the Smart Star, the Smart Star and the BL2110. Remember to configure the IP address, netmask, and gateway as indicated in the sample programs.
MBOXDEMO.C--This program implements a web server that allows e-mail messages to be entered that are then shown on the LCD display. The keypad allows you to scroll within messages, flip to other e-mails, mark messages as read, and delete e-mails. When a new e-mail arrives, an LED turns on, and turns off once the message has been marked as read. A log of all e-mail actions is kept, and can be displayed in the Web browser. All current e-mails can also be read with the Web browser.
- When using
MBOXDEMO.C, connect the Smart Star and a PC (or other device with a Web Browser) to an Ethernet. If you connect the PC and the Smart Star directly, be sure to use a crossover Ethernet cable; strait-through Ethernet cables and a hub may be used instead.
TCP_RESPOND.C--This program andTCP_SEND.Care executed on two separate single-board computers to demonstrate how the two boards communicate with each other. UsePCSEND.EXEon the PC console side at the command prompt if you do not have a second board.PCSEND.EXEis located with source code in theSAMPLES/LCD_Keypad/Windowsdirectory.
TCP_RESPOND.Cwaits for a message from another single-board computer. The message received is displayed on the LCD, and you may respond by pressing a key on the keypad. The response is then sent to the remote single-board computer.
TCPSEND.C--This program andTCP_RESPOND.Care executed on two separate single-board computers to demonstrate how the two boards communicate with each other. UsePCRESPOND.EXEon the PC console side at the command prompt if you do not have a second board.PCRESPOND.EXEis located with source code in theSAMPLES/LCD_Keypad/Windowsdirectory.
- When a key on the keypad is pressed, a message associated with that key is sent to a specified destination address and port. The destination then responds to that message. The response is displayed on the LCD.
- Note that only the LEFT and UP scroll keys are set up to cause a message to be sent.
When using
TCPSEND.CandTCP_RESPOND.C, connect the Smart Star and the other single-board computer to an Ethernet. If you connect the them directly, be sure to use a crossover Ethernet cable; straight-through Ethernet cables and a hub may be used instead.
| Z-World http://www.zworld.com Voice: (530) 757-3737 FAX: (530) 757-3792 sales@zworld.com |