Download Conejo User's Manual
Transcript
Developing Custom Data Logger Applications
Within IIMain() , the target application instantiates each of the supported timebase objects into a vector called Timebases.
Though only a single timebase is used at a time within the target application, creation of an array of timebases simplifies
generic access to a particular timebase within the implementation.
Additionally, IIMain() initializes the Mailbox and Alert interfaces. The overall operation of the target application is governed
by Host-initiated messages. For example, starting and stopping of data streaming is initiated by Host-to-Target messages.
Messages and alerts can only be processed following the calls to InitMessageTransport() and InitAlertTransport(),
respectively.
The call to Login() causes a number of messages to be sent to the Host PC, containing target-specific information such as the
number of A/D channels supported, their bit resolution and the maximum acquisition speed. This generic behavior facilitates
code sharing of example source between each member of the Matador family. In fact, the ASnap (Host) and ASnap (Target)
sources are identical for the Toro, Conejo, Oruga, and Delfin products.
//--------------------------------------------------------------------------// IIMain() -- Global initialization and command processing thread
//--------------------------------------------------------------------------void IIMain()
{
volatile bool run = true;
Alert.Reset(); TimestampCtl Stamp; Stamp.Run(true);
// Instantiate one of each timebase type Timebases.push_back(new BasicTmb); Timebases.push_back(new
AdcElapsedTmb); Timebases.push_back(new AdcFramedTmb); Timebases.push_back(new AdcThreshTmb);
Timebases.push_back(new AdcMultiTmb); Timebases.push_back(new SlaveTmb);
// Establish communications with Host
InitMessageTransport();
// Enable alert reception
InitAlertTransport();
// Send board ID info
Login();
// Command processor: Start the stream each time xfers are re-enabled while (run)
{
if (!Status.XferEnabled)
{ Sleep();
continue;
}
StreamData();
}
for (int i = 0; i < Timebases.size(); ++i)
delete Timebases[i];
}
Figure 78. Target Initialization Sequence
Following initialization of the message and alert subsystems and Host customization via the information relayed via Login(),
IIMain() drops into an indefinite loop. The behavior of this loop is modified via the state of the global object Status, whose
contents are updated via Host-initiated messages. For example, when the Host Start function is called, the kEnableXfer
message is sent to the DSP. The DSP message handler interprets this message and modifies the state of Status.XferEnabled
Conejo User's Manual
177