Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing CAN data to a spreadsheet or word processing file.

Hi. I need to know how I can write CAN data to a spreadsheet or word processing file. I have a vi that reads information from a CAN device and I need to write everything that is read to a spreadsheet or word processing file. Also I'm getting an error message using a vi that uses the frame API to write and read frames. It happens when I change the read or write queue value. Right now they are set at 100 each and when I change them just a little(even by 1) there is an error. Thanks in advance.
0 Kudos
Message 1 of 4
(3,580 Views)
Hi Farmington:

What error are you getting when you change these values? Also, are you changing them while the program is running or before you start the program?

As for the file I/O, what type of data are you getting that you want to put in a spreadsheet?

Regards,

Emilie S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,576 Views)
I have been changing the values while the VI is not running. The most important thing I need to do though is export data to a worksheet/spreadsheet. My VI is writing 8 bytes to the CAN bus and receiving data from the CAN bus. The VI is similar to the example (CAN send and receive using NICAN frames) and I need to write the frames received (bytes, timestamp, Arbitration ID) to a file so I can view every frame that was received. The window on the VI only holds about 11 frames of data at a time and I need to be able to view every frame that was received.
0 Kudos
Message 3 of 4
(3,566 Views)
I would recommend against writing DIRECTLY to Excel, while the CAN vi is running, the MSOffice interface is too slow to be doing while the CAN vi is running. There are 2 different ways you can get around this problem though.
1. When you receive a CAN frame you want to log, write it to a buffer of some kind in Labview (this could be a string buffer wired to a shift register, it simply adds the new data to the end of the buffer) then when your VI closes, it writes the string data to an excel worksheet.
2. You could log the data to a text file, if you use the Write File.vi (in the File I/O pallette) you can quickly write data to a file if it is done correctly. DO NOT use the VI's on the first row (Write to Spreadsheet.vi and Write Characters to File.vi) because they will be too slow, they open the file, write data, and then close the file each time they run, which takes too much time.

As for changing the buffers, you can do that, if you change the buffers at the time you call ncCANConfig, if you change the buffers after that you will get an error.
0 Kudos
Message 4 of 4
(3,558 Views)