I bought one of these on eBay* and the seller had some demo code on their page for some microcontroller I hadn’t ever heard of. I ported it over to arduino and the VFD works fine.
*Not affiliated just where I picked mine up
//VFD to Arduino
// 1 GND
// 2 VCC
// 3-SIO D11-MOSI
// 4-STB D10-Slave Select
// 5-SCK D13-SCK
#include <SPI.h>
const int slaveSelectPin = 10;
unsigned char UDF[13][8]=
{
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
};
unsigned char i,j,k;
unsigned char Seril_Demo_Line1[]={
' ',' ',' ',' ','V','F','D','-','D','I','S','P','L','A','Y',' ',' ',' ',' ',' ',
};
unsigned char Seril_Demo_Line2[]={
'M','O','D','E',':','S','E','R','I','A','L','-','D','E','M','O',' ',' ',' ',' ',
};
void setup()
{
pinMode (slaveSelectPin, OUTPUT);
SPI.begin();
SPI.setDataMode(SPI_MODE3);
}
void cdelay(unsigned int t)
{
while(t--);
delay(100);
// delay(t);
}
void DATA(unsigned char temp_1)
{
digitalWrite(slaveSelectPin,LOW);
SPI.transfer(0xfa);
SPI.transfer(temp_1);
digitalWrite(slaveSelectPin,HIGH);
}
void COM(unsigned char temp_2)
{
digitalWrite(slaveSelectPin,LOW);
SPI.transfer(0xf8);
SPI.transfer(temp_2);
digitalWrite(slaveSelectPin,HIGH);
}
void loop()
{
//
COM(0x01); //clear all display and set DD-RAM address 0 in address counter
COM(0x02); //move cursor to the original position
COM(0x06); //set the cursor direction increment and cursor shift enabled
COM(0x38); //set 8bit operation,2 line display and 100% brightness level
COM(0x80); //set cursor to the first position of 1st line
COM(0x0c); //set display on,cursor on,blinking off
// COM(0x06); //set display on,cursor on,blinking on (this is a guess)
delay(10);
for (j=0; j<13; j++)
{
COM(0x40); //CGRAM ADDRESS SETTING
for (k=0; k<8; k++)
{
DATA(UDF[j][k]);
}
COM(0x80); //DRAM ADDRESS SETTING
for (i=0; i<80; i++)
{
DATA(0x00);
}
cdelay(20000);
cdelay(20);
}
COM(0x80);
for (i=0; i<20; i++)
{
DATA(Seril_Demo_Line1[i]);
}
COM(0xc0);
for (i=0; i<20; i++)
{
DATA(Seril_Demo_Line2[i]);
}
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
cdelay(50000);
COM(0x80); //DDRAM ADDRESS SETTING
for (i=0; i<20; i++)
{
DATA(0x2a);
DATA(0x20);
}
for (i=0; i<20; i++)
{
DATA(0x20);
DATA(0x2a);
}
cdelay(50000);
cdelay(50000);
COM(0x80); //DDRAM ADDRESS SETTING
for (i=0; i<20; i++)
{
DATA(0x20);
DATA(0x2a);
}
for (i=0; i<20; i++)
{
DATA(0x2a);
DATA(0x20);
}
cdelay(50000);
cdelay(50000);
COM(0x40); //CGRAM ADDRESS SETTING
for (k=0; k<8; k++)
{
DATA(0xff);
}
COM(0x80); //DDRAM ADDRESS SETTING
for (i=0; i<80; i++)
{
DATA(0x00);
}
}
Used arduino0021 for this. It’s not the best looking code but it works just fine.