This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Peripheral's Declaration, Definition and Call with Embedded C

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I start to use TI CCS to program for peripheral with embedded C. I use park.h and park.c as an example and paste park.h below. In park.h, why it needs define  __PARK_H__, typedef struct PARK, PARK_DEFAULTS, and function void park_calc(PARK_handle)? In park.c, it calculates and updates void park_calc(PARK *v). In the main ISR, it calls park1.calc(&park1).

park.h                                                                                                                                                                                                                                                                                                    #ifndef __PARK_H__
#define __PARK_H__

typedef struct {  _iq  Alpha;    // Input: stationary d-axis stator variable
      _iq  Beta;   // Input: stationary q-axis stator variable
      _iq  Angle;  // Input: rotating angle (pu)
      _iq  Ds;   // Output: rotating d-axis stator variable
      _iq  Qs;   // Output: rotating q-axis stator variable
        void  (*calc)(); // Pointer to calculation function
     } PARK;            
#define PARK_DEFAULTS {  0, \
                          0, \
                          0, \
                          0, \
                          0, \
                   (void (*)(Uint32))park_calc }

void park_calc(PARK_handle);

Thank you,

 

  • Jun Yu,

    Firstly, You are using an older version of the DMC Lib to refer for the code. The latest C2000 collateral can be found through controlSUITE,

    Once downloaded, remember to select install of DMC Lib,  you woudl find the park documentation at

    controlSUITE\libs\app_libs\motor_control\math_blocks\v2.0\~Docs

    It explains the software structure, we have moved from two different files to just a single header files as we moved to macro formats for our library,

    but I still do not understand what exactly are you trying to do?