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.
PWM over CAN
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel