Jump to content

How to get and implement the string...


pockey

Recommended Posts

Hi, all

I'm writing a program to test a board. And the front panel is shown as follows:

http://forums.lavag.org/index.php?act=attach&type=post&id=5056

When I click the "Start ADC" button, the computer will send a command to the board and the board will return both the command and hex string with 50 values.

As shown "0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE...."(they're the same as a testing)

My job now is to take out the 50 values and calculate the average of them.

It seems there's a tool called "Hexstring to number", I think I could use it to take every element out(not include the "0x"). However, I could not get the "0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE0xC7CE...." in that button event as shown in the right string indicator. Only the command "c a" was received at that stage.

Below is the block diagram of the "Start ADC" event:

http://forums.lavag.org/index.php?act=attach&type=post&id=5055

As I did not know how to get the hex string, I could do nothing to get the average value.....

Anyone could give me some tips?? Thanks a lot!

The original VI is aslo attached.

Link to comment

Thank you for your help!!

So now I know how to convert the string to an array.

However, the first problem is still there...I don't know how to get the exact hex string.

http://forums.lavag.org/index.php?act=attach&type=post&id=5071

As shown, I could only get the "c a" command. It seems the hex string value will be received until next Read from the COM Port.

http://forums.lavag.org/index.php?act=attach&type=post&id=5072

And if I replace the SubVI with detailed write and read implementation, I still could only get the "c a" in String Indicator 2

http://forums.lavag.org/index.php?act=attach&type=post&id=5073

It's so difficult to get the desired string from the COM Port......

And without the string, I could do nothing:(

Link to comment

http://forums.lavag.org/index.php?act=attach&type=post&id=5075

The hyperterminal is shown as above. However, I do not understand much about "display type"....

I did not use the SubVI in this event so that I can get the string without previous information.

And there's nothing shown in String Indicator 2 if I read the COM Port twice.

http://forums.lavag.org/index.php?act=attach&type=post&id=5076

But it's strange that if I "Highlight Execution", the hex string what I want will be shown in the String Indicator 2.

Why, why, why...

I have no idea about "endchar enabled", the SubVI is also attached.

Link to comment

QUOTE(pockey @ Mar 2 2007, 03:44 AM)

Oh, the problem has been solved! I add wait time before the second read part and with enough wait time, I could get the desired string now!!

And now I want to calculate the average of the total 51 hex values, is there such function offered by LabVIEW?

Why the two reads?

Mean.vi?

Ton

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
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.