04-23-2010 11:42 AM
Solved! Go to Solution.
04-26-2010 06:27 PM - edited 04-26-2010 06:33 PM
Hello,
Accessing the number of channels from the scan list may prove to be difficult due to the fact that there are several different methods that define connections, disconnections, triggering and timing of the scan. e.g. channel1->channel2, ~channel1->channel2, ch0->com0 & ch9->com1, ch0->com0 && ch9->com, ch0:7->com0. For example, parsing the string to extract this number would require comparing the channel names and characters then implementing logic to determine the channel count. Therefore, the most convenient approach would be to enter a value for the number of channels.
Best regards,
Ali M
Applications Engineer
National Instruments
04-27-2010 11:55 AM
Hello Ddemara,
If you're muxing through a bunch of thermocouple channels, the scan list will not be complex, so we could easily write some code to determine the number of channels. Our code would need to do the following:
1)Start a counter with value 0.
2)Iterate through the user-defined scan list and add 1 to the counter each time you find a comma. The last element won't have a comma, so we'll need to add 1 to the value at the end.
3)Find each instance of a colon (':'), then find the two numbers on either side of the colon, subtract those two numbers, and then add them to the counter value. We don't need to add one to the end value here because we've already included the first element in the series
4)The value of the counter at this point is the number of channels in the scan list.
If you have any questions setting this up, post up. Have a great day!
FYI: The channel count in the example you mentioned allows us to fetch data from the DMM such that the first array element is always the thermocouple. If the channel count is wrong, indexing fetched element 0 will result in plugging the wrong value into the CJC input of the thermocouple scaling vi.
04-27-2010 01:17 PM
07-29-2010 09:38 PM
thanks john!