Dave Posted October 29, 2019 Report Share Posted October 29, 2019 I want to create a data sampler that monitors a number of bits and integers, for troubleshooting purposes. As far as I can see, I can only assign integers or REAL numbers to the feed tags. I know I could compare each bit status and store either 1 or 0 into an integer, then use those integers in the data sampler.... but I have a large number of bits that I want to monitor and was hoping there is a better way. Any ideas? Quote Link to comment Share on other sites More sharing options...
MVP 2021 Joe Tauser Posted October 29, 2019 MVP 2021 Report Share Posted October 29, 2019 Have you considered using the Bits to Num instruction and copying bit arrays to UINT32 tags? Joe T. Quote Link to comment Share on other sites More sharing options...
bobnorway Posted October 30, 2019 Report Share Posted October 30, 2019 perhaps by packing 8 or 16 or 32 bits to an uint then store a copy and compare with it. any value change can then trigger an unpack rutine to identify which bit changed. Quote Link to comment Share on other sites More sharing options...
Dave Posted October 30, 2019 Author Report Share Posted October 30, 2019 Thanks for your replies. The bits I need to monitor are not contigious, but I will look at the Bits to NUM instruction anyway...I haven't used that before. As for "packing/unpacking bits into a UINT", I'm not exactly sure how to go about doing that. Quote Link to comment Share on other sites More sharing options...
bobnorway Posted October 31, 2019 Report Share Posted October 31, 2019 heres a quick example of what I ment packing bits, the bit order does not have to be contigious It should be flexible enough so you can get something done. Test_Bits.ulpr Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.