VFD display and libraries

Hello, I'm new to the forum and new to the Arduino world. I found an IEE VFD display model 05464assy36793. I managed to find all the correct pins thanks to a datasheet that you can find in a link in the code . My question, are there any libraries already made for these types of displays because in the code I have attached it only accepts hexadecimal values ​​that correspond to ASCII symbols. The operation of the display is very simple but I don't know where to start to send text or variables (such as temperature, etc.). To send the data i use 8 pin for data and 1 for writing.
I ask here because maybe someone already found a solution

/* NA202SD08FA VFD Display
 Karel Reinhard 04/13/2016
 Basic code for NA202SD08FA 20x2 VFD
 With 13 pin connector see http://torretje.nl/futaba for pin-out and data-sheet
 */



//NA202SD08FA 14 pin connector 2 pins for power-supply and pin 1 and 13 NC :
const int RST = 11; //J1-14
const int WR =  10; //J1-2
const int DB0 =  2; //J1-10
const int DB1 =  3; //J1-9
const int DB2 =  4; //J1-8
const int DB3 =  5; //J1-7
const int DB4 =  6; //J1-6
const int DB5 =  7; //J1-5
const int DB6 =  8; //J1-4
const int DB7 =  9; //J1-3
//Add all data ports to an Array 
int outData[8]={DB0,DB1,DB2,DB3,DB4,DB5,DB6,DB7};



void setup() {
  // set the digital pin as output:
  Serial.begin(9600,SERIAL_8O1);
  pinMode(RST, OUTPUT);   
  pinMode(WR, OUTPUT);      
  pinMode(DB0, OUTPUT);      
  pinMode(DB1, OUTPUT);      
  pinMode(DB2, OUTPUT);      
  pinMode(DB3, OUTPUT);      
  pinMode(DB4, OUTPUT);      
  pinMode(DB5, OUTPUT);      
  pinMode(DB6, OUTPUT);      
  pinMode(DB7, OUTPUT);
  //RESET 

  

  digitalWrite(RST, 0);
  delay(1000);
  digitalWrite(RST, 1);
  delay(1000);
  //Clear screen cursor home

  setData(0x1F); 
  delay(1000);
  


  

  

 

  
}

void loop()
{




  



  for(int y=0x21;y<0x7F;y++){
    setData(0x16);//Cursor Home
    for(int i=0;i<79;i++){
        setData(y);
     }
           delay(1000);
  }

    for(int y=0xA0;y<0xFF;y++){
    setData(0x16);//Cursor Home

      for(int i=0;i<79;i++){
        setData(y);
        
      }
      delay(1000);
    }

}

void setData(byte data){
   int i=0;
   for (byte mask = B00000001; mask>0; mask <<= 1) { 
     if (data & mask){ // if bitwise AND resolves to true
       digitalWrite(outData[i],HIGH);
       
    }else{ //if bitwise and resolves to false
       digitalWrite(outData[i],LOW);
       
    }
    i++;
  }
  digitalWrite(WR, 1);
  delayMicroseconds(450);
  digitalWrite(WR, 0);
}


the code I have attached it only accepts hexadecimal values ​​that correspond to ASCII symbols.

Please explain what you mean by the above. The code can include any valid representation of data. What do you want to change, or do with it?

For example, this line,

  for(int y=0x21;y<0x7F;y++){

which indexes the printable ASCII character set, could be written as

  for(int y = '!'; y <= '~'; y++){

Your code, cleaned up a bit:

/* NA202SD08FA VFD Display
 Karel Reinhard 04/13/2016
 Basic code for NA202SD08FA 20x2 VFD
 With 13 pin connector see http://torretje.nl/futaba for pin-out and data-sheet
 */

//NA202SD08FA 14 pin connector 2 pins for power-supply and pin 1 and 13 NC :
const int RST = 11; //J1-14
const int WR =  10; //J1-2
const int DB0 =  2; //J1-10
const int DB1 =  3; //J1-9
const int DB2 =  4; //J1-8
const int DB3 =  5; //J1-7
const int DB4 =  6; //J1-6
const int DB5 =  7; //J1-5
const int DB6 =  8; //J1-4
const int DB7 =  9; //J1-3
//Add all data ports to an Array 
int outData[8]={DB0,DB1,DB2,DB3,DB4,DB5,DB6,DB7};

void setup() {
  // set the digital pin as output:
  Serial.begin(9600,SERIAL_8O1);
  pinMode(RST, OUTPUT);   
  pinMode(WR, OUTPUT);      
  pinMode(DB0, OUTPUT);      
  pinMode(DB1, OUTPUT);      
  pinMode(DB2, OUTPUT);      
  pinMode(DB3, OUTPUT);      
  pinMode(DB4, OUTPUT);      
  pinMode(DB5, OUTPUT);      
  pinMode(DB6, OUTPUT);      
  pinMode(DB7, OUTPUT);
  //RESET 
  digitalWrite(RST, 0);
  delay(1000);
  digitalWrite(RST, 1);
  delay(1000);
  //Clear screen cursor home

  setData(0x1F); 
  delay(1000);
}

void loop()
{
  for(int y=0x21;y<0x7F;y++){
    setData(0x16);//Cursor Home
    for(int i=0;i<79;i++){
        setData(y);
     }
           delay(1000);
  }
    for(int y=0xA0;y<0xFF;y++){
    setData(0x16);//Cursor Home

      for(int i=0;i<79;i++){
        setData(y);
      }
      delay(1000);
    }
}

void setData(byte data){
   int i=0;
   for (byte mask = B00000001; mask>0; mask <<= 1) { 
     if (data & mask){ // if bitwise AND resolves to true
       digitalWrite(outData[i],HIGH);
    }else{ //if bitwise and resolves to false
       digitalWrite(outData[i],LOW);
     }
    i++;
  }
  digitalWrite(WR, 1);
  delayMicroseconds(450);
  digitalWrite(WR, 0);
}

The code that i post is just displaying a series of ASCII characters in sequence for testing the display.
In the code there is the function setData that can accept hexadecimal value as argument that correspond to an ascii character. For example if i want to write hello, this is the code:

setData(0x68);
setData(0x65); 
setData(0x6C);
setData(0x6C);
setData(0x6F);

I'm searching some libraries similar to led lcd 16x2 that make more easy send text or variables to the display.

I doubt anyone has written a library for that display, so you will need to write some very small functions to display text and numbers.

For example, try replacing the stuff in loop() with this:

void loop()
{
  char text[]="Hello World!";  //define a message

  setData(0x16);//Cursor Home
  for (int y=0; i< sizeof(text); i++) {
   setData(text[i]);  //display the message
  }
  delay(1000);
}

loop() could be instead a function to display any text, defined as a C-string with a terminating zero byte. There are plenty of examples in the LCD and other display libraries.

Minimal example of a general purpose routine to write a character string to the display:

// Print string from RAM
void sendText(char *p)  {
	
	while (*p)  //check for terminating zero
		setData(*p++);
}

Use functions like ftoa(), itoa(), dtostrf(), sprintf() to create text strings from numeric and other types of variables.

Thank you very much, it works! you help me a lot! I imagined it was some basic function in the C++ language, my knowledge is a bit rusty. I will try the functions you wrote. Thanks again for the big help

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.