Help me understand writing to a character LCD!

I've had a VFD for years now, not doing anything productive. Decided I needed to figure out how to get it working with my Arduino! So far, I've made decent progress, as I can spit stuff out on screen.

What I don't understand is the VCD's datasheet, especially trying to decipher the command codes. I can turn the VCD on and off, but can't change the brightness. I've complicated all of this by having a serial backpack on the LCD.

My setup:

VFD: Noritake 2x40 5mm Character Display (http://www.farnell.com/datasheets/57192.pdf)
Serial Backpack: Wirz SLI-OEM (http://www.swarthmore.edu/NatSci/echeeve1/Ref/PeripheralsForPIC/sli-oem.pdf)

Now, all of that works, and I can get serial LCD code to work with the Arduino. For example, this code mostly works (Arduino Playground - SparkFunSerLCD).

Some of my code:

  clearSerLcd();
  LCD.print("Prints on line 1");
  LCD.println();
  LCD.print("Prints on line 2");
  delay(3000);
  
  clearSerLcd();
  LCD.print("Turning off in 3 seconds...");
  LCD.println();
  LCD.print("Then turning on 2 seconds later...");
  delay(3000);
  LCD.print(0xFE, BYTE);   //command flag
  LCD.print(0x08, BYTE);   //clear command.

  delay(2000);
  LCD.print(0xFE, BYTE);   //command flag
  LCD.print(0x0F, BYTE);   //clear command.
  delay(1000);

Now, when turning ON the display, several values work for the second command. 0x0D, 0x0C, and I think 0x0B. On the datasheet for my VFD, it says the backlight is controlled by this software command:

Display ON/OFF L L 08H-0FH

So, both the R/W and RS lines need to be set low. That's obviously for controlling the VFD with a parallel interface.... so how does that map to 0xFE above?

For controlling the backlight, I need to set the RS line high. How can I do this over a serial interface? I'd really like to keep the serial interface, since it reduces the amount of wiring to 3 wires. But, I can't decipher commands very easily.

So, any insight on how I would turn this:

Brightness Set L H 00H-03H

into SoftwareSerial code?

To save others digging....

"VFD": Vacuum Fluorescent Display...

But! The display is said to be "LCD compatible". It looks like it works the same way as the LCD panels that we "know and love".... just different at the final stage, a stage beyond what concerns us.

Futhermore, the Serial Backpack appears to be just a controller, itself controlled by high level commands, passed to it over a serial interface....

In other words, the whole thing boils down to a situation comparable to that covered in detail in....

It seems likely, although I can't say it is so for sure, that the "brightness" issue is similar to the "backlight" matters covered in the above tutorial. That entails two parts... understanding the control-by-command (more anon) AND (possibly) having a little extra circuitry... how much depends on how much has been done for you in the backpack. Possibly nothing "extra" needed, possibly a transistor or somesuch.

Control-by-command...

Generally if you send "ABC" to a display panel, you get "ABC" on the panel. However, "escape sequences" are used. For example, on the panel controller I know best, to put a question mark on the screen you send two question marks. A question mark says "treat the next character (or characters) specially." "?f" for instance causes the display to be cleared, and the cursor put in the upper left corner.

From what you have said, in the case of your backpack, I think that the byte FE (expressed in hex, there, which I shall henceforth indicate with a $ prefix, i.e. $FE) serves as the escape sequence. So, when the panel's datasheet tells you the command for "clear display" is L L 01H", you should(I believe) interpret that as follows: If I send $FE and then $01 to the backpack, it will pass $01 on as the command. The L L stuff is taken care of, I think, byt the backpack.

I don't see how you set the brightness... if I am right about the R/W and RS lines being controlled by the backpack. I would guess that the $FE + command byte(s) "trick" just covers the sending of L L commands, e.g. $1 for "clear display", $2 or $3 for "cursor return home" (I would guess it can be returned to the start of either line), $FE $20, $FE $21, $FE22... $FE $3f being a bunch of commands for setting a bunch of functions.

Sorry these aren't "answers", but perhaps these ramblings may help your deciphering of the mystery?

I've had a VFD for years now, not doing anything productive.

I'm in the same situation (both me and the VFD :stuck_out_tongue: ) Actually I don't know if mine works, I've never tested it.

So, any insight on how I would turn this:

Brightness Set L H 00H-03H

into SoftwareSerial code?

It seems it has 4 brightness levels? 00 - 03. So maybe (you have probably tested this) something like this:

LCD.print(0xFE, BYTE);
LCD.print(0x02, BYTE);

But then probably the problem is the /RW and RS lines I suppose. Maybe you should try using just a shiftregister (or two) directly, with the ShiftOut() funcion (and connecting those /RW, RS and E either directly or via shiftregisters, if they are the latching type)?

so how does that map to 0xFE above?

As near as I can tell, you just send the 0xfe followed by the display control byte.

It looks like that byte is probably the same as it is for LCDs:

Bit 0 - Cursor blink
Bit 1 - Cursor visible
Bit 2 - Display on/off
Bit 3 - Always "1"
Bits 4-7 - Always "0"

To set the brightness level, just send 00 through 03: instead of the custom characters you'd get with an LCD, you get different brightness.