This program is a combination of "example_bc2.c" and "example_rt2.c". It demonstrates multifunction (BC and RT) operation using interrupts and multiple buffers.
BC Simulation - This function sends commands to RT1 SA1 RECEIVE and RT1 SA2 TRANSMIT. It uses multiple buffers (2) for the BC message and uses INTERRUPT EVENTS to detect when these messages have sent/received data so the buffers can be safely read/written. There is one interrupt per frame. The last message in the frame generates the interrupt. Therefore, buffers are updated and swapped at the end of every minor frame.
RT Simulation - This function simulates RT1 with two subaddresses, SA1 RECEIVE and SA2 TRANSMIT. It uses multiple buffers (2) for each SA and uses INTERRUPT EVENTS to detect when these SAs have sent/received data so the buffers can be safely read/written.
Use a bus analyzer (BusTools/1553) to monitor the data sent to RT1 SA1 Receive and the data sent by RT1 SA2 Transmit; you should see the upper byte of all data words increment on each message.
Click the link on the right to download this file.