Hi NXP,
I need to send multiple CAN message at different rate from only one CAN MBs
Let say.
CAN ID 0x30 : at 500 ms
CAN ID 0x31 : at 500 ms
CAN ID 0x32 : at 1000 ms
CAN ID 0x33 : at 1000 ms
CAN ID 0x34 : at 1000 ms
CAN ID 0x35 : at 100 ms
CAN ID 0x36 : at 500 ms
CAN ID 0x37 : at 100 ms
Suggest some logic to send these CAN message at their cycle time.
You need to set a timer, set the interrupt time of this timer to 100ms, and set multiple event stamp flags, for example:
uint8_t flag_100ms,flag_500ms,flag_1000ms = 0;
/*100ms interrupt handler*/
void timer_interrupt_handler()
{
flag_100ms++;
flag_500ms++;
flag_1000ms++;
}
main()
{
while(1)
{
if(flag_100ms >= 1)
{
flag_100ms = 0;
do something....
};
if(flag_500ms>=5)
{
flag_500ms = 0;
do something....
}
}
}