VDTWrite and machine code
neogin
I'm trying to talk to one of my device via Igor, the standard way to do so is via a custom Labview interface made by the constructor. On this interface each entered command is also displayed for the expert in assembled binary command data, I quote from the manual :
Machine Code Display
Expert → A display of assembled binary command data (machine code) is provided as a convenience for developers wishing to communicate with the Scan Controller in binary format. The Machine Code Display shows the translation of the SC2000 assembly language statement entered from the command line after assembly. The Command Byte string is the binary data sent to the Scan Controller, the Machine Code. This is displayed in hexadecimal format with the bytes sent to the Scan Controller in left-to-right order. If the statement entered on the Command Line was a query command, information is provided on the number of bytes to read back and the type of translation to apply to the readback data.
I monitored my operation port and the code displayed is effectively the query sent. for example the ?status command sent the query : FF FF FF FF FF FF FF FF
My question is how can I directly sent those query via Igor ? I've been able to configure the VDTOperationPort2 and VDTOpenPort and I'm able to send query via the port but I can't seem to understand how to send the proper data. I want to send 12 00 01 but the sent data displayed in the monitoring of the port displays different query. I get that it must be a question of choosing the right command but I can't figure out which out should I use.
Thank you for your answer
This seems to be a hexadecimal number. Have you tried to send it by the VDTWriteHex2 command?
VDTWriteHex2/L 0xFFFFFFFFFFFFFFFF
May 4, 2010 at 02:29 am - Permalink
thanks
G.
May 4, 2010 at 03:12 am - Permalink
Have you added the
0x
in front of the Fs? This is important, because otherwise Igor does not recognize the argument as a hex number and you will see the 46s. Tryprintf "%X\r", char2num("F")
on Igor's command line as an example.Additionaly I took a look in the SC2000 manual. It seems to be necessary to send 9 bytes for the ?status query, 1 for the command itself and 8 for the parameters, see the manual on page 81. You can't do this with just 1 call to
VDTWriteHex2
since this command can only sent 2, 4 or 8 bytes. So you have to callVDTWriteHex2
twice.May 4, 2010 at 05:02 am - Permalink
I propose to use - as you suggested - the
VDTWriteBinaryWave2
operation.VDTWriteBinaryWave2/type=0x48 binWave
May 4, 2010 at 05:13 am - Permalink
To send a three bytes byte, specifying the values in hex:
VDTWriteBinary2 0x12, 0x00, 0x01
To send a three bytes byte, specifying the values in decimal:
VDTWriteBinary2 18, 0, 1
These two commands send the exact same bytes.
You can also use VDTWriteBinaryWave2 in which case you must store the bytes in a byte wave.
May 4, 2010 at 08:07 pm - Permalink
Indeed the VDTWriteBinary2 works and I'm now able to send the good query but it still don't work, but I think a a question of coding not related to igor (end of command command).
Thanks guy for the answers
G.
May 5, 2010 at 01:34 am - Permalink
My so it seems that Igor send byte by byte when the interface sends the whole word ? how do I do the same with Igor ?
Best,
G.
May 5, 2010 at 02:47 am - Permalink
What the dumps show is that VDTWriteBinary2 does a separate write call for each parameter. However, this does not change what is transmitted. The same thing is transmitted whether all in one write call or in separate write calls.
The first thing I see that is suspect in the dump is the 0D byte. 0D is carriage return and is normally sent to mark the end of a line of plain text. It should not be sent in a binary transmission. VDTWriteBinary2 does not send carriage returns. Check to see if you have any other calls, e.g., to VDTWrite2, that should not be there. But VDTWrite2 does not send a carriage return either unless you include it in the str parameter.
What program are you using to monitor these transmissions? What is IRP_MJ_WRITE?
May 5, 2010 at 12:32 pm - Permalink
An IRP_MJ_WRITE request transfers data from a client to a COM port. It's the name of the subprocess. To follow transmission I use a serial port sniffer to get the information.
I still don't get it, there must be a difference between using one of many write calls because when it uses only one the device responds, and when it uses several it doesn't. ("it" would be the computer) Is there a way to use one write call ?
Best regards,
Gautier Papon
May 6, 2010 at 01:07 am - Permalink
Try putting the values in an unsigned byte wave and calling VDTWriteBinary2. For example:
VDTWriteBinaryWave2 temp
However, it should make no difference to the receiver whether you send the bytes all at once or one-at-a-time.
May 6, 2010 at 02:38 pm - Permalink
Have a nice day
Best regards
Gautier
May 7, 2010 at 02:56 am - Permalink