Using VDTReadWave2

I am trying to set up communication with a Keyence Laser Displacement Sensor via VDT2. I can communicate with the tool via the terminal window as expected. I am now trying to program the system.

The command structure they for retrieving data is

AO,01 (+cr)


and the return response is

AO,123,123,1234,234,234,.....


The command and then a string of comma delimited data. For VDTReadWave2 what is it expecting in the way a incoming data and how does it parse the values, what delimiters are expected?
Quote:
For VDTReadWave2 what is it expecting in the way a incoming data and how does it parse the values, what delimiters are expected?


The documentation is vague on this. I think it is the same as for VDTRead2. This means that the delimiter is set by the /T flag and defaults to comma, CR or tab, so you should not need to specify /T.

Quote:
and the return response is

AO,123,123,1234,234,234,


You will have to read the A0 using VDTRead2 since it is not numeric. The comma after A0 will terminate VDTRead2. Then you can use VDTReadWave2 to read the rest.

It's possible that you could read the whole thing with VDTReadWave2 and you would wind up with a NaN for the A0. You would have to try this to be sure.

If the instrument terminates the transmission with CR/LF, you will need to add a VDTRead2 to consume the LF. See the help topic "Terminators in Read Operations".

If the instrument terminates with just LF, you would use /T=",\n" to specify comma and linefeed terminators. The comma would terminate the read for each point and the linefeed would terminate the whole transmission.