04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Commands<br />

Custom Shapes<br />

Custom characters can be created and used as sprites to form large graphics. The following example<br />

will display a 2 line by 3 character wide heart in the middle of a 2x16 LCD display. Experiments see<br />

what creative characters and sprites you can come up with. The leading 3 zeros have been left off the<br />

binary value due to space constraints. When creating the custom characters you will need to add the<br />

3 leading zeros. See example code.<br />

Bits -> 4 3 2 1 0 Bin 4 3 2 1 0 Bin 4 3 2 1 0 Bin<br />

Byte 0 00000 00000 00000<br />

Byte 1 00011 00000 11000<br />

Byte 2 00111 10001 11100<br />

Byte 3 01111 11011 11110<br />

Byte 4 01111 11111 11110<br />

Byte 5 11111 11111 11111<br />

Byte 6 11111 11111 11111<br />

Byte 7 11111 11111 11111<br />

Bits -> 4 3 2 1 0 Bin 4 3 2 1 0 4 3 2 1 0 Bin<br />

Byte 0 11111 11111 11111<br />

Byte 1 01111 11111 11110<br />

Byte 2 00111 11111 11100<br />

Byte 3 00011 11111 11000<br />

Byte 4 00001 11111 10000<br />

Byte 5 00000 11111 00000<br />

Byte 6 00000 01110 00000<br />

Byte 7 00000 00100 00000<br />

Example<br />

The following program will load all 6 custom characters and display them on a 2x16 LCD display<br />

using the schematics shown for LCDINIT. The program uses the hex values which can be generated<br />

by converting from binary to hex.<br />

lcdinit p0\p1\p2\p3\p4\p5<br />

;create custom heart character<br />

lcdwrite p0\p1\p2\p3\p4\p5,[cgram+0,0x00,0x03,0x07,0x0F,0x0F,0x1F,0x1F,0x1F]<br />

lcdwrite p0\p1\p2\p3\p4\p5,[0x00,0x00,0x11,0x1B,0x1F,0x1F,0x1F,0x1F]<br />

lcdwrite p0\p1\p2\p3\p4\p5,[0x00,0x18,0x1C,0x1E,0x1E,0x1F,0x1F,0x1F]<br />

lcdwrite p0\p1\p2\p3\p4\p5,[0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00]<br />

lcdwrite p0\p1\p2\p3\p4\p5,[0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x0E,0x04]<br />

lcdwrite p0\p1\p2\p3\p4\p5,[0x1F,0x1E,0x1C,0x18,0x10,0x00,0x00,0x00,scrram+0]<br />

lcdwrite p0\p1\p2\p3\p4\p5,[TWOLINE,SCR,0,1,2,scrram+0x40,3,4,5]<br />

end<br />

142

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!