Interfacing a Siemens DL2416T
Got some time today to finally give interfacing a DL2416T a go. Spent half an hour debugging the code and all the connections before realising i forgot to tie 74HC595’s master reset pin to HIGH…
The problem, of course, lying in the fact master reset is active when low. Anyways, got it to work and wrote some quicky functions for controlling the display. Here’s the result:
Here’s how it works. There are 2 address bus lines (A0-A1) that are used to select the digit you want to change. There are 7 data bus lines (D0-D6) that are used to select a character you’ll be writing. You set the address, then the data bus, then flash the write (WR) pin high for a bit (millisecond seems to work just fine) and the display takes care of everything else.
There are some other pins worth discussing. Chip enable pins (CE1-CE2) are used to address the right unit in multi-display configurations (you can hook up up to 4 DL2416Ts and control them with a single address and data buses). We’re only using one here, so i’ve got both hardwired LOW. The clear pin (CLR) clears the display’s RAM and, obviously, the text currently displayed. Hardwired HIGH because i don’t need it. BTW, all three (CE1, CE2 and CLR) are inverted, so they’re active LOW. The following two pins are for cursor control, which – again – i’m not using, so they’re hardwired LOW (cursor enable) and HIGH (cursor select, inverted). Finally, there’s the display blank (BL) pin, which simply blanks the display when HIGH, but doesn’t clear the RAM. If you PWM pulse it, you can also use it to control the display brightness. Curiously, it’s marked as active LOW, but actually blanks when pulsed HIGH. Yeah, i know, makes no sense to me either.
I’ve hooked the data bus lines to a shift register to reduce the number of pins used on the Arduino. The address bus and write pin are controlled directly. Character codes are actually ASCII-compliant, as long as you don’t go below 0x20 and above 0x5F. So i wrote a simple if-then that shifts the lowercase characters downrange to uppercase.
Here’s my writeChar function:
void writeChar(int character, int pos)
PORTD &= B11111100; // Mask the address pins A1 and A0
PORTD |= 3-pos; // Select digit
if (character<0x60) shiftOut(dataPin, clockPin, MSBFIRST, character); // Select character else shiftOut(dataPin, clockPin, MSBFIRST, character-0x20); // If uppercase, proceed, if lowercase, transform into uppercase digitalWrite(latchPin, HIGH); digitalWrite(pinWR, LOW); // Write delay(1); digitalWrite(pinWR, HIGH); }
I've set up a global variable four-character "buffer" that all the functions write to and a refreshScreen() function that pushes the buffer contents to the display. You can find the complete (ugly) code here.