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.

[参考译文] LAUNCHXL-F28379D:如何在 for Loop 中交互 GPIO?

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/980169/launchxl-f28379d-how-interact-gpios-in-for-loop

器件型号:LAUNCHXL-F28379D
主题中讨论的其他器件:C2000WARE

我不熟悉微控制器编程、我尝试在 for 循环中与某些输入 GPIO 进行交互、但我不知道该怎么做。

# define rows 4

int input_pin[rows]={GpioDataRegs.GPADD.bit.GPIO1、GpioDataRegs.GPADD.bit.GPIO2、GpioDataRegs.GPADD.bit.GPIO3、GpioDataRegs.DP.bit.GPIO4};GPr

;

对于(r = 0;r < rows;r++)
{
如果(&INPUT_PIN[r]=0)

执行一些操作
;}

我正在尝试一个具有如下定义的代码(这不是所有项目、BTW) 、但给出错误" identifier input_pins is undefined 且必须有一个常量值"。我认为 input_pin 应该是一个易失性结构、但我不确定它是如何实现的、  我只是想在 for 循环或类似的任何循环中作出反应、请提供任何建议、谢谢您的参与

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

    [引用 user="Juan Esteban Hernandez Alvarez"]但请提供错误" identifier input_pins is undefined and must have a constant value)代码片段中的数组变量名为  input_pin、而不是 input_pins

     

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

    尊敬的 Juan:

    代码片段中使用的数组变量(input_pin 和 input_pins)不匹配、这会导致编译错误。

    此外、您还可以尝试运行 C2000Ware 中提供的"led_ex1_blinky"示例以熟悉 GPIO 切换。

    此致

    Siddharth