lcdout 4bit v 8bit bus


Closed Thread
Results 1 to 5 of 5
  1. #1

    Default lcdout 4bit v 8bit bus

    I'm looking at a parallel data bus 4x20 44780 lcd for my next project. I'm happy to dedicate a full port to the data bus but have a few questions.

    1) When driving the lcd is the 8 bit version twice as fast as the 4 bit version. presumably it only uses one clock cycle instead of two?

    2) Is the lcdout command immune from being interrupted by say a tmr1 interrupt DT or assembler?
    I assume it isnt but once the data is in the port register and written out it doesnt matter anyway.
    It seems to me the 8 bit bus would be less suseptible to interrupts as all the data for a byte is sent with one clock out? Interupts between bytes don't matter I assume.

    I have used serial lcd's before and although convenient they are suceptible to the software serout routines being interrupted. I appreciate I could use usart but that is already in use.

    Thoughts?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: lcdout 4bit v 8bit bus

    LCDOUT is a synchronous command, so it is not affected by interrupts in either 4-bit or 8-bit modes.

    8-bit is a little faster than 4-bit, but not much. The difference is a couple of instruction cycles.
    After each data byte there is a ~50uS pause, and after commands there is a ~2mS pause, so those couple of instruction cycles are not noticable.

    In a noisy environment with long wires going to the LCD, it's possible that 4-bit mode can get out of synch with the two nibbles resulting in garbage being displayed until it's reset. 8-bit will not do that.

    You can use interrupt driven bit-banged serial to a serial LCD to eliminate the problem with interrupts if the USART is in use.
    An example of that for 18F's can be found here ... http://www.picbasic.co.uk/forum/show...3931#post53931
    It works on any pin too.
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: lcdout 4bit v 8bit bus

    Thanks Darrel on final question.

    How do the code space requirements differ between say the lcdout command driving 8 bit bus and the debug command driving an output at 9600,8,N,1

    I already use debug as my serial lcd driver and use it many times throughout my programs just worried about the impact of lcdout using more code space?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: lcdout 4bit v 8bit bus

    The library code for LCDOUT is smaller than DEBUG since it doesn't have to do all that timing.

    But once the code is in the library, there is no difference since the actual instances of the commands in your program use calls to the library code. Modifiers like DEC, HEX, STR will use additional common library routines that are the same for both commands too.
    DT

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: lcdout 4bit v 8bit bus

    I normally drive LCDs in 4-bit mode, since I can always use the extra pins. I'm also in a noisy environment. I generally use a ribbon cable of 28" or so between the PIC and the LCD. Every once in a great while, I have the
    sync problem that Darrel mentions. Most of my code runs on a 1 (sometimes 2) second main loop that is timed by an interrupt-driven counter. Every minute (30 program loops), I set the variable
    flags = 1. This is an internal PBP register that forces complete re-initialization of the LCD on the next LCDOUT. This re-syncronizes things, but remember that this reinitialization takes a long time (150mSec if I remember corectly - but I'm sure someone will correct me if I'm wrong).
    Charles Linquist

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