LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie Array Problems

Solved!
Go to solution

Hi All .

I am new to LabVIEW and have done a basic course however I have some issue with Arrays,Please help me understand this.

I am building an array with 10 elements (0-9) which gets populated with u8 data (for a CAN message Data)

this array gets send over USB to the CAN HW .this all works perfectly when each element does not contain a 0(zero) value ,

The problem is that once there is an 0 in a element all the Elements after the one containing the 0(zero) is not updated or populate with the new data,

as can be seen from the prints below .

my question how to force the array to always use and populate all elements or how is this handled in LabVIEW .

 

Here is the array when all elements are non zero 

1.jpg

 

The data received and send correctly by the CAN message(in Hex)

1.1.jpg

Once there is a 0 in an element all elements after the 0 never gets updates the 

2.jpg

2.2.jpg

The array building just for testing my error

3.jpg

 

I appreciate any help or information

Kind Regards

QMESAR

 

 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 1 of 6
(466 Views)
Solution
Accepted by topic author QMESAR
04-25-2018 01:14 AM

Hi qmesar,

 

The problem is that once there is an 0 in a element all the Elements after the one containing the 0(zero) is not updated or populate with the new data

This looks like a problem of the "USB Transfer" subVI or the hardware you use: the array is built correctly in your "main" VI…

As you don't supply any information for both items we cannot help you with detailed explanations!

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 6
(455 Views)

@GerdW wrote:

 

This looks like a problem of the "USB Transfer" subVI or the hardware you use: the array is built correctly in your "main" VI…

 

Dear GerdW.

Thank you very much for your answer,I appreciate this.

I expected the supplied Vi from the HW manufacturer I will inform them and see if they can help with the sub VI,as for the HW I am 99% sure it is working correctly as using my own firmware in C on the unit CAN is doing all as expected.

Kind Regards

QMESAR


 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 3 of 6
(447 Views)

Could it be a case of the USB transfer assuming 0-terminated array, like a C-style string? Does 0 require some special handling? In some systems e.g. 0 could be a special character sign require some transformation (though you'd think the USB Transfer should handle that).

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 4 of 6
(433 Views)

Hi Yamaeda 

Thank you for your comments  .

I would think the USB handle the array as it is bytes in U8 however I have no contacted the supplier I was afraid it me doing something stupid in  LabVIEW and wanted to make sure with you guys first ,I will report back once I have more information

Kind Regards

QMESAR 

 
---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 5 of 6
(423 Views)

Hi All 

Just to report back on this topic,

As you all mentioned I handle the Array correctly the supplier has fixed a bug in the supplied dll and sub Vi for the USB Transfer  

all is working fine now 

 

Thank once again for all the help

Regards 

QMESAR 

---------------------------------------------------------------------------------------
Learning is an endless process but needs to start some where
0 Kudos
Message 6 of 6
(364 Views)