05-02-2006 10:17 AM
05-03-2006 04:49 PM
Hey Ya-hoo,
I think I see the confusion that you are describing. In the code, when the floating point number is split to convert to Boolean arrays, the array is indexed at 0 and 1 for the lower and upper (respectively) bits. I have included a screen shot to clarify where I assume you are referring to. If this is the case then I don’t believe it is an error. The 0 and 1 are not referring to the channels you have set up in max for the LSB and the MSB (which are separated 0-3 for LSB, and 4-7 for MSB as you mentioned), but instead the 0 and 1 are referring the array index. So when you do the FieldPoint read, since you are already set up in MAX that channel 0 is the LSB and the channel 4 is the MSB, it already knows how to read that. Then it returns the floating point number which is stored as a 1D array, with the 0th index as the lower portion, and the 1nth index as the upper portion. Hence the indexing by 0 and 1 on the next step. So the upshot of all this is, it should be correct and working the way it is. If you find any weird behavior feel free to post back with a description. If there is indeed something wrong with the shipping example, we can look into that. Hope that helps,-GDE05-03-2006 07:09 PM
Do you mean that the value output array has different indexes with the channel indexes, channel index 4 should be array index 1. So if like this, how the rest of channel index reflect on the array index. It is really confusing.
Thanks..
05-04-2006 10:38 AM
Ya-hoo,
Yes, channel numbers are different from the data index. The confusion, I believe, stems from trying to correlate the channel numbers with the FieldPoint Reads return data array indexes. Do not try to make a correlation here, they are separate. Physically you set up channel 0 for the LSB, and channel 1 for the MSB. This configuration is done in MAX and relates to physical routing. Now after you do a FieldPoint Read, it returns the data into an array data type. This data is arranged with the LSB part of the number in 0 index, and the MSB part of the number in the 1 index. This is how the data is stored in software. Another way of looking at this is, if there was a correlation between physical channels and data storage, then for one counter operation (both LSB and MSB portions) you would need an array of at least size 8. But you would only be using the 0 index and 4 index, while padding the rest To see this visually: Index 0 1 2 3 4 5 6 7