How exactly LCDOUT statement works?


Closed Thread
Results 1 to 33 of 33

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    Also, it is possible to use 4 or 8 bits for controlling the LCD module. But some statements want to send bytes to DB7-DB4 ports. How this is done via 4 bit hardware connection?

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    5.38 LCDOUT
    LCDOUT Item{,Item...}
    Display Items on an intelligent Liquid Crystal Display. PBP supports LCD modules with a Hitachi 44780 controller or equivalent. These LCDs usually have a 14- or 16-pin single- or dual-row header at one edge.
    .......................
    What is $FE for LCDOUT and why it is mandatory? (I tried removing it and sending next statement without it - it does not works) This is 1111 1110 in BIN, and I can understand that it might be used for display initialization, but as most display manuals say, for initialization you have to send 0000 0001. This means, this statement works in reverse? If it is not for initialization, then why LCDOUT $FE, $1 does the same
    Commands are sent to the LCD by sending a $FE followed by the command. ie not data
    read the manual

    5.38 LCDOUT
    The LCD may be connected to the PIC MCU using either a 4-bit bus or an 8-bit bus. If an 8-bit bus is used, all 8 bits must be on one port. If a 4-bit bus is used, the top 4 LCD data bits must be connected to either the bottom 4 or top 4 bits of one port.

    Also, it is possible to use 4 or 8 bits for controlling the LCD module. But some statements want to send bytes to DB7-DB4 ports. How this is done via 4 bit hardware connection?
    44780 or equivalent controllers Have a 4 bit i/f protocol that pbp can use to send 8 bit data or commands to the display by breaking it into nibbles for transfer
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    Default Re: How exactly LCDOUT statement works?

    I have read manual, and it says nothing about $FE, and why it can't be $DC, for example.

    And how this breaking into nibbles is done?
    Can I have an example?
    I mean, how can I instruct LCDOUT to send 8 bit data command.

  4. #4
    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.

  5. #5
    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.

  6. #6
    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.

  7. #7
    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.

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