Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
DiosPro Universal LCD CarrierAssembly and Hookup Manual
Manual Version 2.3
www.kronosrobotics.com
•Printed Circuit Board•Assembly and Hookup Manual• RS232 Driver Chip• 40 Pin Socket• 16 Pin Socket• 6, .1uf Capacitors• 10k Resistor• 1K Trimmer• 2, 100k Resistors• 2, 10uf Capacitors• 10Mhz Resonator• 9 Pin DSub Connector• 2.1 Coax• 7805 5v Regulator• 2, 2 pin header2• 5, 3 pin headers• 4 pin header• 5 pin header• 2, 6 pin headers• 8 pin header• 16 pin header• 20 pin header• 16 pin female header• 20 pin female header• 7 Jumpers
DiosPro Chip and LCD Not Included
The Universal LCD kitincludes the following:
Now Supports the following graphic LCD’s
Sparkfun 128x64 (Best Buy)
CrystalfontzCFAG12864B-YYH-VCFAG12864B-TMI-V
JamecoHantronix HDM64GS12 #658953
Most 16-pin Character LCDs
Page 3
Contents
www.kronosrobotics.com
Character LCD Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18Graphic LCD Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19KS0107/KS0108 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19Dios Library Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19Display layout (low level) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19Display layout (high level) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20Character Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20Pixel Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21Software Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21High Level Character Commands . . . . . . . . . . . . . . . . . . . . . . . . . . .21High Level Pixel Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23High Level Strip Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25High Level Fill Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26Where to get the DiosUGLCD.lib file . . . . . . . . . . . . . . . . . . . . . . .27
Chapter 3: Universal LCD Operation
LCD Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12UART Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13Matrix Keypad Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13IO Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13RS232 Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13EXT Power Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13Power Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14Using the Universal Graphic Connector . . . . . . . . . . . . . . . . . . . . .14DB9 Connector Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15LCD Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16Backlight Hookup and Operation . . . . . . . . . . . . . . . . . . . . . . . . . . .17
Chapter 2: Universal LCD Hookup
Chapter 1: Universal LCD AssemblyAssembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
1: Assembly
www.kronosrobotics.comPage 4
Step 1
Insert the 10K resistor into the position marked R3. Solder in place and clip leads. Save the clippedleads, you will use them for jumpers later.
10k = Brown, Black ,Orange, Gold
Step 2
Insert the 100K resistors into the position marked R4 and R5. Solder in place and clip leads. Savethe clipped leads, you will use them for jumpers later.
100k = Brown, Black ,Yellow, Gold
Step 3
Insert one of the .1uf capacitors into the position marked C8. Solder in place and clip leads.
Step 4
Insert one of the 10Mhz Resonator into the position marked X1. Solder in place and clip leads.
Assembly Step 1Step 2Step 3Step 4
1: Assembly
www.kronosrobotics.com Page 5
Step 5
Insert three of the .1uf capacitors into the positions marked C3, C4 and C5. Solder in place and clipthe leads.
Step 6
Insert the remaining 2 .1uf capacitors into the positions marked C6 and C7. Solder in place and clipthe leads. Note that these capacitors will sit inside the socket.
Hint: You can place the socket over the capacitors before you solder in place. This will allow everything to line up before you solder.
Step 5
Step 6
1: Assembly
www.kronosrobotics.comPage 6
Step 7
Insert the 4 jumpers into the positions marked J1, J2, J3 and J4 as shown and solder in place.
ImportantIf you plan on using a Jameco graphic LCD #658953 then do not install the upper most jumper. Thiswill free up the CTS lead charge pump on the RS232 driver to supply the negative voltage needed todrive the display. The CTS lead is hardly ever used and is not needed to program or opperate thedisplay.
Step 8
Insert 2 jumpers into the positions marked R1 and R2 and solder in place.
Note use the leads clipped from the resistors you installed in previous steps. An extra 10Kresistoris also included to provide you with 2 additional jumpers.
Step 7
Step 8
1: Assembly
www.kronosrobotics.com Page 7
Step 9
Insert the 16 pin socket into the position marked U3. Make sure the notch is facing up as shown.Solder in place.
Step 10
Insert the 5v regulator into the position marked U2 as shown and solder in place. Clip the leads
Step 11
Insert the 2 10uf capacitors into positions marked C1 and C2. You will need to bend the leads priorto installation. Make sure the band (negative) is facing the front of the board.
Step 12
Insert the 40 pin socket into the position marked U1. Make sure the notch is facing right as shown.Solder in place.
Step 9
Step 10 Step 11 Step 12
1: Assembly
www.kronosrobotics.comPage 8
Step 13
Insert the 9 pin Dsub and solder in place as shown. Make sure you solder the hole clips as well.
Step 14
Insert the 2.1 coax connector and solder in place.
Step 13Step 14
1: Assembly
www.kronosrobotics.com Page 9
Steps 15 - 20
Install the headers as shown in steps 15 through 20. You will need to do these one at a time. Solderin place. Note that these headers get installed on the underside of the board. You solder on the topside of the board.
Steps 21 - 23
Install the three pin headers as shown in steps 21 through 23. You will need to do these one at a time.Solder in place. Note that these headers get installed on the underside of the board. You solder onthe top side of the board.
Tip: You can double up the three pin headers and hold in place with a couple of the jumpers.
Step 24
Install the trimmer as shown and solder in place. Note that this trimmer gets installed on theunderside of the board. You solder on the top side of the board.
Step 25
Install the 2 pin header into the position shown. Place one of the jumpers on this header. Thisjumpers enables the PC to reset the board. (This is needed to program the board)
Step 15 Step 16Step 17
Step 18 Step 19 Step 20
Step 21 Step 22 Step 23
Step 24
Step 25
1: Assembly
www.kronosrobotics.comPage 10
Step 25
Insert the 16 pin female header into the position marked LCD1 as shown and solder in place.
Tip: solder only 1 pin and make sure the connector is strait before soldering all the remaining pins.
Step 26
Insert the 20 pin female header into the position shown and solder in place.
Step 27
Insert the RS232 driver into the 16 pin socket. Make sure the notch on the chip is facing up as shown.
Step 28
Insert the Dios Chip (Purchased Separatly) as shown. Make sure the notch is facing the right.
Step 25
Step 27
Step 28
Step 26
1: Assembly
www.kronosrobotics.com Page 11
!!! Warning !!! Do not power up the device without reading the hookup section of this manual. Failure to
do so could result in damaging your LCD
The 16 pin connector is used to connect your character LCD. Note that the LCD must haveHitachi HD44780 or equivalant controller.
The 20 pin connector is used to connect your graphic LCD. Note that this connector is com-patible with the CrystalFontz LCD models
•Sparkfun #LCD-00710 (Recommended)Get one at: http://www.sparkfun.com/commerce/product_info.php?products_id=710
•Crystalfontz CFAG12864B-YYH-V•Crystalfontz CFAG12864B-TMI-VSee them at: http://www.crystalfontz.com/products/index-grph.html
You may also use a Jameco #658953 Graphic LCD with a slight modification to the board. Thisis a Hantronix HDM64GS12L-4 Graphic LCD. See the text for the modifications needed.
http://www.jameco.com
2: Hookup
www.kronosrobotics.comPage 12
Programming andSerial InterfaceConnector
14-7v DCinputConnectorID 2.1CenterPositive
Character LCDConnector
-Vss
-Vdd
-Vo
-RS
- P
ort
23-R
W -
Po
rt 2
4-E
- P
ort
25-D
B0 -
NC
-DB1
- N
C-D
B2 -
NC
-DB3
- N
C-D
B4 -
Por
t 29
-DB5
- P
ort
28-D
B6 -
Por
t 27
-DB7
- P
ort
26-B
L+-B
L-
Vdd-
Vss-
Vo-
Port
29
- DB0
-Po
rt 2
8 -
DB1
-Po
rt 2
7 -
DB2
-Po
rt 2
6 -
DB3
-Po
rt 2
5 -
DB4
-Po
rt 2
4 -
DB5
-Po
rt 2
3 -
DB6
-Po
rt 2
2 -
DB7
-Po
rt 1
4 -
CS1-
Port
15
- CS
2-Vd
d -
RST-
Port
10
- RW
-Po
rt 1
1 -
DI-
Port
12
- E-
Vee
-BL
+BL
-
Graphic LCDConnector
LCD Connectors
When using the character LCDconnector your LCDmust match the pinout shown here if it does notit is not compatible with this board. The only exception is the backlight LED’s. The jumpers on R1and R2 may be omited it your LCD does not use an LED for backlight. They may also becrisscrossed to reverse the backlight polarity.
When using the graphic LCD connector if your LCDdoes not match the pinout shown youmay use the universal connector shown later in this chapter. The same is true with thebacklight LED as mentioned earlier.
2: Hookup
www.kronosrobotics.com Page 13
Port0 - Row1-Port1 - Row2-Port2 - Row3-Port3 - Row4-Port4 - Col1-Port5 - Col2-Port6 - Col3-Port7 - Col4-Matrix Keypad
Connector
Vss-Vdd-
Port8 - Rx-Port9 - Tx-
Port30 - Key-
UARTConnector
-Por
t21
-Por
t20
Port
19-P
ort1
8-P
ort1
7-P
ort1
6
IOConnector
-CTS
-DTR
-Tx
-Rx
-Vdd
-Vss
-VIN-Vss-Vdd-Coax
RS232Connector
Ext PowerConnector
PowerSwitch
ContrastTrimmer
UART Connector
TTL level connections to the onboard UART. The key pin will go high as long as a key on the keypadis pressed.
Matrix Keypad Connector
Connect these connections to your matrix keybad. If you are not using a keypad then you may usethe prots for other applications.
IO Connector
Dios IOports that currently are not used by the LCD’s or Keypad. These can be used for otherapplications
RS232 Connector
RS232 level connections to the onboard UART or program pins depending on the UART selectorjumpers. The CTS pin will go low as long as a key on the keypad is pressed. Asserting DTRwillreset the board. It is important that DTR is released for normal operation.
EXTPower Connector
This header allows you to provide power to the board with out using the 2.1 coax. You can supply 5vat Vdd or 14-7 volts to the Vin or Coax connector. The Coax pin will allow you to switch the poweron and off with the power switch header.
2: Hookup
www.kronosrobotics.comPage 14
Using the Universal Graphic Connector
The Universal LCD board has a special connector that can be jumpered for just about any GraphicLCD that utilizes a KS0107/KS0108 or HD61202 controller. If you are using one of the Sparkfunor CrystalFontz LCD’s mentioned earlyer you will install the header as shown in step 26.
The LCD must also have a built-in negative voltage generator.
To use the universal connector you must install the 20 pin female header into the top row as shown.
Now you make jumpers from row 2 to row three to convert the pinout on your LCD to that of theboard. As an example here is a list of jumpers to make the header compatible with a POWERTIPPG12864ERS-INN-H graphiv LCD.
A2 - B3B2 - A1C1 - C2D2 - P3E2 - O3F2 - Q3G2 - D3H2 - E3I2 - F3J2 - G3K2 - H3L2 - I3M2 - J3N2 - K3O2 - L3P2 - M3Q2 - N3R2 - R3S2 - R3T2 - T3
Vdd-
Vss-
Vo-
DB0
-DB1
-DB2
-DB3
-DB4
-DB5
-DB6
-DB7
-CS
1-CS
2-RS
T-RW
-DI- E-
Vee
-BL
+BL
-
Note that the jumpers may be placed on the top of the board orbottom of the board or a mixture of both.
If your LCD does not have a LED back light then leave thejumpers on BL+ and BL- off. It’s then up to you to provide thecorrect power to the backlight on your LCD.
IF your graphic LCDdoes not have a negative power source youwill need to provide it at Point E on Q3.
Power Switch
Use this header to connect a switch. This will allow you to swithch the power to the board on andoff. If you dont plan on using a power switch you should place a jumper on this header.
2: Hookup
www.kronosrobotics.com Page 15
DB9 Connector TX and Rx leadsare tied to the progrm Ports 16and 17
DB9 Connector TX and Rx leadsare tied to the UART. Ports 8and 9
DB9 Connector Selection
You may select the ports the TX and RXpins are connected to on the DB9 Connector. This willallow you to program the Dios and then use the UART as well.
If you are doing a lot of UARTtesting you can connect a DPDT switch to this jumper and switchthe connection as needed.
2: Hookup
www.kronosrobotics.comPage 16
LCD Type
Depending on the type LCD you are using you will need to set the following jumpers for properoperation. !!!Warning !!! Always set the LCD type jumpers with the power off before you placethe LCD into its appropriate socket.
Configure for CrystalFontzGraphic LCD. The negative volt-age generator will be tied to theVo for contrast udjustments.
Configure for Character LCD.Vdd will be tied to the Vo forcontrast udjustments.
Used with 4 linecharacter LCD’sonly. It sets thewidth for properline 3 and line 4operation.
16 Characters per line
20 Characters per line
Configure for Jameco GraphicLCD. See text as a jumper isneeded to tie RS232 Drivers neg-ative voltage pump to the LCD.
2: Hookup
www.kronosrobotics.com Page 17
Backlight Hookup and Operation
BL+ is tied to Vdd and BL- is tied to Port 13 on the Dios. To turn on the backlight we set Port 13 tooutput and drive it low as in:
output 13low 13
Port 13 is also a PWM generator on the Dios so you can also dim the backlight using the PWM library.
The DiosUGLCD library also has a command called GLCDLED that lets you control the backlight.
Normally R1 and R2 are just jumpered. This delivers just under 5v when the backlight is on full. Ifyour LCDneeds a lower LED voltage you may need to replace one of the jumpers with a resistor.
Using a Jameco #658953 (Hantronix HDM64GS12L-4)
In order to use the Hantronix Grpaphic LCD you need to add the jumper shown below. Important: Once the jumper wire is installed you may not use a character LCD unles the wire isremoved. Failing to do this could damage the LCD or board.
In addition you need to remove jumper 31 if youinstalled it previously. This jumper is seldom used soits removal will not affect funtionality.
Make sure you set the proper graphic jumper asshown on the previous page.
The Universal LCD board was designed to make it easy to connect both character or graphic LCD’sto the Dios. The board is compatable with the following displays:
CharacterAny parallel character based LCD that uses a Hitachi HD44780 or equivalent controller. The LCDmust have a top mount pin set.
GraphicThe 20 pin connector is used to connect your graphic LCD. Note that this connector is compatiblewith the CrystalFontz LCD models
Crystalfontz•Crystalfontz CFAG12864B-YYH-V•Crystalfontz CFAG12864B-TMI-VSee them at: http://www.crystalfontz.com/products/index-grph.html
Jameco•Hantronix HDM64GS12 #658953http://www.jameco.com
Display SelectionYou must set the display type with the LCD Type jumper before you connect the LCDto the board.
3: Operation
www.kronosrobotics.comPage 18
Character LCD Operation
If you are using a character LCD you will use the following LCD commands to display information onthe LCD.
• lcdinit 23,25,24,29,28,27,26• lcdchar• lcdwrite• lcdcontrol• lcdgoto
These commands are explained in the Dios Command Syntax manual.
func main()
output 13low 13
lcdinit 23,25,24,29,28,27,26 'RS, E, RW, D0,D1,D2,D3lcdgoto 1,1lcdwrite " Hello World"
endfunc
Example 1: A Simple Start for the character LCD interface
3: Operation
www.kronosrobotics.com Page 19
Graphic LCD Operation
The Graphic LCD is a bit more complicated, however with the DiosUGLCD.lib library the operation isa bit easyer.
Before we get into the library lets look at how the KS0107/KS0108 graphic controllers work.
KS0107/KS0108 Overview
The Universal LCD board is compatible with graphic LCD’s that are controlled by the KS0107/KS0108or compatible controller. This is a very popular controller and has made its way into many GraphicLCD’s.
In many cases the actual Graphic LCD will have multiple controllers stacked to create larger displaysizes. This board and library are compatible with those displays with dual controllers.
When writing to the controllers the CS1 and CS2 pins will be selected to turn on the appropriatecontroller. It is also possible to access both controllers at once. This is particularly nice wheninitializing and clearing the display.
The KS0107/KS0108 does not have a character generator so we provide it in software library.
Dios Library Overview
As popular as the KS0107/KS108 controller is, It does have its negatives. For one just about everypiece of documentation Ihave seen regarding this controller has terrible errors and are very hard tofollow. Also the nomenclature used seems to be counter intuitive.
For this reason I have created a set of libraries to access the low level memory of the LCD’s. Iwillbe using my own nomenclature that is much more intuitive.
It’s not necessary that you understand the low level technical layout of the libraries or the controller.I am simply presenting this information so you can expand upon the library if you wish.
Display layout (low level)
Display pages
The display is devided up into two sections Icall pages.
Each page displays 64x64 pixels and is controlled by its own controller. Many of the lower level librarycommands will contain a parameter for selecting the appropriate page.
Page 1 Page 2
3: Operation
www.kronosrobotics.comPage 20
Each page has 8 lines numbered 0-7.
Each line has 64 positions that contain a 1 pixel wide by 8 pixel tall strip.
These strips can be writen to or read from with the low level commands.
Display layout (high level)
At the high level we dont concern our selves with the the pages and strips. We simply issue acommand and the inner workings are handled for us.
Character Display
First lets look at the software character generator layout. The characters are 6x8 with only the 5x7portion of the character showing.
The display has 8 lines of 20 character data. An internalpointer keeps track of the current position and isincromented with each character sent to the display. Ifthe pointer reaches the end of the line the character willbe placed on the next line.
Line 0Line 1Line 2Line 3Line 4Line 5Line 6Line 7
Line 0Line 1Line 2Line 3Line 4Line 5Line 6Line 7
Page 1 Page 2
Bit 0
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Character line 0 (20 character positions)Character line 1 (20 character positions)Character line 2 (20 character positions)Character line 3 (20 character positions)Character line 4 (20 character positions)Character line 5 (20 character positions)Character line 6 (20 character positions)Character line 7 (20 character positions)
3: Operation
www.kronosrobotics.com Page 21
Pixel Display
The software pixel generator commands will automaticly take care of selecting the correctpage,line,pos and bit in the strip.
The routines read in the current strip where the pixel is located and set or reset the bit as indicatedthen write the modified strip back out to the display.
The pixels are aranged with the x coordinate along the width with the lowest pixel at the left (0) andthe highest at the right (127).
The y coordinate is aligned with the height with the lowest pixel at the top (0) and the highest at thebottom (63).
You write to the pixels with the GLCDsetpixel command. This command is independant of thecharacter display system and can display right over the top of the characters.
Software Library
The library is included with Dios Compiler versions 2.0.10 and greater. It will be added to your sourcecode any time one of the graphic commands are used.
High Level Character Commands
These high level commands are used to write characters or initilize the display.
X coord, 128 Pixels 0-127
Y coord, 64Pixels 0-63
Initilize Graphic LCD
GLCDinit or GLCDint2
The GLCDinit command is used to setup the ports and initialize the graphic LCD.It must be the first graphic LCD command called. See Example 1
Use the GLCDint2 command if you are using the Sparkfun or Hantronix(Jameco) graphic LCD.
GLCDinit / GLCDinit2
syntax
Description
3: Operation
www.kronosrobotics.comPage 22
Set Brightness level of the backlight LED
GLCDLED Level
Level: Integer value 0-255 that sets the LED brightness level.
This command will allow you to control the backlight LED. In order for this com-mand to work the LED negative lead must be connected to port 13 on the Dios.The positive lead should be connected to Vdd. See Example 1
GLCDLED
syntax
Operands:
Description:
Write text to the current position on LCD
GLCDchar Table,Text
Table: Table pointer, This sets the character table to use when writing charac-ters to display. currently the only valid table is called chars.
Text: Quoted text or string. These are the characters to print.
This command writes one or more characters to the LCD at a particular position.The characters will wrap automaticaly.
GLCDchar
syntax
Operands:
Description:
Write text to the LCD display at pos X and Y
GLCDcharpos Table,Line,Pos,Text
Table: Table pointer, This sets the character table to use when writing charac-ters to display. currently the only valid table is called chars.
Line: Integer value 0-7, This is the line to start printing on.
Pos: Integer value 0-20, This is the position on the line to start printing on.
Text: Quoted text or string. These are the characters to print.
This command writes one or more characters to the LCD at a particular position.The characters will wrap automaticaly. See Example 1
GLCDcharpos
syntax
Operands:
Description:
Clears the whole LCD display
GLCDclear
This command will clear the LCD.
GLCDclear
syntax
Description:
Fills the whole LCD display
GLCDfill
This command will write all pixels black.
GLCDfill
syntax
Description:
3: Operation
www.kronosrobotics.com Page 23
Sets a pixel on the display
GLCDsetpixel x,y,mode
x: Integer value 0-127, This is the x position on the display of the pixel youwish to change.
y: Integer value 0-63, This is the y position on the display of the pixel you wishto change.
mode: Integer value 0-2, The mode sets the way the pixel will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you set/reset/Xor a pixel on the display. See Example 1
GLCDsetpixel
syntax
Operands:
Description:
Sets the character position for the next character
GLCDsetcharxy Line,Pos
Line: Integer value 0-7, This is the line to start printing on.
Pos: Integer value 0-20, This is the position on the line to start printing on.
This commands lets you set position for the next character to display.
GLCDsetcharxy
syntax
Operands:
Description:
Sends a character to the display at the current position
GLCDcharrawl Table,char
Table: Table pointer, This sets the character table to use when writing charac-ters to display. currently the only valid table is called chars.
Char: Integer value 0-255, This is the character you wish to display
This commands lets you send a single character to the display. It will display atthe current position.
GLCDcharraw
syntax
Operands:
Description:
High Level Pixel Commands
These high level commands are used to write pixel data to the LCD display.
Draws a box on the display
GLCDbox x1,y1,x2,y2,mode
x1: Integer value 0-127, This is the starting x position of the box you wish todisplay.
y1: Integer value 0-63, This is the starting y position of the box you wish todisplay.
x2: Integer value 0-127, This is the ending x position of the box you wish to dis-play.
y2: Integer value 0-63, This is the ending y position of the box you wish to dis-play.
mode: Integer value 0-2, The mode sets the way the pixel will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you draw a box on the display.
GLCDbox
syntax
Operands:
Description:
3: Operation
www.kronosrobotics.comPage 24
Draws a filled in box on the display
GLCDboxfill x1,y1,x2,y2,mode
x1: Integer value 0-127, This is the starting x position of the box you wish todisplay.
y1: Integer value 0-63, This is the starting y position of the box you wish todisplay.
x2: Integer value 0-127, This is the ending x position of the box you wish to dis-play.
y2: Integer value 0-63, This is the ending y position of the box you wish to dis-play.
mode: Integer value 0-2, The mode sets the way the pixel will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you draw a box on the display. It is the same as theGLCDbox command except it is filled in.
GLCDboxfill
syntax
Operands:
Description:
Draws a line between two points on the display
GLCDline x1,y1,x2,y2,mode
x1: Integer value 0-127, This is the starting x position of the line you wish todisplay.
y1: Integer value 0-63, This is the starting y position of the line you wish to dis-play.
x2: Integer value 0-127, This is the ending x position of the line you wish to dis-play.
y2: Integer value 0-63, This is the ending y position of the line you wish to dis-play.
mode: Integer value 0-2, The mode sets the way the pixel will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you draw a line between two points on the display.
GLCDline
syntax
Operands:
Description:
Draws a horizontal line between two points on the display
GLCDhline x1,y1,y2,mode
x1: Integer value 0-127, This is the starting x position of the line you wish todisplay.
y1: Integer value 0-63, This is the starting y position of the line you wish to dis-play.
y2: Integer value 0-63, This is the ending y position of the line you wish to dis-play.
mode: Integer value 0-2, The mode sets the way the pixel will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you draw a horizontal line between two points on the dis-play. It can only draw horizontal strait lines but is much faster then the GLCDlinecommand.
GLCDhline
syntax
Operands:
Description:
3: Operation
www.kronosrobotics.com Page 25
Draws a vertical line between two points on the display
GLCDvline x1,y1,y2,mode
x1: Integer value 0-127, This is the starting x position of the line you wish todisplay.
y1: Integer value 0-63, This is the starting y position of the line you wish to dis-play.
x2: Integer value 0-63, This is the ending y position of the line you wish to dis-play.
mode: Integer value 0-2, The mode sets the way the pixel will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you draw a vertical line between two points on the display.It can only draw vertical strait lines but is much faster then the GLCDline com-mand.
GLCDvline
syntax
Operands:
Description:
High Level Strip Commands
These high level commands are used to display a 1 bit wide by 8 bit tall strip on the display.
Draws a strip on the display
GLCDstrippos Line,pos,Strip
Line: Integer value 0-7, This is the line to display the strip on.
Pos: Integer value 0-127, This is the position on the line to place the strip on.
Strip: Integer value 0-255. This is the strip data. 1 bit wide by 8 bits high bitmap.
This commands lets you draw a single 1x8 bitmap on the display.
GLCDstrippos
syntax
Operands:
Description:
Draws a strip on the display at current position
GLCDpagestrip Page,Strip
Page: Integer value 0-3, 0=dont display, 1=page 1, 2 = page 2, 3 = both pages
Strip: Integer value 0-255. This is the strip data. 1 bit wide by 8 bits high bitmap.
This commands lets you draw a single 1x8 bitmap on the display at the currentposition. Note that it is page dependant.
GLCDpagestrip
syntax
Operands:
Description:
Draws a strip on the display at a particular position
GLCDpagestrippos Page,Line,pos,Strip
Page: Integer value 0-3, 0=dont display, 1=page 1, 2 = page 2, 3 = both pages
Line: Integer value 0-7, This is the line to display the strip on.
Pos: Integer value 0-63, This is the position on the line to place the strip on.
Strip: Integer value 0-255. This is the strip data. 1 bit wide by 8 bits high bitmap.
This commands lets you draw a single 1x8 bitmap on the display Note that it ispage dependant.
GLCDpagestrippos
syntax
Operands:
Description:
3: Operation
www.kronosrobotics.comPage 26
Sets the display position of the next page strip
GLCDsetstrippos Page,Line,pos,Strip
Page: Integer value 0-3, 0=dont display, 1=page 1, 2 = page 2, 3 = both pages
Line: Integer value 0-7, This is the line to display the strip on.
Pos: Integer value 0-63, This is the position on the line to place the next stripon.
This command sets the display position for the next page strip display. This com-mand is page dependent.
GLCDsetstrippos
syntax
Operands:
Description:
High Level Fill Commands
These high level commands are used to fill in locations on the display.
Fills a line on the display with a particular strip
GLCDfillpageline Page,Line,Strip
Page: Integer value 0-3, 0=dont display, 1=page 1, 2 = page 2, 3 = both pages
Line: Integer value 0-7, This is the line to display the strip on.
Strip: Integer value 0-255. This is the strip data. 1 bit wide by 8 bits high bitmap.
This command fills a line on a page with a particular strip.
GLCDfillpageline
syntax
Operands:
Description:
Draw an advanced character or characters at a strip pos
GLCDchar Table,Line,Pos,Text,SzX,SzY,Sep[,INV]
Table: Table pointer, This sets the character table to use when writing charac-ters to display. currently the only valid table is called chars.
Line: Integer value 0-7, This is the line to display the strip on.
Pos: Integer value 0-63, This is the position on the line to place the next stripon.
Text: Quoted text or string. These are the characters to print.
Szx:The width of the characters. 1=5 pixels 2=10 pixels 3=15 pixels
Szy: The height of the character. 1=8 pixels 2 = 16 pixels
Sep: The number of pixels separating each character.
INV: Optional. Set to 1 to display the character inverted
This command sets the display a character or string of characters at a strip posi-tion. You can set the height and width of the character.
Note that this command is independant of the general character commands andwill not wrap or change the current character pos used by those routines.
GLCDstripchars
syntax
Operands:
Description:
3: Operation
www.kronosrobotics.com Page 27
Fills a page with a strip
GLCDfillpage Page,Strip
Page: Integer value 0-3, 0=dont display, 1=page 1, 2 = page 2, 3 = both pages
Strip: Integer value 0-255. This is the strip data. 1 bit wide by 8 bits high bitmap.
This command fills a complete page with a strip.
GLCDfillpage
syntax
Operands:
Description:
Fills the display with a strip
GLCDfilldisplay Strip
Strip: Integer value 0-255. This is the strip data. 1 bit wide by 8 bits high bitmap.
This command fills the complete display with a strip.
GLCDfilldisplay
syntax
Operands:
Description:
Clear the entire display
GLCDclear
This command clears both pages at once.
GLCDclear
syntax
Description:
Fill the entire display
GLCDfill
This command fills both pages with solid
GLCDfill
syntax
Description:
Draws a ellipse on the screen
GLCDellipse locx,locy,widthx,widthy,mode,angle,lenth
locx: Integer value 0-127, This is the starting x position of the ellipse you wishto display.
locy: Integer value 0-63, This is the starting y position of the ellipse you wishto display.
widthx: Integer value 0-127, This is the width of the ellipse.
widthy: Integer value 0-63, This is the height of the ellipse.
mode: Integer value 0-2, The mode sets the way the pixels will be drawn. 0 =Clear Pixel, 1 = Set Pixel, 2 = Xor Pixel.
This commands lets you draw a ellipse on the display.
GLCDellipse
syntax
Operands:
Description:
3: Operation
CPMotor2 • www.kronosrobotics.comPage 28
Web Sitehttp://www.kronosrobotics.com
'Crystalfontz KS0107/KS0108 Grahic LCDfunc main()
dim x,y
GLCDinitGLCDLED 200 'Turn on LCD backlight
for x = 0 to 127GLCDsetpixel x,0,1GLCDsetpixel x,63,1
next
for y = 0 to 63GLCDsetpixel 0,y,1GLCDsetpixel 127,y,1
next
GLCDcharpos chars,4,3,"Hello World"
endfunc
include \lib\DiosUGLCD.lib
Example 1: GLCDLED, GLCDinit, GLCDsetpixel andGLCDcharpos code example