Hi all,
I was wondering if anyone can help.
I am trying to control a simple DC motor attached to an EB-094 motor driver board, and to create a flowchart to test the principles of operation using Flowcode7.
However - there is no 'component macro' for this EBlock, and (although I have searched fairly thoroughly) I cannot find any simple example code to drive the board.
I can actually get the board to work - using the simple generic PWM component macro, but I don't feel that this is the right way to do things. Apart from still then needing to control other pins (such as the Motor Enable signal, and to monitor the Motor Over-Current Detect flag), I believe that using the generic PWM macro is just loading my final HEX file with a whole load of code that I do not need.
Does anyone have a "starter for ten" that they can ofer?
Is there any intention fo provide a simple test flowchart and example flowchart for every EBlock - most seem to have 'some' level of support, but I haven't seen any updates since 2013.
Cheers,
Bill
EB-094 DMOS Motor Driver Board (using L6206)
-
- Posts: 31
- Joined: Tue May 04, 2010 8:05 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: EB-094 DMOS Motor Driver Board (using L6206)
Hi!
EB094 needs these connections:
P0 Bridge A enable (Motor output goes to HighZ if Low, high to enable control)
P1 Bridge A protection (HIGH if OK, LOW if Problem detected)
P2 Output A1 control, (High = IN1A sources VPwr / Low = sinks to GND.)
P3 Output A2 control, (High = IN2A sources VPwr / Low = sinks to GND.)
P4 Bridge B enable (Motor output goes to HighZ if Low, high to enable control)
P5 Bridge B protection (HIGH if OK, LOW if Problem detected)
P6 Output B1 control, (High = IN1B sources VPwr / Low = sinks to GND.)
P7 Output B2 control, (High = IN2B sources VPwr / Low = sinks to GND.)
Basically the EB094 enables you to have different states for the motor:
1. To get motor drive Forward, you need first enable it by putting the Bridge to controlled mode (Drive according pin to HIGH).
2. After enabling, you can read the Thermal pin to check if it even is possible to drive motor.
3. Then you set another output pin (IN1, IN2) to VPwr state, and other to GND state.
4. To stop motor, you can put both pins to VPwr or GND state to get motor to brake...
Or to let it freely come to stop by turning the control pin to low, to get bridge to HighZ state.. <-- NOT RECOMMENDED ACTION; CAN KILL YOUR EB094 IF MOTOR BACKWARD CURRENT TOO HIGH. But all students did this on smaller motors, and no EB094 were killed or harmed by these actions...yet. *Knocks wood*
To drive motor at variable speeds, you can use PWM to drive the other signal, but this might make your mileage vary.
--> According to the datasheet, the L6206 can withstand pretty much..
http://www.st.com/content/ccc/resource/ ... 002346.pdf
And i recommend checking out the EB094 datasheet too! http://www.matrixtsl.com/resources/file ... 4-30-1.pdf
EB094 needs these connections:
P0 Bridge A enable (Motor output goes to HighZ if Low, high to enable control)
P1 Bridge A protection (HIGH if OK, LOW if Problem detected)
P2 Output A1 control, (High = IN1A sources VPwr / Low = sinks to GND.)
P3 Output A2 control, (High = IN2A sources VPwr / Low = sinks to GND.)
P4 Bridge B enable (Motor output goes to HighZ if Low, high to enable control)
P5 Bridge B protection (HIGH if OK, LOW if Problem detected)
P6 Output B1 control, (High = IN1B sources VPwr / Low = sinks to GND.)
P7 Output B2 control, (High = IN2B sources VPwr / Low = sinks to GND.)
Basically the EB094 enables you to have different states for the motor:
Code: Select all
1 2 ENA
HighZ x x 0
Brake to GROUND 0 0 1
Brake to VPwr 1 1 1
Forward 1 0 1
Backward 0 1 1
2. After enabling, you can read the Thermal pin to check if it even is possible to drive motor.
3. Then you set another output pin (IN1, IN2) to VPwr state, and other to GND state.
4. To stop motor, you can put both pins to VPwr or GND state to get motor to brake...
Or to let it freely come to stop by turning the control pin to low, to get bridge to HighZ state.. <-- NOT RECOMMENDED ACTION; CAN KILL YOUR EB094 IF MOTOR BACKWARD CURRENT TOO HIGH. But all students did this on smaller motors, and no EB094 were killed or harmed by these actions...yet. *Knocks wood*
To drive motor at variable speeds, you can use PWM to drive the other signal, but this might make your mileage vary.
--> According to the datasheet, the L6206 can withstand pretty much..
http://www.st.com/content/ccc/resource/ ... 002346.pdf
And i recommend checking out the EB094 datasheet too! http://www.matrixtsl.com/resources/file ... 4-30-1.pdf
Ill just keep the good work up!
-
- Posts: 31
- Joined: Tue May 04, 2010 8:05 pm
- Has thanked: 5 times
- Been thanked: 10 times
- Contact:
Re: EB-094 DMOS Motor Driver Board (using L6206)
Thanks for the feedback EtsDriver,
However - I have no problems with actually 'controlling' an L6206 (such as is on the EB094). I have the datasheets, and I actually have a fully functioning FC7 flowchart (PWM speed control, forward/reverse direction change, motor enable/disable, an motor over-current detection).
The problem is thatI am not sure if I have created the flowchart 'correctly'.
I have used two (generic) PWM component macros to give me PWM output on two pins of my PIC chip (18F2331, Channel 1 on Port C.2 and Channel 2 on Port C.1). Both have been configured as per their default settings, other than to chnage the Prescaler value from 1 to 16 - to give a longer period / lower frequency for the base PWM signal.
Thereafter, I have to use 'Output' to control the ENABLE signal (on Port C.0 in my case) and 'Input' to read the state of the OCD signal (on Port C.3).
Obviously I have to set the Duty Cycle of one of the PWM signals such that I can control speed - and have to set the Duty Cycle of the other PWM channel to '0' to allow motion to take place. Swapping this gives me the ability to control direction.
If I need to 'hold' the motor at a given position, I then take both PWM Duty Cycles to '0'.
The two questions I was really posing were:-
Cheers,
Bill
However - I have no problems with actually 'controlling' an L6206 (such as is on the EB094). I have the datasheets, and I actually have a fully functioning FC7 flowchart (PWM speed control, forward/reverse direction change, motor enable/disable, an motor over-current detection).
The problem is thatI am not sure if I have created the flowchart 'correctly'.
I have used two (generic) PWM component macros to give me PWM output on two pins of my PIC chip (18F2331, Channel 1 on Port C.2 and Channel 2 on Port C.1). Both have been configured as per their default settings, other than to chnage the Prescaler value from 1 to 16 - to give a longer period / lower frequency for the base PWM signal.
Thereafter, I have to use 'Output' to control the ENABLE signal (on Port C.0 in my case) and 'Input' to read the state of the OCD signal (on Port C.3).
Obviously I have to set the Duty Cycle of one of the PWM signals such that I can control speed - and have to set the Duty Cycle of the other PWM channel to '0' to allow motion to take place. Swapping this gives me the ability to control direction.
If I need to 'hold' the motor at a given position, I then take both PWM Duty Cycles to '0'.
The two questions I was really posing were:-
- "Is what I am doing 'correct', or is there a better way?"
"Is there any example code for use with the EB-094 - after all, nearly every other EBlock has such resources available?"
Cheers,
Bill
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: EB-094 DMOS Motor Driver Board (using L6206)
triokenwood wrote: The two questions I was really posing were:-
"Is what I am doing 'correct', or is there a better way?"
"Is there any example code for use with the EB-094 - after all, nearly every other EBlock has such resources available?"[/list]
Hi Bill,
I would advise you to look at the Power switch module of the 18F2331 as this module is designed to run Power switching which allows you to control a motor in very fancy ways what you are doing with the normal PWM blocks is fine
and by useing them you have no other option to do as you are doing ,
I would move my Control of the motor to the Power Switch Module if I were in you position
Here is an example FC 6 Code to run a DC motor with the Power Switch Module on an EB022 hope this helps you
- Attachments
-
- DC Motor L298 Driver.zip
- (772.54 KiB) Downloaded 471 times
-
- 1.jpg
- (191.23 KiB) Downloaded 2199 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- 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: EB-094 DMOS Motor Driver Board (using L6206)
Here is an example using the EB094 board and the EB091 hardware for our DSP motor control solution.
The EB091 target can be changed to the chip of your choice.
The EB091 target can be changed to the chip of your choice.
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