Sending information to display drivers

Hi, I'm a very inexperienced Arduino user and I'm trying to send data to a display driver to make a 4 segment display light up. Its not working at the moment and is most likely that I've coded something incorrectly. The display driver I'm using is a SAA1064, here's my code.

The text on the monitor and the flashing LED is just to tell me whether the program is going through the loop ok (and it does). I took the byte writing part from a guide on the playground. Any help or suggestions would be most welcome! Thanks.

//Declaration of variables

int clock = 0;
int dataIn = 1;
int led = 13;

void setup(){
  Serial.begin(9600);
  Serial.println("Hello world!");
  pinMode(clock, OUTPUT);
  pinMode(dataIn, OUTPUT);
  pinMode(led, OUTPUT);
  
}

void loop(){
  Serial.println("Test1");
  flash();
  putByte(0x76);           //slave address
  flash();
  Serial.println("Test2");
  putByte(0x00);           //instruction byte
  flash();
  Serial.println("Test3");
  putByte(0x0F);           // control byte
  flash();
  Serial.println("Test4");
  putByte(0xE4);           //data digit 1
  flash();
  Serial.println("Test5");
  putByte(0xE4);           //data digit 2
  flash();
  Serial.println("Test6");
  putByte(0xE4);           //data digit 3
  flash();
  Serial.println("Test7");
  putByte(0xE4);           //data digit 4
  flash();
  Serial.println("Test8");
  delay(10000);  
}

void putByte(byte data) {
  byte i = 8;
  byte mask;
  while(i > 0) {
    mask = 0x01 << (i - 1);      // get bitmask
    digitalWrite( clock, LOW);   // tick
    if (data & mask){            // choose bit
      digitalWrite(dataIn, HIGH);// send 1
    }else{
      digitalWrite(dataIn, LOW); // send 0
    }
    digitalWrite(clock, HIGH);   // tock
    --i;                         // move to lesser bit
  }
}

void flash(){
  delay(1000);
  digitalWrite(led, HIGH);
  delay(1000);
  digitalWrite(led, LOW);
  delay(1000);
  digitalWrite(led, HIGH);
   delay(1000);
  digitalWrite(led, LOW);
}

Hi,

Hi, I'm a very inexperienced Arduino user and I'm trying to send data to a display driver to make a 4 segment display light up. Its not working at the moment and is most likely that I've coded something incorrectly. The display driver I'm using is a SAA1064, here's my code.

I'm sorry but you are completely on the wrong track with your code...

The SAA1064 uses the I2C-bus (or TWI which is the same thing different branding)

But the arduino supports this too!
Read about the Wire-lib here Wire \ Libraries \ Wiring
I don't know if anybody used the SAA1064 with the arduino before
Check the arduino-pages for wire-lib and I2C or TI or IIC to find out more
Eberhard

Thanks for the help wayoda, have been looking at the wire library but is quite confusing! Unfortunately a search of TWI or I2C reveals nothing on the syntax and programs part of the forums.

Here's what I've got so far anyway, any help or links appreciated:

#include <Wire.h>

int led0Pin = 10;   // select the pin for red 'test' LED

void setup() {
  Wire.begin();
  Serial.begin(9600);                 // set serial speed
  Serial.println("Hello world!");     // check board setup ok
  pinMode(led0Pin, OUTPUT);           // declare the led0Pin as an OUTPUT
}

void loop() {
  
  digitalWrite(led0Pin, HIGH);  // turn the ledPin on
  delay(1000); 
  
  Wire.beginTransmission(0x76);
  Wire.send(0x76); //slave address
  Wire.send(0x00); //instruction byte
  Wire.send(0x0F); //control byte
  Wire.send(0xE4); //data digit 1
  Wire.send(0xE4); //data digit 2
  Wire.send(0xE4); //data digit 3
  Wire.send(0xE4); //data digit 4
  Wire.endTransmission();
    
  digitalWrite(led0Pin, LOW);  // turn the ledPin on
  delay(1000); 

}

Hi,
this looks basically OK...

Did you get the Address right, (can be configured by the hardware to three other ones)
I guess you see nothing? (You know you send command : DisplayTest)
Did you get the wiring right? The SCL-Signal is on the Arduino AnalogIn 5 SDA AnalogIn 4 I think..

Add "arduino twi" "arduino i2c" to your search to see more examples of how to use the wiring library
Eberhard

For some reason the address needs to be half that of what it says on the data sheet!

(it's working in case you hadn't gathered from the previous post!) :slight_smile: