Dave Posted October 29, 2019 Report 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?
MVP 2023 Joe Tauser Posted October 29, 2019 MVP 2023 Report Posted October 29, 2019 Have you considered using the Bits to Num instruction and copying bit arrays to UINT32 tags? Joe T.
bobnorway Posted October 30, 2019 Report 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.
Dave Posted October 30, 2019 Author Report 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.
bobnorway Posted October 31, 2019 Report 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now