Sending Multiple CAN ID message at different rates

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Sending Multiple CAN ID message at different rates

400件の閲覧回数
KKumar
Contributor II

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.

 

 

 

0 件の賞賛
返信
1 返信

367件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@KKumar

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....
}

}

}
0 件の賞賛
返信