09-29-2010 09:21 AM - edited 09-29-2010 09:22 AM
@christian_w wrote:
You have to convert the 16bit register values from Hex to Int16 ( i.e 0100h = 256 ) using the HexadecimalStringToNumber VI
That won't work. You need to use the Type Cast function since the data that's being received are not ASCII characters but hex values. Thus the string can be converted to an array of I16 thusly:

The meaning of each "word" is defined in the manual based on the command you sent.
09-29-2010 02:07 PM
1st i connect the EVC402 motor controller (NGM) software with labview 8.6 using basic serial write and read example.
the connection is made by using wireless module (Maxstream). Using 2 port on PC, one for NGM and one for labview.
then after i connect the NGM to labview i get that HEX display. you can see the picture of HEX display that i get from the attachment.
so the problem is i dont know what the meaning of the HEX display there.
09-29-2010 04:16 PM
First off, you should not be running a VI under normal operation using the Run Continuously button. Let me repeat that. Under normal operation you should not be using the Run Continuously button. That button is meant to be used for special debugging purposes. Frankly, I wish NI had never placed the button there in the first place. You should have a loop in your code that perform the operation (in this case the read part) until you press some sort of Stop button.
Now, as to your problem: As I said, if you have the string indicator set to hex display mode (which you do, based on your previous statement and the screenshot), then you are getting a stream of bytes. You can convert that to a sequence of numbers using the Type Cast function as I showed you. What do the numbers mean? Well, the documentation for the device will tell you that. You are not sending an actual command, so it appears the device is spitting out a sequence of numbers. Is it sending out the same sequence over and over again? If so, check the manual to see that this sequence is. That's something that you, as the developer, needs to do.
09-30-2010 05:44 AM
where can i get the I16 datatype and that *(type*)&x?
and why my type cast wires is two pink and 1 orange? not two blue and one pink like in your picture?
09-30-2010 08:59 AM
What you connect to the top of a type cast is what the outcome will be regarded as. In this example it's an array of integers, with the representation I16. (r-click to change) If it's orange it's a real number, most probably double.
If you r-click the output of the typecast and 'create indicator' it'll get the default name *(type*)&x'.
My guess is the next post will be a link to labview basics. 😉
/Y
09-30-2010 09:02 AM
@Yamaeda wrote:
My guess is the next post will be a link to labview basics. ;)
You read my mind... ![]()
@hohoi wrote:
where can i get the I16 datatype and that *(type*)&x?
and why my type cast wires is two pink and 1 orange? not two blue and one pink like in your picture?
Your question is an extremely basic one, and not one that we should be answering, frankly. If you have not done so, do the LabVIEW tutorials. To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.