liquibyte
|
GU-7000 Series
Feb 25, 2014
Arduino_Noritake_VFD_GU7000.zip doesn't work for me. I'm wondering if there isn't a problem with changes to the arduino code. The code used to work and I had a hard time getting it to do so but once it worked, it worked. I recently lost a hard drive and had to re-install my os and the code no longer works. I've spent the better part of two days trying to get this vfd to output anything along the lines of text or graphics to no avail. None of the sample code works, none of my own code works. There seems to be a communication problem but I can't for the life of me figure out what it is.
Edit: It turns out the the fault lies with arduino after all. The default shipped avr-gcc is out of date or incompatible. On archlinux at least the fix is easy enough:
[CODE]
Install avr-gcc with pacman (not an AUR version) and do the following.
# cd /usr/share/arduino/hardware/tools/avr/bin
# mv ./avr-gcc ./avr-gcc-backup
# ln -s /usr/bin/avr-gcc ./[/CODE] [CODE]#include
#include
#include
GU7000_Serial_Async interface(38400, 2, 3, 4); // BAUD,SIN,BUSY,RESET
const long scaleConst = 1184.665 * 1000; // internalRef * 1023 * 1000;
long readVcc() {
// Read 1.1V reference against AVcc
// set the reference to Vcc and the measurement to the internal 1.1V reference
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Start conversion
while (bit_is_set(ADCSRA,ADSC)); // measuring
uint8_t low = ADCL; // must read ADCL first - it then locks ADCH
uint8_t high = ADCH; // unlocks both
long result = (high<<8) | low;
result = scaleConst / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
return (int)result; // Vcc in millivolts
}
Noritake_VFD_GU7000 vfd;
void setup() {
vfd.begin(140, 32); // 140x32 module
vfd.interface(interface); // select which interface to use
vfd.isModelClass(7000); // select display model
vfd.GU7000_reset(); // reset module
vfd.GU7000_init(); // initialize module
_delay_ms(300); // wait for device to power up
}
void printVoltage(){
int mv = readVcc();
vfd.GU7000_setFontSize(3, 2, true);
vfd.GU7000_setFontStyle(false, true);
vfd.GU7000_clearScreen(); // little bit of flickering going on
vfd.print( mv / 1000, DEC ); // print the integer value of the voltage
vfd.print('.'); // print the decimal place
vfd.print( mv % 1000, DEC ); // print the rest of the voltage in millivolts
vfd.GU7000_lineFeed(); // start new line
vfd.GU7000_carriageReturn(); // return to the left
vfd.print('Volts');
}
void loop() {
printVoltage();
_delay_ms(300);
}[/CODE]
Install avr-gcc with pacman (not an AUR version) and do the following.
# cd /usr/share/arduino/hardware/tools/avr/bin
# mv ./avr-gcc ./avr-gcc-backup
# ln -s /usr/bin/avr-gcc ./[/CODE] [CODE]#include
#include
#include
GU7000_Serial_Async interface(38400, 2, 3, 4); // BAUD,SIN,BUSY,RESET
const long scaleConst = 1184.665 * 1000; // internalRef * 1023 * 1000;
long readVcc() {
// Read 1.1V reference against AVcc
// set the reference to Vcc and the measurement to the internal 1.1V reference
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Start conversion
while (bit_is_set(ADCSRA,ADSC)); // measuring
uint8_t low = ADCL; // must read ADCL first - it then locks ADCH
uint8_t high = ADCH; // unlocks both
long result = (high<<8) | low;
result = scaleConst / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
return (int)result; // Vcc in millivolts
}
Noritake_VFD_GU7000 vfd;
void setup() {
vfd.begin(140, 32); // 140x32 module
vfd.interface(interface); // select which interface to use
vfd.isModelClass(7000); // select display model
vfd.GU7000_reset(); // reset module
vfd.GU7000_init(); // initialize module
_delay_ms(300); // wait for device to power up
}
void printVoltage(){
int mv = readVcc();
vfd.GU7000_setFontSize(3, 2, true);
vfd.GU7000_setFontStyle(false, true);
vfd.GU7000_clearScreen(); // little bit of flickering going on
vfd.print( mv / 1000, DEC ); // print the integer value of the voltage
vfd.print('.'); // print the decimal place
vfd.print( mv % 1000, DEC ); // print the rest of the voltage in millivolts
vfd.GU7000_lineFeed(); // start new line
vfd.GU7000_carriageReturn(); // return to the left
vfd.print('Volts');
}
void loop() {
printVoltage();
_delay_ms(300);
}[/CODE]