Hi to you all!
I'm trying to lighten up a russian IV-12 VFD-tube with the help of a MAX6921 and the Arduino.
The VFD-tube was put on a self-made PCB together with the MAX6921.
To set the outputs on the MAX6921, you have to write 20 Bits via a 4-wire-serial interface.
Well, after all, I wrote a code that works, the tube displays all numbers from 0 to 9. But there is something strange: On my PCB I connected the tube from OUT0 to OUT7. OUT7 is the grid of the tube, all others are for the segments. So to lighten all segments, I need 7 Bits plus one for the grid, that make 8 bits. But when I use a 8 bit binary number, it doesn't work. The tube only lightens when I use a nine bit binary number. I think its something wrong with my code, but I can't figure out what it is.
Here is my code:
//quick vfd tube driver test
// MAX6921
// datasheet: http://datasheets.maximintegrated.com/en/ds/MAX6921-MAX6931.pdf
int blank = 4;
int din = 5;
int load = 6;
int clk = 7;
int led = 13;
int i,m;
int Zahlen[10] = {502,352,442,504,364,476,478,368,510,508}; // 9-Bit numbers
//int Zahlen[10] = {251,176,221,252,182,238,239,184,255,254}; // 8-Bit numbers, they don't workbyte c;
void setup() {
pinMode(din, OUTPUT);
pinMode(load, OUTPUT);
pinMode(clk, OUTPUT);
pinMode(blank, OUTPUT);
pinMode(led, OUTPUT);
digitalWrite(blank, LOW);
digitalWrite(clk, LOW);
digitalWrite(load, LOW);
digitalWrite(din, LOW);
Serial.begin(9600);
}void schreiben(int m) {
for (c=20; c>0; c--) // write 20 Bits from MSB to LSB
{
digitalWrite(clk, LOW); //data on rising edge
digitalWrite(din,bitRead(m, c));
delayMicroseconds(10);
digitalWrite(clk,HIGH);
delayMicroseconds(10);
digitalWrite(clk,LOW);
delayMicroseconds(10);
}
digitalWrite(din,LOW);
digitalWrite(load, HIGH);
delayMicroseconds(10);
digitalWrite(load, LOW);
delay(1);
}void loop() {
m=(Zahlen[7]);
schreiben(m); //with 9-bit number, the '7' appears on the tube
while(1){};
}
Has anyone an idea?
Thanks a lot!
Best wishes
Matthias