So I need to use RSI to pass data to the outputs....map2digout seems a good way to do it but is limited to WORD. I intended to keep 32 bit (and have always used DINT with RSI before). Am I missing something? Is there a smart math way to do this(with the functions in RSI). Seems odd you can access a group of outputs(or inputs) up to DWORD but not set them?
RSI map2digout
-
wes_mcgee -
July 15, 2015 at 5:27 AM -
Thread is Resolved
-
-
If I'm not mistaken, the variable size is limited to multiple of BYTE, DWORD being the maximum size. And by giving the first bit place and the data size, the correct output is written to dout.
-
What version of RSI are you referring to, here? RSI 3.x has DIGOUT, which works for Bit, Byte, Word, and DWord.
Under RSI 2.x, I did do something like what you're talking about, quite a few years ago -- I needed to track a bunch of single-bit status flags using RSIMon, but didn't have enough monitor channels left. So I mapped each bit into a position in a byte, and mapped that byte into one RSIMon channel as well as to several $OUTs.
I don't have the code handy, but IIRC I simply multiplied each bit by a different power of two and fed those results into a Sum object.
-
I am using RSI 3.2 build 10. Yes, DIGOUT has those params, but that is for accessing....I need to write to the outputs (so setdigout or map2digout). Oddly the param options are different; 16 bits would not be nearly enough for position data(I mean what if you had a 35 m track....you would have to round to the cm!)
-
Right, right. That's what I get for getting in a hurry.
Well, for a brute-force solution, you could stack a whole range of SetDigOuts. But if you need a 32-bit output (yeah, I was wrong about DWord, I thought it was in there), then my first thought is to simply stack two Map2DigOuts, and multiply the input to the second one by 2^16. To an external device, it would just look like a single 32-bit consecutive word. Hmm... handling the sign bit could be a bit tricky, though. Probably have to use some of the BitWise logic operators to mask off the sign bit and handle it separately.