LCD driver for KS0073 (similar to HD44780) controller making use of costates

Hi
this is some code I wrote for a university project. It is a driver for the KS0073 controller (very similar to the HD44780, but supports 4*20 chars). It features costates and shadow memory. This allows very efficient, buffered writes to the display. The code is under GPL v3(!). Other licenses can be discussed, as I wrote the whole thing from scratch.
Morty

Hi,

 Thanks for the code.Can you please provide me the hardware connection details.

As the admins here seems to loose files and it’s not possible to reach them because of a spam-filter that rejects mails from a not listet server and it’s not possible to edit post older then three days

I just upload the file again.

Adjusting the macros you can run the LCD on any port. You should try to understand the code - it isn’t too complicated.

Hi morty,

Thanks for the code. I have a couple questions. I figured out your intended hardware connections. I’ve got it on PortA with D0-D3 hooked to A4-A7 and RS, RW, and E on A1-A3. But there seems to be a discrepancy in the code between 4-bit and 8-bit mode in different sections of the code. In lcd_init you seem to enable 4-bit more, but then you reference 8-bit mode in lcd_update. ??

Would you reply with a snippet of intended usage in the void main(void) block of the code. I gather one needs to call, lcd_init, then lcd_write and then lcd_update? Or maybe I don’t have it right?

Thanks.

The Code is for 4-Bit mode. Thanks to the electrical setup I had, I sometimes lost or won a nibble - I never found out why. To reinitialize the communication you have to switch to 8-Bit and back to 4-Bit.

Yes. You need lcd_init to initialize your display and the shadow-mem. You might also need to adjust the code according to your LCD-Settings.

The lcd_update goes into a costate.

lcd_write and lcd_writeln are used from non-LCD-Code to write something to the lcd.

And lcd_setcurs makes sure the cursor is at a certain position. E.g. for input.

As I’m giving this away for free, (and never got payed for it, but with a good mark), I not really willing to give support.