PWM over CAN

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

Moderators: Benj, Mods

Post Reply
dan654321
Posts: 2
Joined: Tue Apr 19, 2011 8:19 pm

PWM over CAN

Post by dan654321 »

Hello
I have the easy can bundle

Can any one help me ? .Can you send a Signal from a poteniometer (analog) 2.5v var to 0v node 1 , over the CAN BUS to node 2 for PWM OUTPUT.

thanks Dan.

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: PWM over CAN

Post by Benj »

Hello Dan,

Yes this should be fairly simple to achieve, CAN is ideal for this kind of control.

Basically you will need to send CAN IDs to control the PWM operation.

Here is a basic command table, I have just made these values up so you can change to make your own protocol if needed.

ID = 1, Data Byte 0 = 1 - PWM Enable channel 1
ID = 1, Data Byte 0 = 2 - PWM Enable channel 2

ID = 2, Data Byte 0 = 1 - PWM Disable channel 1
ID = 2, Data Byte 0 = 2 - PWM Disable channel 2

ID = 3, Data Byte 0 = 1, Data Byte 1 = x - PWM Set Duty channel 1 to x
ID = 3, Data Byte 0 = 2, Data Byte 1 = x - PWM Set Duty channel 2 to x

Then all you need to do at the PWM end is to listen to the can messages and then call the appropriate PWM component macro when messages are received.

Post Reply