Talking to character displays


#1

I made a little patch here that shows a strategy for talking to HD44780 character displays.

lcd-objs.axp (9.2 KB)

Basically, one object does the initialization and allocates a "display buffer". It runs a background thread that updates the display 10 times per second using the buffer (whether it's changed or not). The pointer to this buffer is output through a pink slot.

Other objects can get access to this buffer and draw to it. I made one object that converts a fract to an 8bit decimal number, and one that displays a string by doing a memcopy. These objects position themselves in the display. It's possible for one to overwrite the other, but this seems simpler than shoving strings into one mother object and letting that position them.

Using muxes, one can create menu hierarchies. Add a single pot and some latches to store the value for different pages and you can recreate that vintage rompler feeling on Axoloti.

The hd44780 object has an init button instead of running init code automatically. Press it once per power cycle, but not if you just go in/out of live mode.. there's a reason for this but it's very boring and I can't be bothered to type it out right now. It should be fixable.

There's a pin-out suggestion in the Local Data section of the hd44780 object. This has worked with the single display I tried it with based on a random datasheet. Be sure to double-check connection that you don't fry anything. Just because it worked for me doesn't mean it'll work for you, etc. etc. It's hard-coded to work with a 2x16 display, but larger ones should just be adjusting the size in a few places.

Let me know if this seems like a useful approach to making text menus on Axoloti!


#2

I have one of these displays but with an I2C backpack. I'm trying to figure out what I need to alter in your object code to speak I2C. Any ideas?