DL2416 i2c help

Hi,

I’ve made a little board to control a pair of DL2416 displays with i2c, using a MCP23017 i/o expander. Everything works ok except half the ASCII characters!! I can display everything from 0x20 to 0x2F, and everything from 0x50 to 0x5F. But nothing from 0x40 to 0x4F and 0x30 to 0x3F. Here is an example that should illustrate.

B 010 0101 should be % displays %
B 011 0101 5 %
B 100 0101 E nothing
B 101 0101 U U

B 010 0110 & &
B 011 0110 6 &
B 100 0110 F nothing
B 101 0110 V V

The way the board is designed, I use PORTB as a control port and PORTA as the data port and use the Wire library to write to the port.

Here is the code I run:

#include "Wire.h"

void displayChar(char, int, byte);

void setup()
{
  // pin 2 and 3 control the BLank lines and shouldgo low then stay HIGH
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  digitalWrite(3, LOW);
  digitalWrite(2, LOW);
  delay(500);
  digitalWrite(3, HIGH);
  digitalWrite(2, HIGH);
  Wire.begin(); // wake up I2C bus
  // set I/O pins to outputs
  Wire.beginTransmission(0x20);
  Wire.write(0x00); // IODIRA register
  Wire.write(0x00); // set all of bank A to outputs
  Wire.endTransmission();

  Wire.beginTransmission(0x20);
  Wire.write(0x01); // IODIRB register
  Wire.write(0x00); // set all of bank B to outputs
  Wire.endTransmission();
  Serial.begin(9600);
}

void displayChar(char myChar, int myPos, byte myDisp){
  byte controlByte = B00010100;
  Serial.write(controlByte);
  if (myDisp == 0){
    controlByte = controlByte | 1<<0; // 00000001
  } 
  else {
    controlByte = controlByte | 1<<1; // 00000010
  }


  switch (myPos){
  case 0:
    controlByte = controlByte;
    break;
  case 1:
    controlByte = controlByte | 1<<7; // 10000000
    break;
  case 2:
    controlByte = controlByte | 1<<6; // 01000000
    break;
  case 3:
    controlByte = controlByte | 1<<6; // 01000000
    controlByte = controlByte | 1<<7; // 10000001
    break;
  }
  Serial.write(myChar);
  //take WR from high to LOW to enable writing
  Wire.beginTransmission(0x20);
  Wire.write(0x13); // GPIOB
  Wire.write(controlByte); // bank B
  Wire.endTransmission();
  delay(2);

  byte writeByte = controlByte & ~(1<<5); // set 00100000 off
  Wire.beginTransmission(0x20);
  Wire.write(0x13); // GPIOB
  Wire.write(writeByte); // bank B
  Wire.endTransmission();
  delay(2);

  myChar = myChar << 0;
  Wire.beginTransmission(0x20);
  Wire.write(0x12); // GPIOA
  Wire.write(myChar);
  Wire.endTransmission();
  delay(20);

  Wire.beginTransmission(0x20);
  Wire.write(0x13); // GPIOB
  Wire.write(controlByte); // bank B
  Wire.endTransmission();
  delay(2);
  delay(200);
}

void blankDisplay(){
  Wire.beginTransmission(0x20);
  Wire.write(0x13); // GPIOB
  Wire.write(B00110000); // bank B
  Wire.endTransmission();
  delay(20);
  Wire.beginTransmission(0x20);
  Wire.write(0x13); // GPIOB
  Wire.write(B00110100);
  Wire.endTransmission();
  delay(2);
}



void loop(){

  delay(500);
  //displayChar(char myChar, int myPos, byte myDisp)
  displayChar('%', 3, 1);
  displayChar('5', 2, 1);
  displayChar('E', 1, 1);
  displayChar('U', 0, 1);
  displayChar('&', 3, 0);
  displayChar('6', 2, 0);
  displayChar('F', 1, 0);
  displayChar('V', 0, 0);
  blankDisplay();
  delay(500);


}

I’m hoping it’s obvious to someone where I’ve gone wrong, but if I need to post more info, please let me know. Thanks.

I’ve attached a screenshot of the character set in case that makes it clearer.

Please clarify what you mean by 'nothing'.

Don

Nothing means a blank on that digit, the data sheet says:

"All other input codes display "blank," so I guess I should have said "blank."

Thanks for looking.

had something similar, was a bad wire with a parallel display

it looks like a problem with bit X 01X 0101

but as the display are I2C it might be a bad soldering between the I2C chip and the parallel display.

It's interesting that it looks like it's strange right there at bit 4 like you show, but it seems to change.

B 010 0101 should be % displays % B 01*1* 0101 5 % Here is seems to be LOW and wrong.... B 10*0* 0101 E nothing But here if it were LOW it should be correct, right? B 101 0101 U U

I have some 104 caps near the MCP23017, and near the displays power feed. There is also a 10uF near the display power feed, so I don't think it should be the common "capacitor" issues that are common. Maybe I should plug in a LED bar graph in place of the LED display and see what binary I am sending.

Thanks.

...the data sheet says:

This is why it is always a good idea to include a link to the data sheet when you have a question.

Are all of the characters in the 0x30 to 0x4F range showing up blank? What about the lower case letters (0x60 to 0x7F)?

Don

The datasheets for this part are a little hard to find, and I never can figure out how to use the big "millions of datasheets" sites. They seem to be more spam than datasheets. I'll see if I can find a good link to the DL2416t datasheet. (Edit: http://www.maxipub.com/electro/specs/dl2416.pdf

Yes, all the bytes I've tried in the 0x30 to 0x4F range seem to be blank. The 7-bit decoder in these chips only does ALL CAPS, so I cannot try the lower case letters. I could plug in a pin-compatible chip that does decode lower case and see what I get off that chip. That's a good idea.

Thanks for your continued interest,

Jimmy