How exactly LCDOUT statement works?


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    $FE is the "signal" to the compiler that the next byte should be sent to the LCD as a command and not as data. The fact that it's $FE and not something else is most likely because $FE in the character set of the HD44780 is a white space (at least in ROM code A00) which there already is a valid ASCII code for within the character set ($20).

    DEFINE LCD_BITS 8 will instruct the compiler to talk to the LCD in 8-bit mode. This IS covered in the manual, there's even setup code and schematic for 8-bit mode. The LCDOUT command itself is used exactly the same, no matter 4 or 8 bit mode. Read through the section on LCDOUT again.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    I know how to set up 8 bit connection.
    I want to learn how to transfer 8 or 16 bits with 4 bit connection.
    Because say

    LCDOUT $FE,0,1

    is NOT equal (in terms what I see on display)

    to

    LCDOUT $FE,0
    LCDOUT $FE,1

    So I guess, on each LCDOUT statement, there's something special made to display. So I'm interested exactly what happens.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    Again, $FE is the "signal" to the compiler that the next byte should be sent to the LCD as a command and not as data.

    LCDOUT $FE, 0, 1 will send the value 0 to the instruction register and then the value 1 to the data register of the LCD controller.
    LCDOUT $FE, 0, $FE, 1 will send 0 and 1, both to the instruction register.

    On the LCD controller the RS-pin is what controls which register the data ends up with. $FE tells the compiler to generate code that pulls the RS-line LOW for the duration of the next byte transfer. It's as simple as that and it feels to me like your reading too much into it.
    Last edited by HenrikOlsson; - 7th August 2021 at 21:35.

  4. #4
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    I'm trying to deal with ST7920 controller, to enable the graphics mode.
    It needs a complex initialization sequence. (like send this, then wait xx ms, then pull e high, then pull e down, then wait again, then send and so on) To make things simpler, I wanted to use LCDOUT, instead of port bitbanging, but as it seems, that is impossible.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    Well, LCDOUT is designed for 44780 compatible controllers. A quick look at the ST7920 datasheet seems to indicate that it's sort of compatible but with extended functionallity. It may or may not work with LCDOUT.
    Do you have it connected with 4-bit or 8-bit interface?

    I would let the compiler do the initial initalization, setting 4/8-bit interface etc. Then I would make two manual writes enabling graphics mode and extended function set mode, making SURE I don't change the 4/8-bit mode flag when doing so. See the note in the datasheet that you can't change DL, RE, and G at the same time, hence the multiple writes. Provided 4-bit interface is used I would try:
    Code:
    LCDOUT $FE, %00100100   ' Enable extended instruction set, keep 4-bit interface.
    LCDOUT $FE, %00100110   ' Enable graphics mode, keep 4-bit interface and extended instruction set.

  6. #6
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    Yes I have it connected via 4 bit interface. This is a special kind of ST7920 module, which has physical dimensions and pinout of standard 1602 LCD module, and in most cases, just works as drop-in replacement.
    So far, I've figured an easy ways how to use LCDOUT to display all extended characters and features for this display. The graphic mode remains a mystery. My idea is to develop a PBP code, which will allow to use this module with existing 1602 LCD codes with as less modification, as possible.

    I will try your solution today later and will write back.

  7. #7
    Join Date
    Feb 2013
    Posts
    1,123


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    Just a note to myself or anyone else having same situation - the recommended approach works. While I have not tested it with ST7920, I do tested it with PT6314 for adjusting the VFD brightness and it does works.

Similar Threads

  1. DS3231 works in one config, but does not works with other IC.
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd December 2019, 19:52
  2. Alternate If-Then Statement Help
    By pdegior in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th August 2007, 00:07
  3. using AND as an IF statement
    By dw_pic in forum mel PIC BASIC
    Replies: 27
    Last Post: - 8th June 2006, 18:05
  4. 8bit LCDout vs 4bit LCDout
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th May 2006, 12:16
  5. A simple IF Statement!!!!
    By mslaney in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 17th February 2005, 20:58

Members who have read this thread : 1

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