Hello,
You probably need to call the CheckRx macro inside the interrupt macro as this does things like copies the data from the can registers into a local buffer. Hopefully that's all that is required but maybe not. If so then let us know and I'll dig in further.
CAN Component - Buffer
-
- Matrix Staff
- Posts: 1926
- http://meble-kuchenne.info.pl
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: CAN Component - Buffer
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: CAN Component - Buffer
Hi, As suggested I tried inserting the CheckRx macro but this did not change the behaviour, the interrupt still does not run.
Any further thoughts?
Or could you supply the interrupt code you are using and I'll try to play around with it as a custom interrupt.
I tried making my own custom but its on the endge of my understanding.
Thanks, J.
Any further thoughts?
Or could you supply the interrupt code you are using and I'll try to play around with it as a custom interrupt.
I tried making my own custom but its on the endge of my understanding.

Thanks, J.
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: CAN Component - Buffer
Hello,
Here's the current interrupt defined in the definition file you can try and play around with. Not really sure what else to suggest at the moment. It's too hot today
Handler
Enable
Disable
Here's the current interrupt defined in the definition file you can try and play around with. Not really sure what else to suggest at the moment. It's too hot today

Handler
Code: Select all
if (ts_bit(PIR3, RXB0IF) && ts_bit(PIE3, RXB0IE))
{
FCM_%n();
cr_bit(PIR3, RXB0IF);
}
Code: Select all
st_bit(INTCON, PEIE);
st_bit(PIE3, RXB0IE);
Code: Select all
cr_bit(PIE3, RXB0IE);
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: CAN Component - Buffer
Hello,
Yes that's correct and they are defined by Flowcode as follows.
#define st_bit(var,bitno) CAL_APPEND(var, bits.bitno) = 1
#define cr_bit(var,bitno) CAL_APPEND(var, bits.bitno) = 0
#define ts_bit(var,bitno) (CAL_APPEND(var, bits.bitno))
so
becomes the following when using PICs
Yes that's correct and they are defined by Flowcode as follows.
#define st_bit(var,bitno) CAL_APPEND(var, bits.bitno) = 1
#define cr_bit(var,bitno) CAL_APPEND(var, bits.bitno) = 0
#define ts_bit(var,bitno) (CAL_APPEND(var, bits.bitno))
so
Code: Select all
cr_bit(PIR3, RXB0IF);
Code: Select all
PIR3bits.RXB0IF = 0;
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Re: CAN Component - Buffer
Ah... I may have missunderstood.
If I place the CheckRx macro in the main, then the interupt will run.
I assumed it would have to be in the Interrupt routine.
Does this make sense that it works with the CheckRx macro in the main loop?
J.
If I place the CheckRx macro in the main, then the interupt will run.
I assumed it would have to be in the Interrupt routine.
Does this make sense that it works with the CheckRx macro in the main loop?
J.
Re: CAN Component - Buffer
Just checked last nights work.
The CAN interrupt will only run if CheckRx is placed in the main loop.
If the main loop is slowed down by a 500ms Delay, the interrupt will only run at this rate.
So I am fairly sure Check Rx is toggling some bit thus activating or deactivating a larger part of the CAN periferal.
Are you happy to forward the routines behind CheckRX ?
J.
The CAN interrupt will only run if CheckRx is placed in the main loop.
If the main loop is slowed down by a 500ms Delay, the interrupt will only run at this rate.
So I am fairly sure Check Rx is toggling some bit thus activating or deactivating a larger part of the CAN periferal.
Are you happy to forward the routines behind CheckRX ?
J.
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 503 times
- Been thanked: 686 times
Re: CAN Component - Buffer
Hello,
Ok that's interesting, I wonder why. The code for the CheckRx can be found here C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_CAN.c around line 382.
Ok that's interesting, I wonder why. The code for the CheckRx can be found here C:\ProgramData\MatrixTSL\FlowcodeV9\CAL\PIC\PIC_CAL_CAN.c around line 382.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel