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.

LCD Command Table<br />

Command Value Function<br />

Lcdclear $101 Clear display. Clears all on and off screen ram.<br />

Lcdhome $102 Return to home position.<br />

Inccur $104 Auto increment cursor (default).<br />

Incscr $105 Auto increment display.<br />

Deccur $106 Auto decrement cursor.<br />

Decscr $107 Auto decrement display.<br />

Off $108 Display, cursor and blink OFF.<br />

Scr $10C Display ON, cursor and blink OFF.<br />

Scrblk $10D Display and blink ON, cursor OFF.<br />

Scrcur $10E Display and cursor ON, blink OFF.<br />

Scrcurblk $10F Display, cursor and blink ON.<br />

Curleft $110 Move cursor left.<br />

Currright $114 Move cursor right.<br />

Oneline $120 Set display for 1 line LCDs.<br />

Twoline $128 Set display for 2 line LCDs.<br />

Cgram | address $140 Set CGRAM address for reading or writing.<br />

Scrram | address $180 Set display RAM address for reading or writing.<br />

Commands<br />

LCD Commands<br />

The LCD commands are used to setup the display instead of a separate command. The LCD display<br />

only needs to initialized once. If you are using a 2x16 LCD display you would need to issue the<br />

Twoline command. One of the SCR commands are required to turn the display on. Otherwise data<br />

will be written to the DDRAM but not displayed. The following code snippet turns the screen on, clears<br />

it and moves the cursor to home before printing “Hello World!”.<br />

;DEMO PROGRAM - LCDINIT.BAS<br />

Pause 500<br />

lcdinit p0\p1\p7\p6\p5\p4,p2<br />

lcdwrite p0\p1\p7\p6\p5\p4,p2, [CLEARLCD,HOMELCD,SCR,TWOLINE,”Hello World”]<br />

LCD DDRAM<br />

The HD44780 uses DDRAM to store ASCII characters. The one HD44780 control can handle up to<br />

4x20 ram location, this means one controller can drive up to a 4x20 screen. A 4x40 display would use<br />

two HD44780 controllers. With this in mind a 1x16 or 2x16 screen still has all the ram locations to<br />

make up a 2x20 display. Only certain locations will actually print to the display while the unused can<br />

be written to an characters can be stored for later shifting into the display area. The diagrams below<br />

illustrate how the memory map (DDRAM) is handled for each display.<br />

139

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

Saved successfully!

Ooh no, something went wrong!