06-20-2012 11:24 AM
The VISA config Serial port node is where you tell LabVIEW which termination character to use, based on the instrument manual.
Then set the number of bytes to read ( VISA read node) to a large number, the read will stop when it finds the termination character or times out, so the number of bytes to read is set high to effectively tell the read to either find the termination character or time out.
As for the writes,
You can add a termination character by appending it to the "string write" string.
Or you could use the following property to automatically add it to your "string write"
Serial Settings:End Mode for Writes
Short name: ASRL End Out
Requires: Base Package
Classes: Instr, Serial Instr
Specifies the method used to terminate write operations. Valid values include: (0) None, (1) Last Bit, (2) TermChar, (3) Break. The default is (0) None.
Descriptions
(0) None—The write will transmit the exact contents of the user buffer, without modifying it and without appending anything to the data.
(1) Last Bit—The write will send all but the last character with the highest bit clear and then transmit the last character with the highest bit set.
(2) TermChar—The write will send the character specified as Termination Character after the data transmits.
(3) Break—The write will transmit a break after all the characters for the write have sent.
06-20-2012 11:28 AM
You enter into the string control whatever command you want. They are provided in section 6.1.2.4. It appears there is a continuous measurement mode but you will have to decide on how you want to take readings. Terminate with \r\n if you want to keep both of those as the termination characters.
I would advise you to experiment with the communication with either MAX or a terminal emulation program such as hyperterminal, procomm, putty, etc instead of first trying to write code.
06-20-2012 12:25 PM
a) "The VISA config Serial port node is where you tell LabVIEW which termination character to use, based on the instrument manual."
if I go to the VISA conf serial port subVI of the "Basic serial write and read VI", by clicking twice in the visa serial icon, there is the possibility (as you say) to set the parameter
termination char
(0xA = '\n' = LF)
but what I should write there?
If you look in the user manual of the instrument it is said that delimiter are CR+LF, CR, LF... is this what I have to write or what else? But I cannot write nothing just one letter not two
User´s manual is here:
http://www.mitutoyo.com/Manuals/99MBC095ALSM6200.pdf
I think I should write here CR which means measurment starts..but i just can add one letter not two..
b) "Then set the number of bytes to read ( VISA read node) to a large number, the read will stop when it finds the termination character or times out, so the number of bytes to read is set high to effectively tell the read to either find the termination character or time out. "
For example, for the "Basic serial write and read VI", I can put a number as high as 8 or 9 in bytes read control of the control panel. Is this ok?
As for the writes,
You can add a termination character by appending it to the "string write" string.
Ok, If I see in the user´s manual, this could be again CL
06-20-2012 12:46 PM
You are confusing commands with the termination character/delimiter. First of all, in order to set the termination character for a read, do not open the subVI, place constants on the block diagram where you call it. For simplicity, set the instrument's termination character to just line feed. Then you don't have to change the VISA Configure Serial Port. The VISA Configure Serial Port function does not do a thing for appending a termination character when you do a write. Therefore, if you want to use the basic example, type a command such as CR (measurement start) followed by \n. This CR is different than the CR (Carriage Return) defined in the manual as a termination character.
Configured correctly and assuming the instrument responds, you can request a very high number (max of an integer) and it will not matter since the read will terminate as soon as a line feed is detected. Do not make the mistake of specifying too low of a number.
06-20-2012 01:03 PM
"For simplicity, set the instrument's termination character to just line feed"
How?
Then you don't have to change the VISA Configure Serial Port. The VISA Configure Serial Port function does not do a thing for appending a termination character when you do a write. Therefore, if you want to use the basic example, type a command such as CR (measurement start) followed by \n. This CR is different than the CR (Carriage Return) defined in the manual as a termination character.
I write CR\n in the panel control of the "Basic serial write and read VI"...nothing happens
Configured correctly and assuming the instrument responds, you can request a very high number (max of an integer) and it will not matter since the read will terminate as soon as a line feed is detected. Do not make the mistake of specifying too low of a number.
For example, could you suggest me a number?
06-20-2012 01:11 PM
"in order to set the termination character for a read, do not open the subVI, place constants on the block diagram where you call it. For simplicity, set the instrument's termination character to just line feed"
what you mean? what I should set and where? How can I set this constants..where ? How can I et a line feed, and where?
06-20-2012 01:34 PM
Hi,
Check out some of the instrument examples in the example finder for instrument control, especially serial. You have to be able to communicate with the instrument in MAX to be able to program it, IMO.
After reviewing this thread, I think you have a lot of great suggestions and some instructions to review and check. Please follow through on these and I think it will clear up quite a bit, especially the last four questions you asked.
06-21-2012 08:50 AM
done!!!! thanks for all your time!! If somebody needs this driver just let me know!
04-15-2013 08:59 AM
Hello,
I am very interested in your VI, indeed I have set a micrometer Mitutoyo LSM-6200.
Is that I can use what you have developed?
Thank you in advance
Bourgui78 a French
03-30-2015 11:16 AM
ON the LSM-500S, can someone know how to solve error 8? what is the real cause. I am desperating with this error recoring in 2 units
Thank you in advance