delay or wait function

Universal Programmable Converter for CAN FD and CAN
Post Reply
ishara
Posts: 3
Joined: Sat 9. Apr 2022, 15:17

delay or wait function

Post by ishara » Sat 9. Apr 2022, 15:56

Hi,
I'm wondering, how can we add a delay or wait function between messages in PCAN-Router FD. ( I need to add 20s or more delay here)

EX: I'm changing CAN ID 0X200 to 0X201 and change byte in 201 based on the value of 200.

Code: Select all

if ( RxMsg.id == 0x200  &&  RxMsg.msgtype == CAN_MSGTYPE_STANDARD)
{
        RxMsg.id = 0x201;
	RxMsg.msgtype =CAN_MSGTYPE_STANDARD;
	if(RxMsg.data8[0] == 0x10 ||RxMsg.data8[0] ==0x08)
	{
	        RxMsg.data8[0]=0x01;
                [u][b](how can I add 20s delay here?)[/b][/u]
        }
	else if(RxMsg.data8[0] == 0x18)
	{
	        RxMsg.data8[0]=0x21;
	}


Thanks
Last edited by K.Wagner on Mon 11. Apr 2022, 07:59, edited 1 time in total.
Reason: Code formatting for better reading

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: delay or wait function

Post by M.Maidhof » Mon 11. Apr 2022, 12:40

Hi,

to implement a delay, you have to use a timer. Please see the 03_TIMER_IO example for more details on how to use a timer in PCAN-Router FD.

regards

Michael

Post Reply