MATLAB: Timer to send a new message

simulinktimertrigger

Hi all
I have a system with receiver and a triggered sender. When the receiver receives a new message it will trig the sender to send the next message.So if the message lost in their way to the receiver the system will hang forever.
I need a timer that wait the message for a specific period ( 1 sec ) , if no new message received the sender will triggered to send next message. of course this timer reset when receiver has a new message.
My receiver has a trigger out port that switches between 1 and -1

Best Answer

I would probably use a resettable integrator for this task. Feed the integrator a constant value of '1', that way it will act as a timer. If the timer reaches a defined value (1 sec) send a message (then reset the integrator). If you receive a message, send a new one, and just reset the integrator to zero and it will begin counting up again.
Of course - there is always the option of using Stateflow for such a task.