I wrote up some simple code to take whatever comes in from the serial port and prints it to the VFD. It takes the first 40 characters it gets and just discards the rest.
//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;
void setup()
{
pinMode (slaveSelectPin, OUTPUT);
SPI.begin();
SPI.setDataMode(SPI_MODE3);
Serial.begin(9600);
}
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);
}
char serin1[40] = {' '};
void loop()
{
int availableBytes = 0;
boolean change = false;
int i = 0;
while (availableBytes == 0)
{
availableBytes = Serial.available();
delay(75); //this gives the buffer time to fill
}
availableBytes = Serial.available();
for(i=0; i<availableBytes; i++)
{
if (i < 40)
{
serin1[i] = Serial.read();
}
else
{
Serial.read();
}
change = true;
}
if (change == true)
{
for(i=availableBytes; i < 41; i++)
{
serin1[i] = ' ';
}
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(0x80);
for (i=0; i<20; i++)
{
DATA(serin1[i]);
}
COM(0xc0);
for (i=20; i<40; i++)
{
DATA(serin1[i]);
}
}
}
My plan is to make this 'Matrix Orbital' compatible to use LCD Smartie with this VFD.
EDIT: If you just use "testdriver.dll" in LCD Smartie it sorta works. Multiple line things are still a little odd.