In order to control DP501 HNV-07SS61 VFD in an effortless and efficient manner the following software driver has been implemented. The functionality is encapsulated in HT16512.cpp and HT16512.h files and designed for AVR processors. To drive communication interface the logic uses PinMode and DigitalWrite functions provided by Arduino low level library. Also new HT16512 class inherits Arduino’s Print class to simplify output to display even more. However, despite those Arduino’s dependencies the code might be easily ported to PIC or ARM architectures.
The driver’s logic is subdivided into several groups: initialisation and low-level methods, tests and visual effects, methods for direct access to HT16512 without intermediate buffer and methods for intermediate buffer operations.
1. Initialisation and low-level methods
1.1. HT16512 constructor Description Prototype Parameters Returns |
1.2. Reset method Description Prototype Parameters Returns |
1.3. DisplayOnCmd method Description Prototype Parameters Returns |
1.4. DisplayOff method Description Prototype Parameters Returns |
1.5. DisplayWriteCmd method Description Prototype Parameters Returns |
1.6. AddrSetCmd method Description Prototype Parameters Returns |
1.7. Command method Description Prototype Parameters Returns |
1.8. Data method Description Prototype Parameters Returns |
2. Tests and visual effects
Tests and visual effects are represented by methods with Test and Effect suffixes in method names. Each method has to be invoked more than once in order to be completed. Upon completion methods return FALSE
. In order to perform all available tests one by one there is a testStep(void) method that might be invoked from user code by a timer routine. Current test is kept in _tstState variable that can be assigned to one of the following values:
NOT_STARTED, COLUMN_TEST, SEGMENT_TEST, DIMMING_TEST, GLOWING_TEST, CHARSET_TEST, CHARSET_TEST2, ROTOR_TEST, SLASH_EFFECT, SCROLL_EFFECT, COMPLETED
To run through all available tests subsequently, it is enough to invoke uint8_t HT16512::testStep()
on a periodic basis and do it until the method returns COMPLETED
result. Internally, this method invokes one by one the following tests:
uint8_t columnTest();
uint8_t segmentTest();
uint8_t dimmingTest();
uint8_t glowingTest();
uint8_t charsetTest();
uint8_t charsetTest2();
uint8_t rotorTest();
uint8_t slashEffect();
uint8_t scrollEffect();
3. Methods for direct access to HT16512 without intermediate buffer
3.1. Write byte method Description Prototype Parameters Returns |
3.1. Write byte array method Description Prototype Parameters Returns |
4. Methods for intermediate buffer operations
The is no way to read data from display memory and there are situations when it would be extremely good to have that feature – for example, to read and modify the content that is currently being displayed. Introduction of an intermediate buffer allows us to have this feature and it makes possible to implement ‘blinking’ (or ‘flashing’) functionality.
4.1. Write_f byte method Description Prototype Parameters Returns |
4.2. Write_f byte array method Description Prototype Parameters Returns |
4.3. Print_f_p method Description Prototype Parameters Returns |
4.4. ClearFrame method Description Prototype Parameters Returns |
4.5. FlipFrame method Description Prototype Parameters Returns |
4.6. SetFlashAttr method Description Prototype Parameters Returns |
4.7. GetFlashAttr method Description Prototype Parameters Returns |
4.8. FlipFlashState method Description Prototype Parameters Returns |
The code below demonstrates how to initialise our VFD driver:
#include <avr/interrupt.h>
#include <util/delay.h>
#include "wiring.h"
#include "HT16512.h"
#define VFD_CS_PIN 15 //PD7
#define VFD_SCLK_PIN 14 //PD6
#define VFD_DATA_PIN 13 //PD5
#define STANDBY_PIN 12 //PD4
HT16512 vfd(VFD_CS_PIN, VFD_SCLK_PIN, VFD_DATA_PIN); //VFD display
int main(void)
{
pinMode(STANDBY_PIN, OUTPUT);
digitalWrite(STANDBY_PIN, HIGH);
//Enable VFD power supply
digitalWrite(STANDBY_PIN, LOW);
_delay_ms(100);
digitalWrite(STANDBY_PIN, HIGH);
//Initialise VFD tube
vfd.reset();
vfd.addrSetCmd(0);
vfd.clearFrame();
vfd.flipFrame();
sei();
while (1)
{
vfd.testStep()
_delay_ms(200);
}
}
As you can see, apart from VFD_CS_PIN, VFD_SCLK_PIN, VFD_DATA_PIN
pins that are dedicated to VFD communication there is also STANDBY_PIN
pin that simulates POWER button and instructs to switch +5V
power rail on.
Let’s get down to the hardware part. In this demo we will be using Freeduino board. In total we would need 4 (four) signal wires to connect it to the VFD panel. Of course, we will also need GND
and +5V
power rail.
Here is the signal mapping table between Freeduino board and VFD panel (please also refer to DVP630 Schematic Diagram):
Signal | Freduino connector-pin | VFD panel connector-pin |
---|---|---|
VFD_CS | J3-8 | RB502-2 |
VFD_CLK | J3-7 | RB502-1 |
VFD_DATA | J3-6 | RB502-3 |
STANDBY | J3-5 | CN503-3 |
+5V Standby | JP1-3 | RB501-5 |
GND | JP1-4, 5 | RB502-4 |
And here is the result: Freeduino board running VFDDemo, connected to the VFD panel and power supply from broken Philips DVP 630:
Downloads:
1. Magictale VFD Demo lib and example for AVR Rev1.0
Stay tuned, the most interesting things are still yet to come!
Hi,
It is an old thread but I give it a try.
I am an Arduino (ver. 1.6.5) hobbyist, and want to play with a saved VFD with ET16315 driver IC (from an Optibox sat receiver). Your library was the closest to ET16315 I could find. I want to attempt to modify it to work with 16315.
Downloaded the Magictale “VFD Demo lib and example for AVR Rev1.0” zip file, change wiring.h to Arduino.h, changed library structure, and succeeded in installing the library. Copied the code “to initialise our VFD driver” to a new ini file and tried to compile. An error message appeared:
In file included from VFD16512Demo01.ino:7:0:
D:\Arduino\libraries\libraries\VFDDriverDemoSketch_el/HT16512.h:82:30: error: ‘prog_char’ does not name a type
void print_f_p(const prog_char str[]);
^
D:\Arduino\libraries\libraries\VFDDriverDemoSketch_el/HT16512.h:82:44: error: ISO C++ forbids declaration of ‘str’ with no type [-fpermissive]
void print_f_p(const prog_char str[]);
^
D:\Arduino\libraries\libraries\VFDDriverDemoSketch_el/HT16512.h:73:14: error: conflicting return type specified for ‘virtual void HT16512::write(uint8_t)’
void write(uint8_t value);
^
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,
from VFD16512Demo01.ino:6:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:48:20: error: overriding ‘virtual size_t Print::write(uint8_t)’
virtual size_t write(uint8_t) = 0;
^
My questions:
1. Do you think it is a good starting point for my project?
2. What do you recommend me doing with the error message?
Regards,
silvercarph
Hi,
As the Arduino IDE evolves the old code may stop compiling at some point as one of the recent changes was deprecation of ‘prog_char’. Now to define a char in program memory ‘const char’ must be used. You may try to fix this old library or you may try this one:
http://magictale.com/wp-content/uploads/2016/12/ArduinoUno_MVFDPanel_16S8D.zip
And there is a recent sketch for it:
http://magictale.com/wp-content/uploads/2016/12/ArduinoUno_Luminardo_MFVD_16S8D_Test.zip
I didn’t manage to find a datasheet for ET16315 but it has the same pinout as HT16515 so you’ve got pretty good chances to make your thing working with minimal changes in the code.
Good luck,
Dmitry
Hello,
Thanks for the links and recommendations.
As I had got stuck with your first library, I started to make a simple PT6312 code work https://mikrokontroleri.blogspot.hu/2014/04/initialize-vfd-display-using-arduino.html#uds-search-results , but I have not had much success after a few hours of trials. I need to dig deeper into addressing and find the right parameters.
I just installed the libraries and quickly tried to compile the Luminardo_MFVD_16S8D_Test.ino (on Leonardo, Uno and Mega2560), so far without success. It will take me some time to understand the codes.
I appreciate your help and like your website.
Zoltan alias silvercarp
Hi Zoltan,
You will also need IR library to compile the sketch http://magictale.com/wp-content/uploads/2016/12/ArduinoUno_RobotIRremote.zip
Or remove that functionality as it is not relevant to your problem.
Dmitry
Hi Dmitry,
I had the IRRemote library installed and I had thought it was fine – but I was wrong. Code compiled with your ArduinoUno_RobotIRremote.zip library. Changed pins but VDF shows – after showing all segments running from right to left, each segment lit separately, all segments lit on all digits, and dimming, for 15 seconds – strange characters and the lower five digits stay unchanged. My VDF is 8 digit 14 segment, plus an extra (leftmost) digit and another row on the top – which makes it a 9 digit 15 segment display.
I tried to change #define HT16515_ADDR_SET_MSK 0x3A, #define HT16515_LOW_NIBBLES_SET 0x0F and
#define HT16515_DATALEN 8 in HT16515.h (other commands look OK) but no success.
Where else can I set the parameters to my VDF and ET16315 driver?
Thanks,
Zoltan
Well, it is not the right approach to play with random parameters in hope that it would help. Read the datasheet (by the look of things the datasheet for HT16515 would be appropriate) and the code to understand the processes. Now you have everything to make your setup work. It sounds like the HT16515 is not in correct mode (number of grids by number of segments). First of all you need to understand how many grids your VFD has (just look at it closely and count), then the maximum number of segments served by one grid, then choose the right HT16515 mode, then understand how segments are addressed and how many bytes per digit is allocated by HT16515 in your particular mode (either 2 or 3). For more information refer to http://magictale.com/forum/viewtopic.php?f=1&t=357.
Dmitry
Many thanks Dmitry,
I just started to compare the datasheets of 16515 and 16315, and already became suspicious about the segment addresses. The forum will help me a lot.
I moved every .h and .cpp files into the sketch folder so that it is easier to see how changes affect the operation. I am going to simplify the code by commenting out/deleting the IR, tone, light sensor, LED parts so that I will have a better understanding of the basic codes. Names and comments help me a lot, you have done a professional job.
It seems I have found lot of things to learn and to do on these cold winter days (I live in Hungary).
Zoltan
Hi Zoltan,
You are very welcome. Try to understand the insides and outs of the library and your hardware – it should bring to you a lot of fun and interesting discoveries. It would be too boring for you to just get from me answers to all your questions. But of course when you are stuck you can always ask me for help.
Before moving to Australia 8 years ago I lived all my life in Siberia, Russia. So cold winter days in Hungary are not really cold for me, in my hometown Omsk we can easily get -40 degrees C. I wish I could go there this Christmas and enjoy the snow.
Good luck,
Dmitry