How can I use BusTools/1553-API to program conditional messaging to compare against a memory location AND branch on every Nth iteration?

This example program demonstrates the use of CONDITIONAL messages. This is a modification of example_bc6.c to use CONDITION2 to compare against a memory location.

This is a basic example program that sets up a simple BC message list. It creates a list of two messages, 1-R-1-32 and 2-T-2-32, in a 20ms minor frame. This BC list runs until stopped by user input. Users can either display the data (or errors) for the 2-T-2-32 message or quit. This program can also set or clear the test location in memory for our conditional block.

A conditional block has been inserted after the 1-R-1-32 message. This conditional block checks a location in board memory. If this location is 0x0001, then the BC branches to send 1-T-0-16 (TX VECTOR WORD mode command) before going on with the 2-T-2-32 message.

This program is a variant of Example_bc6a.c that adds a conditional count feature. The conditional count feature is used to branch to the 1-T-0-16 command every third time.

Basically, this demonstrates how to use CONDITIONAL with COUNT to branch every Nth time. Note that you could setup the CONDITION2 block mask/value so that it is always TRUE and uses this to conditionally execute messages on every Nth time that your frame executes.

In order to test this, you need a bus analyzer (BusTools/1553) to monitor the BC data and (optionally) simulating RTs 1 and 2.

Download this example by clicking the attachments link on the right.