Connecting to Device via VDT2
lin
Printing of V_VDT after VDTWrite2 returns 1, so seems to be successful.
Below is the source code.
Function cmdAg(pp)
String pp
String command = pp +"\n\r"
// initialize port
VDT2/P=COM5 baud=57600, stopbits=1, databits=8, parity=0
VDTOperationsPort2 COM5
VDTWrite2 command
End
String pp
String command = pp +"\n\r"
// initialize port
VDT2/P=COM5 baud=57600, stopbits=1, databits=8, parity=0
VDTOperationsPort2 COM5
VDTWrite2 command
End
I am invoking the function with cmdAg("MR"), where "MR" is an ASCII command which should change the mode of the controller.
Using supplied software I am able to control and steer the controller using these commands, so the syntax of them should be fine. I am a bit lost, because I don't really have any ideas how to debug this.
Any help would be much appreciated.
Double-check the parameters against the documentation for the piezo controller.
What OS are you running on?
Does your machine have built-in serial ports or if not, what serial adapter are you using?
Make sure no other software is using the serial port. For example, reboot and start Igor before running any other software.
If you are running on VISTA or Window 7, try launching Igor by right-clicking the Igor.exe icon and choosing Run as Administrator.
August 19, 2011 at 11:57 am - Permalink
CRLF is represented by "\r\n", which is not what you have in your code.
August 19, 2011 at 03:07 pm - Permalink
Good catch, 741!
August 19, 2011 at 06:54 pm - Permalink
I fixed the error pointed out by 741, and rechecked all the parameters (data bits: 8, parity: none, stop bits: 1, flow control: none, termination character: CR/LF). Unfortunately, it still does not work.
I have to mention that the specified baud rate is 921600. However, Igor throws an 'Invalid baud rate error' if I try to set this baud rate. So I tried to run it at a lower baud rate and adjusted the settings of the COM port accordingly. Could this be the problem?
August 22, 2011 at 03:37 am - Permalink
VDT2 supports only a limited number of hardcoded baud rates. If my version is still up to date then the fastest rate that it currently supports is 256000 baud. Adapting this to your baud rate (which is pretty high) will require an updated version of the XOP. I'm sure hrodstein will have some thoughts on this later.
August 22, 2011 at 08:04 am - Permalink
That's a very unusual baud rate.
VDT2 supports only the baud rates shown in the VDT2 Settings dialog.
You need to set the piezo controller to use the same baud rate as you set in VDT2. If this is not possible then you will not be able to control the device from Igor.
August 22, 2011 at 08:20 am - Permalink