CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

VNH2SP30 What exactly ENa,ENb

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

VNH2SP30 What exactly ENa,ENb
PostPosted: Sun Dec 18, 2016 3:53 pm     Reply with quote

Hello friends,

I'm trying to learn VNH2SP30, but I'm locked about ENa,ENb pins especially this writing in datasheet, what does it mean?
More precisely how I will do it in CCS C. Is it ok to use "Output_Float();" ???
and then output_high(); ???
Quote:

Open drain bidirectional logic pins. These pins must be connected to an external pullup
resistor. When externally pulled low, they disable half-bridge A or B. In case of
fault detection (thermal shutdown of a high side FET or excessive ON state voltage
drop across a low side FET), these pins are pulled low by the device (see truth table
in fault condition).

http://www.st.com/content/ccc/resource/technical/document/datasheet/group2/66/b8/f5/2c/9a/66/41/c7/CD00043711/files/CD00043711.pdf/jcr:content/translations/en.CD00043711.pdf
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 18, 2016 5:11 pm     Reply with quote

It all depends on if you need to use the diagnostics from the device.
You should always post your PIC type and basic code. Also have you made the PCB or bought something ?

Jay
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Dec 18, 2016 6:17 pm     Reply with quote

Typically you wouldn't need to disable half the bridge so the ENa and ENb
signal pins would be connected to PIC input pins.

The Enx pins are normally be pulled high via resistor and are pulled low
by the A or B bridge when a malfunction exists.

If you need to disable half the bridge for some reason you can change the
PIC pin to an output and pull it low.
_________________
Google and Forum Search are some of your best tools!!!!
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 2:05 am     Reply with quote

Jay I didnt buy motor and driver yet ,this is why I couldnt sent ,When I got it I will write.

[/quote]The Enx pins are normally be pulled high via resistor and are pulled low
by the A or B bridge when a malfunction exists.
you mean I'll set mikrocontroller pin to input then I will pull high(what happining then in controller).
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 2:33 am     Reply with quote

First thing. One 'keyword' in the data sheet. 'Must'.

These pins _must_ be connected to pull up resistors.

Now the pins are useable in two different ways. The first is as diagnostic outputs from the chip. Connect them to two PIC pins, and program these as inputs. Then if something goes wrong you can read the voltages on these pins, to see what has happened. These are the Diag outputs.

The second way is if you pull them low, then they allow you to turn off each half of the bridge. ENa turns off half bridge 'A', and Enb, turns off half bridge 'B'.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 2:56 am     Reply with quote

Okay now I got it also with in Application Information. I will set input these ENx and externally pull high. But last one question, if the device generate problem, ENx pin pull low and PIC read 0, am I right?
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 3:18 am     Reply with quote

Not quite that simple. This is the 'Table 12' truth table.

DiagA will go low
DiagB may go low or stay high in some circumstances.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 3:24 am     Reply with quote

Yes, I saw it, but how do I get the knowledge that the motor is going backwards or forward and speed because PID controller want this information to feedback ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 3:30 am     Reply with quote

You don't from this chip.

This is a driver, not a position sensor.

You need to add a position sensor to the motor. Typically a quadrature encoder.

Many years ago, I posted a fast quadrature decoder:
<http://www.ccsinfo.com/forum/viewtopic.php?t=40338&highlight=quadrature>

and the core code for an efficient integer PID:
<http://www.ccsinfo.com/forum/viewtopic.php?t=19703>

However these days it is much cheaper (and easier) to handle the quadrature using a hardware solution (either a PIC with built in quadrature decoding, or a chip that does this).
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 3:41 am     Reply with quote

I'm trying to understand that. I'm going to buy an engine with an encoder and I will drive it with this device. I understand that it will only drive it. Sorry my question was the previous one. I want to ask how to use the encoder output information exactly ? What I heard that the timer was used. İf my questions are bad, I'm sorry.
I will look your sites now.
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 5:14 am     Reply with quote

Don't use/read the timer.

Instead, calculate the time interval you want to use for your servo. This will depend on the resolution of the encoder, the PWM frequency being used (you really want the interval to be synchronous to the PWM), the response time, how long the maths will take, etc. all the parameters already mentioned.
Once you have worked out what this interval has to be, work out a way of generating a 'tick' at this interval.
Then have your code perform the servo functions when this tick triggers.
Now the key thing then is that delatT then becomes a constant. Suddenly not needed in the maths at all. You can just build the constant corresponding to this, 'into' the servo factors (for instance Kp, can just be stored as Kp/delatT). All the 'delatT' figures can disappear from the maths the processor has to perform.

Study some PID examples. MicroChip have several.
They all keep deltaT constant for this reason.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 5:43 am     Reply with quote

One more question, what is meant here ?

Low High High Low
High High Low Low -->count =1 or

Low High
High High --> count = 1

This gearmotor is a powerful 12V brushed DC motor with a 30:1 metal gearbox and an integrated quadrature encoder that provides a resolution of 64 counts per revolution of the motor shaft, which corresponds to 1920 counts per revolution of the gearbox’s output shaft. These units have a 0.61"-long, 6 mm-diameter D-shaped output shaft. This gearmotor is also available without an encoder.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 6:22 am     Reply with quote

By the way, the IMU will be in the program and will be fed the motor with PID according to IMU.
DeltaT is now calculated according to gyroscope, so Kalman Filter works correctly, in this case I think that if the PID and the other calculations are included again. DeltaT according to gyroscope will be a system's deltaT, right?
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Dec 19, 2016 8:07 am     Reply with quote

First don't get hooked on PID.

PID can be a good starting point, but in many cases is not the best algorithm for system control. You will find there are other variants some to catch things faster PID^2 for example, and other omitting some terms (PD for example).

Now what you are describing may well need to bring the motor itself 'outside' the main control loop. Problem is that if you choose the loop to suit the IMU, the time involved may well be too slow for good control of the motor. Commonly systems like this, have a 'simplified' motor control, (typically omitting the I term, since the IMU will handle the integral error), with the motor system itself then able to accept motor movement commands (often 'to where' & 'at what maximum speed'), with it's own independant control loop). Trying to put too many things in one loop is a sure way to end up with problems like oscillation, as you get interference effects from the time constants of all the sub components. This is why things like multi-copters, have several separate control loops often with correction from other slower loops outside.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group