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.
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?
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.
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).