Jump to content

string to array of characters for VISA Write


Graeme

Recommended Posts

Hello all,

I have a requirement to convert a string to an array of the string's characters, each element of the array containing sequentially one character of the string. I can't believe no one has ever wanted to do this but various searches reveal little. I attach my effort but wonder if there is an even simpler way.

Risking two questions in one posting I'll say why I'd like to do this. I have a company home brew box that I can send a string command to via HyperTerminal, quite successfully. However, in LabVIEW the box will only accept one character at a time, so a VISA Write in a For Loop indexed by said array of characters. Can anyone enlighten me as to why HyperTerminal sends the string successfully in one go (apparently) , but via LabVIEW it must be a character at a time. As ever, indebted.

Regards, Graeme.

Link to comment

Your VI is fine. I don't think there is any simpler way. People don't do this very much because a lot of functions which could handle one character also handle the characters as U8 integers. For example the IsDigit? function and its siblings Can handle strings or U8s.

It seems like it would be better to focus on your real problem. I use LabVIEW serial all the time and I have never had that issue. Is your box expecting Serial flow control? If you dig in to all of the hyperterminal settings and make sure you set the exact same settings in NI-VISA (using attribute nodes on your VISA refnum) then they will perform the exact same way. AFAIK Visa is just wrapping the same Microsoft OS Serial port functions as Hyperterm.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.