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?
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?
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.
.......................Commands are sent to the LCD by sending a $FE followed by the command. ie not dataWhat 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
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.
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 transferAlso, 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?
Warning I'm not a teacher
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.
$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.
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.
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.
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.
Bookmarks