Top  Previous  Next


Binds a BASCOM Graphic File into the program for use with Graphic LCD displays.




$BGF "file"




"file" is the name of the BGF file that is included in the program,

BMP files can be converted with the Tools Graphic Converter.



See also






'                         (c) 1995-2006 MCS Electronics

'                               GLCD.BAS

'            Sample to show support for T6963C based graphic display

'            Only 240*64 display is supported with 30 columns(yet)

'            At the moment the display can only be used in PORT mode

' Connection :

' P1.0 - P1.7  to DB0-DB7 of LCD

' P3.2         to FS, font select of LCD can be hard wired too

' P3.5         to CE, chip enable of LCD

' P3.4         to CD, code/data select of LCD

' P3.6         to WR of LCD

' P3.7         to RD of LCD

'A future version will allow external data access too which also uses RD and WR

'The display from www.conrad.com needs a negative voltage for the contrast.

'I used two 9 V batteries


'configure the LCD display

Config Graphlcd = 240 * 64 , Port = P1 , Ce = P3.5 , Cd = P3.4 , Cols = 30


'dimension some variables used by the DEMO

Dim X As Byte , Y As Byte



Reset P3.2                                                   '8 bit wide char is 30 columns



'The following statements are supported:

Cls                                                         'will clear graphic and text

'cls TEXT will clear only the text

'cls GRAPH will clear only the graphic part


'To init the display manual you can use:


'But this should not be needed as it is initilised at start up.


'Locate is supported and you can use 1-8 for the row and 1-30 for the column

Locate 1 , 1


'cursor control is the same as for normal LCD

Cursor On Blink


'And to show some text you can use LCD

Lcd "Hello world"

'Note that the cursor position is not adjusted. You can set it with locate


'Now comes the fun part for using a graphic LCD

'We can display a BMP file. You may use MSPAINT or any other tool that can create

'a BMP file. With the Graphic converter from the Tools Menu you can convert the file

'into a BGF file. (BASCOM GRAPHICS FILE). The conversion will convert all non white

'pixels to BLACK.


'To display the BGF file you use the SHOWPIC statement that needs an X and Y parameter

'the third param is the label where the data is stored.

'The position must be divideble by 8 because this is the way the display handles the data


Showpic 0 , 0 , Picture1


'And we use the PSET known from QB to set or reset a single pixel

'A value of 0 means clear the pixel and 1 means set the pixel


'create a block

For X = 0 To 10

For Y = 0 To 10

  Pset X , Y , 1




'You could remove it too

For X = 0 To 10

For Y = 0 To 10 Step 2

  Pset X , Y , 0




'A simple scope or data logger could be made with PSET !

'We hope to get an AN from an inspired user :-)



'label for the picture


'$BGF includes the data from the specified file

$bgf "samples\mcs.bgf"