/* * Author: Josh Holtrop * Date: 2009-05-03 * * This module provides a C++ object-oriented interface to a * Noritake itron Vacuum Fluorescent Display model CU20025ECPB-W1J * that my friend Mike Zwagerman let me borrow. * * It is connected to my PC's parallel port as follows: * CN1 Pin Parallel Port Pin * Gnd 1 18 Ground * RS 4 2 Data0 * R/|W| 5 3 Data1 * E 6 4 Data2 * DB4 11 5 Data3 * DB5 12 6 Data4 * DB6 13 7 Data5 * DB7 14 8 Data6 * * Additionally, CN1 pin 1 (ground) is connected to an independent 5 volt * power supply's ground, and CN1 pin 2 (Vcc) is connected to the * independent power supply's +5V line. * */ #ifndef VFD_H #define VFD_H VFD_H #include class VFD { public: static const unsigned char SHIFT_CURSOR = 0; static const unsigned char SHIFT_DISPLAY = 1; static const unsigned char LEFT = 0; static const unsigned char RIGHT = 1; static const unsigned char OFF = 0; static const unsigned char ON = 1; static const unsigned char ADDRESS_LINE1 = 0x00; static const unsigned char ADDRESS_LINE2 = 0x40; VFD(); ~VFD(); bool connect(const std::string & parport = "/dev/parport0"); void disconnect(); void displayClear(); void cursorHome(); void entryModeSet(unsigned char address_direction, /* LEFT|RIGHT */ unsigned char display_shift); /* ON|OFF */ void setDisplay(unsigned char display, /* ON|OFF */ unsigned char cursor, /* ON|OFF */ unsigned char cursor_blink); /* ON|OFF */ void shift(unsigned char shift_display, /* ON|OFF */ unsigned char direction); /* LEFT|RIGHT */ void setCGAddress(unsigned char address); void setAddress(unsigned char address); void writeByte(unsigned char data); void write(const std::string & str); protected: static const unsigned char RW_WRITE = 0; static const unsigned char RW_READ = 1; static const unsigned char E_DISABLE = 0; static const unsigned char E_ENABLE = 1; static const unsigned char RS_COMMAND = 0; static const unsigned char RS_DATA = 1; static const unsigned char PP_OFFSET_RS = 0; static const unsigned char PP_OFFSET_RW = 1; static const unsigned char PP_OFFSET_E = 2; static const unsigned char PP_OFFSET_DATA = 3; static const int INIT_DELAY = 10 * 1000; static const int DISPLAY_CLEAR_DELAY = 2300; void sendByte(unsigned char rs, unsigned char dat); void sendNibble(unsigned char rs, unsigned char dat); void setPPLines(unsigned char bits); int m_ppfd; /* parallel port file descriptor */ }; #endif