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.
我想知道我是否使用 driverlib 来写入 GPIO、如何同时写入多个 GPIO。
当我使用 bitfield 时、我可以执行类似操作 GpioDataRegs.GPADAT.all=0x8F7A;用于同时图解多个 GPIO。 但是,当使用 driverlib 时,似乎我只能使用 GPIO_WritePin ()来逐个执行此操作,这会浪费大量时间。
1. CPU 需要 多次调用 GPIO_WritePin ()
2.每个 GPIO_WritePin ()也需要大量的时间,因为它看起来像这样
空 GPIO_WritePin (UINT16 gpioNumber、UINT16 OutVal)
{
Volatile UINT32 *gpioDataReg;
UINT32引脚掩码;
gpioDataReg =(Volatile UINT32 *)&GpioDataRegs +(gpioNumber/32)* GPY_DATA_OFFSET;
pinMask = 1UL<<(gpioNumber % 32);
如果(outVal => 0)
{
gpioDataReg[GPYCLEAR]= pinMask;
}
方案
{
gpioDataReg[GPYSET]= pinMask;
}
}
谢谢
Yifu
尊敬的 Yifu:
感谢您的提问。 您仍然可以使用"gpioDataReg[GPYCLEAR]"和"gpioDataReg[GPYSET]"直接写入寄存器、这将允许您同时写入多个寄存器。 您也可以直接执行如其他 GPIO driverlib 函数中所示的"HWREGH"写入和读取、以直接写入寄存器。
此致、
Vince
你是否在 HWREGH 上有任何文档?我曾尝试在 TRM 中搜索但找不到它。
尊敬的 Yifu:
请参阅使用 HWREGH 的 C2000Ware 示例、它是一个用于直接访问寄存器的硬件宏。 这并没有真正的解释、因为它基本上只是从寄存器中直接读取。
此致、
Vince
你好
我已查看 C2000ware 文件夹、但找不到名为 HWREGH 的示例。
这是我检查的文件夹 C:\ti\c2000\C2000Ware_4_03_00_00\driverlib\f2838x\examples\C28x
谢谢
尊敬的 Yifu:
没有名为 HWREGH 的示例。 但在 C2000Ware 中的任何位置(在所有 sci.h/c、GPIO.h/c 等[任何外设]中)、都会使用 HWREGH 宏。 请参阅所有这些文件以使用 HWREGH。
此致、
Vince