CAN-bus problems

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
stijnvp
Posts: 1
Joined: Tue Feb 23, 2010 7:46 pm

CAN-bus problems

Post by stijnvp »

I maked some exercices my own, just like the teacher's notes but they don't work that good.
when you press and release the switch the LED's keep on sometimes, sometimes not...
that's quite a problem, also when more than one LED's is on it flashes sometimes.(Can it be a problem with the delay time at the end of the program??)
now i tested the test files on the little disc that was with the CAN-kit.
these files are can01hs_rx.HEX and can01hs_tx.HEX.
This program doesn't have the fault that sometimes a LED keeps on when switch released, so i was wondering if you guy's could send me the test program not in .HEX but in a format I can open with flowcode or something so I could see how it's made.

thanks,
stijn

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: CAN-bus problems

Post by Benj »

Hello

I think this problem relates to how often you are sending out the CAN bus message.

Take for example the following situation.

Loop
if switch pressed
Yes: Send CAN ID 1
NO: Do Nothing
Loop

In practise this would do nothing when the switch is not pressed but when the switch is pressed we will be constantly firing out messages until the switch is released. This causes congestion on the bus and may result in some no sends.

A better way of doing this would be to do the following.

Loop
if switch pressed
Yes: Send CAN ID 1 then wait for switch to be released
NO: Do Nothing
Loop

If you change your program using the ideas shown above then you shoulnt have any problems with LEDs getting left on etc.

The example test hex file is based on the Flowcode examples, I think its the example 2 files.

Post Reply