59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
|
|
/*
|
|
* 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 <string>
|
|
|
|
class VFD
|
|
{
|
|
public:
|
|
VFD();
|
|
bool connect(const std::string & parport = "/dev/parport0");
|
|
void disconnect();
|
|
|
|
protected:
|
|
static const unsigned char RW_WRITE = 0;
|
|
static const unsigned char RW_READ = 1;
|
|
static const unsigned char E_ENABLE = 0;
|
|
static const unsigned char E_DISABLE = 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;
|
|
|
|
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
|