having problems with Hantronix 20x4 lcd


Results 1 to 17 of 17

Threaded View

  1. #11
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi

    When you power-up the LCD, its cursor position is on line 1 position 1.
    The LCD does that automatically. Also when you clear the LCD the
    cursor will go back to line 1 position 1.

    So if just after LCD power-up or after a LCD clear you write the PicBasic code ....

    Lcdout "test"

    ... the word "test" will be displayed one line 1 and will use the first 4 locations on line 1.

    * * *

    To input instructions to the LCD module, such as clear screen, go to line 2, etc., you
    must prefix the instruction with 254 (0xFE). The byte following prefix is seen and
    treated as a instruction code. After the instruction code, the LCD automatically returns
    to text mode. Every instruction code must be sent with its own 254 prefix (0xFE).

    Cursor position on a four lines LCD:

    To move the cursor to the beginning of the first line and display a text you will need
    to send the prefix $FE, the instruction code $80 and the text to be displayed.

    Example:
    LCDOUT $FE,$80, "Hello on line 1"

    To move the cursor to the beginning of the second line and display a text you will need
    to send the prefix $FE, the instruction code $C0 and the text to be displayed.

    Example:
    LCDOUT $FE,$C0, "Hello on line 2"

    To move the cursor to the beginning of the third line and display a text you will need
    to send the prefix $FE, the instruction code $94 and the text to be displayed.

    Example:
    LCDOUT $FE,$94, "Hello on line 3"

    To move the cursor to the beginning of the fourth line and display a text you will need
    to send the prefix $FE, the instruction code $D4 and the text to be displayed.

    Example:
    LCDOUT $FE,$D4, "Hello on line 4"

    * * *


    In your program, just after LCD power-up or just after a display clear you send:

    lcdout $FE, $00 + 0, "LINE 1"

    With the above code you just send a NOP instruction ($0) to the LCD controller.
    (NOP = Short for No OPeration). The LCD controller ignores your NOP instruction and
    will stay on line 1 position 1 and the output text "LINE 1" will go
    on line 1 position 1 because you don't have changed the LCD cursor position.

    Try to write a text on line 2 and then, without clearing line 2, go to line 1 and write a text on line 1.
    If you tray that you will understand the purpose of the PicBasic code
    LCDOUT $FE,$80, "Hello on line 1".

    Best regards,

    Luciano
    Last edited by Luciano; - 19th December 2005 at 11:39.

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Pic18f452 with 20x4 LCD Help
    By djmachine in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th November 2008, 22:43
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD 20X4 connect with DS1820
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th March 2005, 11:04

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts