I have a multi digital gauge/sensor project going that works pretty well now. It has a usb logging mode that logs all parameters, comma delimited to a connected laptop. I'd like to change this so it logs to a usb key. I've been investigating using a vdip1 from ftdi (http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=57&title=VDIP1, Arduino Playground - UsbMemory).
There is one problem...I use a serial lcd module (one of the sparkfun ones). Normally during usb logging mode I shut off the lcd display using it's command set for this purpose and turn it back on upon exiting the mode. Since both the LCD module and vdip1 are going to be receiving the same signals from the serial port could there be problems. I'm guessing there are only probs if the command sets overlap??
They both easily use 9600 baud.
The display uses
Serial.print(0xFE, BYTE); //command flag
Serial.print(0x08, BYTE); //shut the screen off command
to shut the screen off and otherwise only sees things immediately following 0xFE as commands.
The logger uses command line-like commands to do things like open/close files and write to files:
Serial.print("OPW LOG%"); // open to write creates a file - named
Serial.print(fileNumber); // LOG%1.TXT first time round - .TXT is for the computer
Serial.print(".TXT");
Serial.print(13, BYTE); // return character
These are terminated by a return character.
writing to a file is like this:
Serial.print("WRF "); //write to file (file needs to have been opened to write first)
Serial.print(noOfChars); //needs to then be told how many characters will be written
Serial.print(13, BYTE); //return to say command is finished
Serial.print(activityToLog); //followed by the info to write
Serial.print(valToWrite);
Serial.print(13, BYTE); //write a return to the contents of the file (so each entry appears on a new line)
The full set of commands for the vdip1 are available in the documentation and I don't think i'll be using any of these when writing to the screen. It should only be block's 3 letter words and such. I wonder if the vdip1 err's on getting nonsense commands or just ignores them???
According to the sparkfun LCDserial tutorial if you send the pipe character (0x7C) to the lcd plus some random integer you can overwrite the module and screw things up. I want to prevent doing things like this.
The only truly safe way I can think of doing this is by triggering a NC relay that opens (shutting off the lcd) when I want to datalog.
I included all the code...yes its a mess and yes it took a bunch of posts to put up. The last post has the usb datalogger function.