logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Sterownik silników BLDC i DC (oprogramowanie do testów edukacyjnych)

(Sponsorowany) magic9 26 Sie 2014 11:56 7185 0
REKLAMA
Treść została przetłumaczona angielski » polski Zobacz oryginalną wersję tematu
  • Sterownik silników BLDC i DC (oprogramowanie do testów edukacyjnych)

    Translated from:
    https://www.elektroda.pl/rtvforum/topic2774294.html

    Welcome.

    Beginner electronics dealing with microcontrollers from a very start are often very young and have limited knowledge of this field. Such an enthusiast who immediately wants to build some complex projects, may easily become frustrated and waste many hours if not even days on detecting the causes of the problems, and even then the results are likely to be far from perfect and costs generated can be high.

    Therefore, I decided to prepare a very dedicated (educational) driver module (called driver) BLDC motor to:
    1. to facilitate understanding of the principles of BLDC motor control,
    2. to help a beginner avoid spending too much money on damaged electronic components, in particular, transistors.

    The driver can also be used to control DC motors . It is based on one of the simplest schemes of this type of design. There is no logic to the problem of protecting the simultaneous inclusion of keys (transistors) of the top and bottom in a single phase:

    Sterownik silników BLDC i DC (oprogramowanie do testów edukacyjnych)

    what very often happens to a novice programmer like the inverse power on.

    In order to defend themselves any beginner can and should use software security features, which I call a fuse. Such a function should be called immediately after each commutation is completed and shall verify if the driver is not on in a manner that may causes a short circuit in one of three pairs of keys.

    An example of such a function:

    [syntax=c] void bezpiecznik(void){

    //Sprawdzamy, czy nie występuje konflikt sterowania, powodujący
    //jednoczene otwarcie tranzystora górnego i dolnego w tej samej fazie,
    //co oznacza wystąpienie zwarcia !!!

    //szczegóły oraz plik nagłówkowy z definicjami: http://mikrokontrolery.blogspot.com/2011/03/silnik-bldc-sterownik-bezpiecznik-test.html

    if(U_TR_G_SPRAW_STAN && U_TR_D_SPRAW_STAN){

    //Faza U - oba tranzystory są włączone - sytuacja niedopuszczalna!!!
    bezpiecznik_stop();

    }else if(V_TR_G_SPRAW_STAN && V_TR_D_SPRAW_STAN){

    //Faza V - oba tranzystory są włączone - sytuacja niedopuszczalna!!!
    bezpiecznik_stop();

    }else if(W_TR_G_SPRAW_STAN && W_TR_D_SPRAW_STAN){

    //Faza W - oba tranzystory są włączone - sytuacja niedopuszczalna!!!
    bezpiecznik_stop();
    }
    }

    //------------------------------------------------------------------

    void bezpiecznik_stop(void){

    //Funkcja wyłącza wszelkie tranzystory oraz przechodzi w stan sygnalizacji
    //błędu komutacji. Funkcja ta razem z funkcją bezpiecznik() pełni rolę
    //zabezpieczenia przeciwzwarciowego dla błędnie działającego algorytmu
    // komutacji w czasie pisania i testów programu.

    //wyłącz przerwania
    cli();

    //natychmiast wyłącz tranzystory
    WYLACZ_TRANZYSTORY

    //i ustaw stany niskie na pinach sterujących
    U_TR_G_USTAW_DDR
    V_TR_G_USTAW_DDR
    W_TR_G_USTAW_DDR
    U_TR_D_USTAW_DDR
    V_TR_D_USTAW_DDR
    W_TR_D_USTAW_DDR
    U_TR_G_PIN_L
    V_TR_G_PIN_L
    W_TR_G_PIN_L
    U_TR_D_PIN_L
    V_TR_D_PIN_L
    W_TR_D_PIN_L

    // ustaw pin LED jako wyjście
    BEZP_LED_DDR | = (1
    O autorze
    magic9
    Redaktor
    Offline 
  • REKLAMA
REKLAMA