CAN Read Problem PIC18F4585

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

CAN Read Problem PIC18F4585

Post by QMESAR »

Hi All

I have a problem with my CAN code.I hope you guys can help me to find the error

As you see in the picture I have a decision block that checks if there was a message received (CAN buffer one set to receive all messages and buffer one set to reject all)
at the moment I am not working or using the data in the message all i want to do is blink a led if a message is received.
I am sending only 1 message from my CAN Analyzer (PCAN) .

The problem to me is that the CAN CheckRx() is always returning a value ,therefore my variable MESSAGE is always bigger than zero and the RX led is blinking
this is also the case with even no message send to CAN module
Once I am able to run the basic check that there is a message in the buffer ,I will then start to extract the data

I know that it not a hardware issue as I used my test setup with my Code which runs 100% correctly it is definitely some error in my FC code,I attache the project files as well
Please I did not see how to use logical en bit wise operators as yet and therefore possibly switching the conditions for the led's a bit ruff :D :oops:

Transmitting a buffer works fine with this code

Regards
Peter
Attachments
CAN_P18.zip
(286.52 KiB) Downloaded 216 times
1.jpg
(89.67 KiB) Downloaded 478 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: CAN Read Problem PIC18F4585

Post by QMESAR »

Hi All

Sorry for my previous post I made a CAN beginner Error (I am an old user of CAN) I did not realize setting the mask and filter in FC should be decimal numbers
(I am so use to do the calc's and setting in Hex)I automatically entered them as hex numbers second problem was that I allows all ID's :oops:

Problem solved so far now for the next step


Regards
Peter
Attachments
Functioning CAN
Functioning CAN
2.jpg (81.41 KiB) Viewed 3809 times
1.jpg
1.jpg (71.11 KiB) Viewed 3809 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: CAN Read Problem PIC18F4585

Post by kersing »

You can enter hexadecimal values, just prefix them with 0x. So 513 can be entered as 0x201.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: CAN Read Problem PIC18F4585

Post by QMESAR »

Hi Kersing

Thank you very much for the reply :D

Regards
Peter

Post Reply