LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

last bit in serial setting

Hi to all,

I'm newbie with Labview 8.5.
I'm viewing properties of VISA serial Resource Name, I see there is the property "End mode for reads". Help context saids: "This property specifies the method used to terminate read operations. Valid values are: (0) End None, (1) End Last Bit, (2) End TermChar. If the value is (2) End TermChar, then the value of the property TermChar En is ignored. ". I wish obtain more informations on method "last bit" but I find same informations at:

http://zone.ni.com/reference/en-XX/help/371361A-01/lvvisaprop/asrl_end_inserial_instr/

Who can give me other informations on this metod or indicate urls with more documentations?

best regards.
0 Kudos
Message 1 of 13
(4,697 Views)
The NI-VISA manual has the following:

VI_ATTR_ASRL_END_IN indicates the method used to terminate read operations.

  • If it is set to VI_ASRL_END_NONE, the read will not terminate until all of the requested data is received (or an error occurs).
  • If it is set to VI_ASRL_END_LAST_BIT, the read will terminate as soon as a character arrives with its last bit set. For example, if VI_ATTR_ASRL_DATA_BITS is set to 8, the read will terminate when a character arrives with the 8th bit set.
  • If it is set to VI_ASRL_END_TERMCHAR, the read will terminate as soon as the character in VI_ATTR_TERMCHAR is received. In this case, VI_ATTR_TERMCHAR_EN is ignored.

Because the default value of VI_ATTR_TERMCHAR is 0Ah (linefeed), read operations on serial ports will stop reading whenever a linefeed is encountered. To change this behavior, you must change the value of one of these attributes—VI_ATTR_ASRL_END_IN or VI_ATTR_TERMCHAR.


Does this answer your question, or were you looking for something more specific?
Message 2 of 13
(4,693 Views)
thanks,

yes, this answer my question.
I need to receive a message from serial port, message is a sequence of character.
I need to choose a method to understand how complete message is arrived from serial port:
from your informations I understand that last bit method saids only one character is ready, while putting a termination character in message to send, I are able to recognize whole message using second method.


regards
0 Kudos
Message 3 of 13
(4,687 Views)

Hi don Marco,

If you want to have a deepest view on the functionality of VISA API you can give a look to the following LabVIEW VISA Tutorial

I strongly recommend you to try and test first Serial functionality by using the 'Advanced Serial Write and Read.vi' you can find in the Ni Example Finder searching for 'serial' as searching keyword.

Hope this helps!

Best regards

Hudson | NIIT AE

Message 4 of 13
(4,658 Views)

Hi all,

I might be having a similar problem but I am not sure. i am using labview 8.0

I am trying to write a simple program that controls a SpectraPro 275. With this you can send a command like "?NM\r" to request for the wavelength position. 

Using a simple write and read program I am able to send a request to the serial port; however the reply is that my request is incorrect. 

 using the same command on VISA resource settings, I get the right result.

Anybody has an idea on what might be wrong?

Below is my program if someone wants to have a look

0 Kudos
Message 5 of 13
(4,547 Views)

What does this:

 using the same command on VISA resource settings, I get the right result.

 mean?

 

Off-hand I don't see anything immediately obvious that's wrong. Are you sure about the command? Usually the "?" is at the end.

 

Code comment: You are leaning too much on sequence frames. Other than the need to have that delay your sequence frame is completely unnecessary. If you replace the Wait (ms) function with the Time Delay function then you don't need any sequence structure since that function has error in/error out terminals.

0 Kudos
Message 6 of 13
(4,529 Views)
Your string control is not set correctly. Right click on it and select '\' Codes Display. If you don't do that, then all you are sending is the characters '\' and 'n'. Not at all the same thing.
0 Kudos
Message 7 of 13
(4,526 Views)
Dennis, he's actually appending the "\r" in code on the block diagram rather than using the string control, so the string fed to the VISA Write should be correct, as far as I can tell.
0 Kudos
Message 8 of 13
(4,521 Views)

Oops, you're correct.

 

 

Maybe instead of \r, you need to send a \r or a \r\n. Have you tried the either of the shipping examples for serial?
Message Edited by Dennis Knutson on 09-26-2008 08:43 AM
0 Kudos
Message 9 of 13
(4,515 Views)

to Denis,

I actually used the "\r\n" still doesn't work. 

i am controlling a Spectrapro 275 and in the manual in order to send a request to the device you need to preceed your request with "?". So if I want to know at what wavelength the monochromator is i have to send the command "?NM\r"

0 Kudos
Message 10 of 13
(4,494 Views)