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.

[参考译文] TMS320F28055:如何声明变量正确?

Guru**** 2032800 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/567687/tms320f28055-how-to-declare-a-variable-correct

器件型号:TMS320F28055

你(们)好

我使用 controlSUITE 中的 DPlib。  我位于接下来声明的 main.c 文件中:

#pragma DATA_SECTION (CNTL_2P2Z_CoefStruct1、"CNTL_2P2Z_Coef");
#pragma DATA_SECTION (CNTL_2P2Z_CoefStruct2、"CNTL_2P2Z_Coef");

struct CNTL_2P2Z_CoefStructCNTL_2P2Z_CoefStruct1;
struct CNTL_2P2Z_CoefStructCNTL_2P2Z_CoefStruct2;

接下来、我想访问另一个 xxx.c 文件中已声明的变量。 如何更正在另一个文件中声明的内容?

同样的问题和

SineAnalyzer sine_mainsV = SineAnalyzer_defaults;

我需要访问 另一个 xxx.c 文件中的 sine_mainsV。   我该怎么做?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您必须在两个.c 文件包含的头文件中对结构进行原型设计、以便在您的情况下在头文件中进行声明

    extern struct CNTL_2P2Z_CoefStructCNTL_2P2Z_CoefStruct1;
    extern struct CNTL_2P2Z_CoefStructCNTL_2P2Z_CoefStruct2; 


    因此、您可以按照在一个.c 文件中所示对其进行定义、但仍可以在另一个.c 文件中使用它