Other Parts Discussed in Thread: TM4C123GH6PM, ENERGIA
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TM4C123GH6PM 主题中讨论的其他器件: Energia
工具/软件:Code Composer Studio
工具/软件: Code Composer Studio
你(们)好 每当我尝试使用"GPIOPinConfigure()"时,似乎会出现以下错误,如下所示:
但是,只要不使用函数"GPIOPinConfigure()",我就不会得到错误:
实际上、我希望能够使用两个 TM4C123GH6PM Launchpad 进行 SSI 连接、以便发送温度信息(从一端)并将其打印到 Kentec LCD 屏幕(在另一端)。 寄件人的完整代码发布在以下位置:
#include
#include
#include
#include
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "inc/hw_ints.h"
#include "driverlib/interrupt.h"
#define DHTPIN PF_0 //数据 GPIO 引脚
#define DHTTYPE DHT22 //传感器类型(DHT11或 DHT22)
DHT DHT (DHTPIN、DHTTYPE);
//LCD 打印
LiquidCrystal LCD (PD_1、PD_2、PD_3、PE_1、PE_2、 PE_3);
void setup(){
//将您的设置代码放在这里,运行一次:
Serial.begin(115200);//串行波特率
serial.println ("DHT22测试!");
dht.begin();
lcd.begin(16、2);
lcd.print ("test");
延迟(2000年);
lcd.clear();
}
/*void UARTIntHandler (void)
{
uint32_t ui32Status;
ui32Status = UARTIntStatus (UART0_BASE、TRUE);//获取中断状态
UARTIntClear (UART0_BASE、ui32Status);//清除已发出的中断
while (UARTCharsAvail (UART0_BASE))//循环(有字符时)
{
UARTCharPutNonBlocking (UART0_BASE、UARTCharGetNonBlocking (UART0_BASE));
//回显字符
GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_2、GPIO_PIN_2);//闪烁 LED
SysCtlDelay (SysCtlClockGet ()/(1000 * 3));//延迟~1 msec
GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_2、0);//关闭 LED
}
}*/
void loop(){
//将主代码放在此处,重复运行:
SysCtlClockSet (SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHz);
SysCtlPeripheralEnable (SYSCTL_Periph_UART0);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOA);
//GPIOPinConfigure (GPIO_PA0_U0RX);
/*GPIOPinConfigure (GPIO_PA0_U0RX);
GPIOPinConfigure (GPIO_PA1_U0TX);
GPIOPinTypeUART (GPIO_Porta_base、GPIO_PIN_0 | GPIO_PIN_1);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOF);
GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE、GPIO_PIN_2);
UARTConfigSetExpClk (UART0_BASE、SysCtlClockGet ()、115200、(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
IntMasterEnable();
IntEnable (INT_UART0);
UARTIntEnable (UART0_BASE、UART_INT_RX | UART_INT_RT);*
lcd.noDisplay();
延迟(200);
lcd.display();
延迟(200);
延迟(2000年);
float h = DHT.read湿度();
float t = DHT.readTemperature();
float f = DHT.readTemperature (真);
if (isnan (h)|| isnan (t)|| isnan (f)){
serial.println ("无法从 DHT 传感器读取!");
返回;
}
//在串行监视器上打印结果
serial.print ("湿度:");
serial.print(h);
serial.print ("%\t");
serial.print ("温度:");
serial.print(t);
serial.print("*C");
serial.print ("、");
serial.print(f);
serial.println("*F");
//在 LCD 上打印
lcd.setCursor(0、1);
lcd.print ("yum%=");
lcd.print(h);
lcd.println("%");
lcd.setCursor(1、0);
lcd.print (" TEMP =");
lcd.print (t);
lcd.println("*C");
}
我希望有人能帮助我解决这个错误。 谢谢你。