Here's my arduino code "sketch" for the Exixe nixie driver ....
This is for driving 4 nixie tubes
you'd have to change the code to do more
just send serial commands like this
"<9r8g7b6w>"
1st digit will be 9 with a red color
2nd digit will be 8 with green color
3rd digit will be 7 with blue color
4th digit will be 6 with white color
code/sketch below
pinside took out the indentations... so hit me up for correct source arduino code
#include <SPI.h>
const int ss1 = 7; //slave select pin for digit 1
const int ss2 = 8; //slave select pin for digit 2
const int ss3 = 9; //slave select pin for digit 3
const int ss4 = 10; //slave select pin for digit 4
byte nix_buff[16] = {0xaa, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0xff, 0x80, 0x80};
char serialReceived[8];
byte digit1= 9;
byte digit2= 8;
byte digit3= 7;
byte digit4= 6;
byte d1c=115;
byte d2c=119;
byte d3c=112;
byte d4c=115;
void setup() {
pinMode(ss1, OUTPUT);
pinMode(ss2, OUTPUT);
pinMode(ss3, OUTPUT);
pinMode(ss4, OUTPUT);
Serial.begin(19200);
SPI.begin();
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
digitalWrite(ss1, LOW);
for (int i = 0; i < 16; i = i + 1)
SPI.transfer(nix_buff[i]);
digitalWrite(ss1, HIGH);
delay(1000);
digitalWrite(ss2, LOW);
for (int i = 0; i < 16; i = i + 1)
SPI.transfer(nix_buff[i]);
digitalWrite(ss2, HIGH);
delay(1000);
digitalWrite(ss3, LOW);
for (int i = 0; i < 16; i = i + 1)
SPI.transfer(nix_buff[i]);
digitalWrite(ss3, HIGH);
delay(1000);
digitalWrite(ss4, LOW);
for (int i = 0; i < 16; i = i + 1)
SPI.transfer(nix_buff[i]);
digitalWrite(ss4, HIGH);
}
void loop()
{
recWithSEmarkers();
writenix(digit1, d1c, ss1);
writenix(digit2, d2c, ss2);
writenix(digit3, d3c, ss3);
writenix(digit4, d4c, ss4);
}
void recWithSEmarkers() {
static boolean recvInProgress= false;
static byte ndx = 0;
char startmarker = '<';
char endmarker = '>';
char rc;
while (Serial.available() > 0) {
rc = Serial.read();
if (recvInProgress == true) {
if (rc != endmarker) {
serialReceived[ndx] = rc;
ndx++;
}
else {
serialReceived[ndx] = '\0'; //terminate the string
recvInProgress = false;
ndx=0;
}
}
else if (rc==startmarker){
recvInProgress=true;
}
digit1 = serialReceived[7]-48;
d1c = serialReceived[6];
digit2 = serialReceived[5]-48;
d2c = serialReceived[4];
digit3 = serialReceived[3]-48;
d3c = serialReceived[2];
digit4 = serialReceived[1]-48;
d4c = serialReceived[0];
}
}
void writenix(int number,byte DigitColor, int sspin) {
if (DigitColor==119){
nix_buff[13] = 0xff;
nix_buff[14] = 0xff;
nix_buff[15] = 0xff;
}
if (DigitColor==114){
nix_buff[13] = 0xff;
nix_buff[14] = 0x80;
nix_buff[15] = 0x80;
}
if (DigitColor==103){
nix_buff[13] = 0x80;
nix_buff[14] = 0xff;
nix_buff[15] = 0x80;
}
if (DigitColor==98){
nix_buff[13] = 0x80;
nix_buff[14] = 0x80;
nix_buff[15] = 0xff;
}
if (DigitColor==121){
nix_buff[13] = 0xff;
nix_buff[14] = 0xff;
nix_buff[15] = 0x80;
}
if (DigitColor == 112){
nix_buff[13] = 0xc8;
nix_buff[14] = 0x8d;
nix_buff[15] = 0xff;
}
if (DigitColor==111){
nix_buff[13] = 0xff;
nix_buff[14] = 0xc0;
nix_buff[15] = 0x00;}
if (DigitColor==110){
nix_buff[13] = 0x80;
nix_buff[14] = 0x80;
nix_buff[15] = 0x80;}
for (int i = 1 ; i < 11; i = i + 1) { //clear numbers
nix_buff[i] = 0x80;
}
nix_buff[0] = 0xaa;
if (number == 0)
number = 10;
nix_buff[number] = 0xff; //write number
digitalWrite(sspin, LOW);
delay(1);
for (int i = 0; i < 16; i = i + 1)
SPI.transfer(nix_buff[i]);
digitalWrite(sspin, HIGH);
}