Hi Jeremy,
You got it.And if I'm reading this right, PBPro knows that if you send an '$FE', the next character down the line, whether it's in the same statement or not, will be an lcd 'command'.
When PBP see's a $FE, it sets FLAGS.0 (LCDCDFLAG).
Which means that the next character is a command. And then when sending the next char, it sets the RS pin LOW.
And, while of no use but an example, if you were to do this...It would do a Clear Screen.Code:FLAGS.0 = 1 LCDOUT 1
For the HD44780's Character Table, The last 2 characters $FE and $FF are "all pixels OFF" and "all pixels ON" respectively. And, since "all pixels OFF" is the same thing as a Space, it's likely to assume that $FE will never be used to display a character. So it's available to initiate the Command sequence.Why did MeLabs pick $FE as the 'command' character anyways? Why not $FF or $CD or whatever?
So all you really need to do for a backpack is, make sure that you don't miss any incomming data, and pass it all on to the LCDOUT command.
But, there can be some advantage to separating the Clear Screen and Home commands, like you've been doing.
They take the longest to execute (1.6-4.5ms) depending on the display. But LCD_COMMANDUS delays the same amount no matter which command is supplied. Commands like moving the cursor to a new location may only take between 40-120us (same as LCD_DATAUS), but LCDOUT will still wait the full LCD_COMMANDUS time (usually 2000us).
For a backpack, if you reduce the LCD_COMMANDUS time, and detect the Clear Screen and Home to add a longer pause. It can increase the speed to a point where you don't even need to buffer the data up to 9600 baud.
Bookmarks