02-08-2011 07:27 AM
In Custom Device Initialization VI, I defined the following input channels in order:
Status
Data0
Data1
Data2
After build, VS shows the channels in alphabetical order.
Data0
Data1
Data2
Status
Which order are these channel values stored in device input FIFO?
I can test it in VS but it will save a lot of time if someone could tell me in few words.
Thanks.
02-08-2011 08:47 AM
The data is usually returned in the order that you have added it.
However, you shouldn't always count on that. The way to go is to check the channels to make sure that they get indexed properly in the driver VI.
If you don't want the system explorer to automatically reorder the channels that you add, you may add to the parent node the following entry:
<ExcludeFromAlphabeticalOrder>true</ExcludeFromAlphabeticalOrder>
Visit the CustomDevice XSD file to find out where this tag has to get added. In order to make it work, you have to add this tag to the parent item. Everything underneath the parent item stays untouched when populated in SE. They appear as they have been added to the data storage.
The XSD file can be found at this location on your disk: C:\Documents and Settings\All Users\Documents\National Instruments\NI VeriStand 2010\Custom Devices
Tom
02-08-2011 09:09 AM
One way to "check" is to add a property or GUID to the channel. In the driver, check the item reference for the property or GUID and perform the associated operation.
Steve
02-08-2011 10:39 AM
There is also a helper VI that you can use to get the index of an item.
C:\Program Files\National Instruments\LabVIEW 2010\vi.lib\NI Veristand\Custom Device Tools\Custom Device Utility Library\NI VeriStand - Get Channel FIFO Buffer Index.vi
02-08-2011 01:12 PM
Thank you All.
The channels I used for asynchoronous custom device are a lot more than I said previously and have different data format, so I tried to follow Tom's suggestion to disable the alphabetical order.
I did the following and re-built the Configuration, but seems VS still takes channels in alphabetical order (I'm using VS 2010).
change the line 167 of Custom Device.xsd from
<xs:element minOccurs="0" default="false" name="ExcludeFromAlphabeticalOrder" type="xs:boolean" />
to
<xs:element minOccurs="0" default="true" name="ExcludeFromAlphabeticalOrder" type="xs:boolean" />
02-08-2011 01:18 PM
Oh I am sorry, I guess I didn't explain it all the way.
The XSD file is actually the description file (schema) of how the related XML file has to look like.
The XSD file gives you information on where the tag has to get added in the XML file.
What you want to do is to open your custom device XML file and add the above mentioned tag to the proper location of your page. Hereby, the page should be the parent page of the channels that you have specified.
Let me know if you have any other questions!
Thanks,
Tom
02-08-2011 03:08 PM
Thank you, Tom. I will try that.
I've tested - the data is returned in the order that I added it. Then I got a new question.
I meant to create output channels with the following order.
Status bit 0
Status bit 1
...
Status bit 7
Data1
Data2 bit 0
Data2 bit 1
...
Data2 bit 15
Data3
All the bit channel values are boolean, Data1 and Data3 channel values are integer. So I used two GUIDs to create 24 boolean channels and 2 integer channels as the attachment shows.
However, the resulted order is
Data1
Data3
Status bit 0
Status bit 1
...
Status bit 7
Data2 bit 0
Data2 bit 1
...
Data2 bit 15
So in order to create the orders as expected, I have to use create channels for Status bits, Data1, Data2 bits, and Data3 separately. It's not a big deal, but it would be better if there is simpler way.
Thanks.