Hi Alex,
Following is the code which I have used.
/*Timer counter callback function */
void tc_callback_to_toggle_led(struct tc_module *const module_inst)
{
packet_send=true;
tc_disable(&tc_instance);
}
/*Main loop */
int main(void)
{
configure_tc();
configure_tc_callbacks();
SYS_TaskHandler();
APP_TaskHandler();
while(!Timerstart) //------>waiting for Start command from receiver (Sync frame)
{
SYS_TaskHandler();
}
while (1)
{
if(Timerstart)
{
port_pin_set_output_level(EXT1_PIN_10,true); //-------------->Start ADC conversion
Timerstart=false;
}
if(acqptr==70) //check if packet(14 samples,1 sample=5bytes) available. It will happen at exactly 200ms after Start ADC conversion.
{
tc_enable(&tc_instance); //start 20ms timer (for 1st transmitter),start 40ms timer (for 2nd transmitter) and 60ms-3rd TX
memcpy(appDataReqBuffer,acqbuf,PACKETSIZE);
appDataReqBuffer[SEVENTHY]=Dummy_Byte; //appDataReqBuffer[70]=0xFF(Dummy_Byte)
appDataReqBuffer[SEVENTHY_ONE]= Dummy_Byte;
appDataReqBuffer[SEVENTHY_TWO]=Dummy_Byte;
appDataReqBuffer[SEVENTHY_THREE]=Dummy_Byte;
appDataReqBuffer[SEVENTHY_FOUR]=(packet_counter>>
& 0xFF; //One second packet counter
appDataReqBuffer[SEVENTHY_FIVE]=packet_counter & 0xFF;
appDataReqBuffer[SEVENTHY_SIX]=Dummy_Byte;
appDataReqBuffer[SEVENTHY_SEVEN]=Dummy_Byte;
appDataReqBuffer[SEVENTHY_EIGHT]=Dummy_Byte;
appDataReqBuffer[SEVENTHY_NINE]=Dummy_Byte;
}
if(packet_send==true) // check if transmit ready.This will get true in the TC-Callback function after 20ms timer expired.
{
packet_send=false;
appSendData();
configure_tc();
configure_tc_callbacks();
}
}
}