主题中讨论的其他器件:CC3220SF
工具/软件:Code Composer Studio
您好!
我正在使用 CC3220MODASF Launchpad 并尝试对此板的 ADC 进行编程、如 Getting Started cc3220sf project zero 中所示。 为此、我将0至1.2V 电压连接到引脚57 、但在调试示例之后、终端上未显示 ADC 输出。 我应该怎么做? 此外、还有任何来源可用于学习使用 CCSv8进行编程。
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.
工具/软件:Code Composer Studio
您好!
我正在使用 CC3220MODASF Launchpad 并尝试对此板的 ADC 进行编程、如 Getting Started cc3220sf project zero 中所示。 为此、我将0至1.2V 电压连接到引脚57 、但在调试示例之后、终端上未显示 ADC 输出。 我应该怎么做? 此外、还有任何来源可用于学习使用 CCSv8进行编程。
我按照 Resource Explorer 中给出的说明执行了程序。 但它显示的是垃圾值(1733、1734、1732、...)。 我无法理解是什么问题。
这是代码
/*
* ==== empty.c ======
*
/* for usleep()*/
#include
#include
#include
/*驱动程序头文件*/
#include
#include
#include
//#include
//#include
//#include
//#include
//#include
/*板头文件*/
#include "Board.h"
/* GUI Composer 的全局变量*/
uint16_t adcValue = 0;
uint16_t 阈值= 100;
uint16_t 触发= 0;
/*
* ==== mainThread ====
*
void * mainThread (void * arg0)
{
/*~10个循环/秒*/
uint32_t 时间= 100000; //更新~10/秒
/*调用驱动程序初始化函数*/
GPIO_init();
adc_init();
// I2C_init ();
// SDSPI_init ();
// spi_init();
// uart_init();
// Watchdog_init();
/*打开显示驱动程序*/
Display_Handle displayHandle;
Display_Params displayParams;
Display_Params_init (&displayParams);
DisplayHandle = Display_open (Display_Type_UART、NULL);
/*打开 ADC 驱动程序*/
ADC_Handle ADC;
ADC_Params 参数;
ADC_PARAMS_INIT (params);
ADC = ADC_open (Board_ADC0、params);
if (ADC == NULL){
//初始化 ADC 通道0时出错
while (1);
}
while (1){
int_fast16_t res;
RES = ADC_convert (ADC、&adcValue);
if (res == ADC_STATUS_SUCCESS){
Display_printf (displayHandle、1、0、"ADC 读取%d"、adcValue);
if (adcValue >= threshold){
GPIO_WRITE (Board_GPIO_LED0、Board_GPIO_LED_ON);
触发= 1;
}否则{
GPIO_WRITE (Board_GPIO_LED0、Board_GPIO_LED_OFF);
触发= 0;
}
}
usleep(时间);
}
}