gardarog
Member
I'm having some trouble reading messages on a Profibus network.
The problem is that one message from the device I'm communicating with contains three different pieces of information in a single word.
The device in question is a UNISAB II control system for a screw compressor in a fish processing plant, and it's configured for 16 Input and 16 Output words.
The Profibus network's master is an SST Profibus Scanner and the PLC being used is an Allen-Bradley SLC5/05.
The first word from the UNISAB device contains information about the compressor's capacity, it's running state, and running mode.
The structure of the word is as follows:
Now I want to mask out the most significant 10 bits, i.e. the compressor capacity, and right shift them so that they sit in the place
of the least significant 10 bits in a new data file, as I need to display the measurement on an operator screen.
I've properly masked out the bits I'm interested in:
but I'm having trouble shifting them six places to the right so that the SCADA system doesn't print the compressor's capacity as total gibberish.
I've tried the BSR instruction but it seems to me that it's only good for shifting a single bit through a data file.
Does anyone here have any idea of how this partial word shift might be accomplished, or is there perhaps an even easier way to get the desired result?
The problem is that one message from the device I'm communicating with contains three different pieces of information in a single word.
The device in question is a UNISAB II control system for a screw compressor in a fish processing plant, and it's configured for 16 Input and 16 Output words.
The Profibus network's master is an SST Profibus Scanner and the PLC being used is an Allen-Bradley SLC5/05.
The first word from the UNISAB device contains information about the compressor's capacity, it's running state, and running mode.
The structure of the word is as follows:
Now I want to mask out the most significant 10 bits, i.e. the compressor capacity, and right shift them so that they sit in the place
of the least significant 10 bits in a new data file, as I need to display the measurement on an operator screen.
I've properly masked out the bits I'm interested in:
but I'm having trouble shifting them six places to the right so that the SCADA system doesn't print the compressor's capacity as total gibberish.
I've tried the BSR instruction but it seems to me that it's only good for shifting a single bit through a data file.
Does anyone here have any idea of how this partial word shift might be accomplished, or is there perhaps an even easier way to get the desired result?