How can I create multiple conditional messages using BusTools/1553-API?
This example is a variant of "Example_bc6.c" that uses CONDITION and CONDITION3 to apply MULTIPLE conditions to determine a branch. If the Service Request bit is set in the status word AND the first data word is 0x1234, then send a TX VECTOR WORD mode command.
This example program sets up a simple BC message list. It creates a list of three messages, 1-R-1-32 2-T-2-32, and 1-T-2-32 in a 20ms minor frame. This BC list runs until stopped by user input. The user can either display the data (or errors) for the 2-T-2-32 message or quit.
TWO CONDITIONAL blocks have been inserted after the 2-T-2-32 message. If we see the SERVICE REQUEST bit set in the status word from this message AND the first data word is 0x1234, then the BC branches to send 2-T-0-16 (TX VECTOR WORD mode command) before going on with the frame.
In order to test this, you need a bus analyzer (BusTools/1553) simulating RTs 1 and 2. Toggle the SR bit in the RT2 status word and set the first data word for RT2-TX-SA2 to 0x1234, then use the bus monitor to verify that the TX VECTOR WORD mode command is sent when the conditions are met.
Download this example by clicking the link on the right.