How do I set the status bits in a 1553 status word?
There are two methods for setting status bits in the 1553 status word.
- BusTools_RT_AbufWrite: Set the status word for all sub-addresses for the selected RT.
- BusTools_RT_MessageWriteStatusWord: This gives finer control over which messages set bits in the status word.
For this routine, you need to provide the RT address, the sub-address, the TX or RX setting, and a message buffer. This controls the status returned by a specific message, defined by the input arguments. Since the input arguments include a message buffer, it sets the status word for that single message buffer, and no other. Remember, when you initialize the RT, the call to BusTools_RT_CbufWrite allows you to specify multiple data buffers for each RT address, sub_address, and TX/RX setting. Since these buffers are a circular linked list, commands to a RT/SA/TX/RX loop through all the defined buffers. Status words set for a single buffer are visible only when that buffer is actually used for a transaction.
A common problem in application software is setting the status word on buffer 0 and not seeing the status bit set until several messages to the RT/SA have transacted. That's because buffer 0 is not sent until the linked list of message buffers completes and cycles back to buffer 0. If you want to use BusTools_RT_MessageWriteStatusWord and have multiple buffers, you need to call it for each buffer. See below for example code:
This code changes the status word in all the buffers for the RT/SA/RX/TX setting.