
PNI Sensor Corporation
DOC#1014688 r09.2
TCM User Manual
Page 74
}
}
//
// Have the CommProtocol build and send the fra me to the module.
//
void TCM::SendComm(UInt8 frameType, void * dataPtr, UInt16 dataLen)
{
if(mComm) mComm->SendData(frameType, dataPtr, dataLen);
// Ticks is a timer function. 1 tick = 10msec.
mResponseTime = Ticks() + 300;
// Expect a response
within 3 seconds
}
//
// This is called each time this process gets a turn to execute.
//
void TCM::Control()
{
switch(mStep)
{
case 1:
{
UInt8 pkt[kDat 1];
// the compents we are requesting, preceded by the number of
// components being requested
pkt[0] = kDataCount;
pkt[1] = CommProtocol::kHeading;
pkt[2] = CommProtocol::kPitch;
pkt[3] = CommProtocol::kRoll;
pkt[4] = CommProtocol::kTemperature;
SendComm(CommProtocol::kSetDataComponents, pkt,
kDat 1);
// Ticks is a timer function. 1 tick = 10msec.
mTime = Ticks() + 100;
// Taking a sample in 1s.
mStep++;
// go to next step of process
break;
}
case 2:
{
// Ticks is a timer function. 1 tick = 10msec.
if(Ticks() > mTime)
{
// tell the module to take a sample
SendComm(CommProtocol::kGetData);