主题中讨论的其他部件:HALCOGEN、 SEGGER
您好!
我正在尝试使用电位器获取模拟值、并将其转换为 PWM。 我想使用 PWM 来改变 LED 的亮度、并读取终端中电位计的电压值。
我尝试获取浮点"value"并将其转换为字符串值"command"。 但我将得到 第95行:警告#169-D:"unsigned char *"类型的参数与"char *__ restrict____"类型的参数不兼容。
您可以在 Code Composer 上检查以下代码吗?
#include "sys_common.h"
/*用户代码开始(1)*/
#include "het.h"
#include "adc.h"
#include "sci.h"
#include "system.h"
#include "stdlib.h"
#include "stdio.h"
#include "string。
unsigned char 命令[8];
void main (void)
{
adcData_t ADC_DATA;//ADC 数据结构。
adcData_t * adc_data_ptr =&adc_data;//adc 数据指针。
unsigned int 值;// ADC 值存储在此变量中。
浮动电位计;//电位计值作为电压。
hetInit();//Initialize the HET module。
adcInit();//初始化 ADC 模块。
sciInit();
while (1)//ADC 转换循环。
{
adcStartConversion (adcREG1、1U);//在 ADC 1上开始转换。
while (!adcIsConversionComplete (adcREG1、1U));//等待 ADC 转换
adcGetData (adcREG1、1U、ADC_DATA_PTR);//将转换存储到 ADC 指针
值=(unsigned int) adc_data_ptr ->值;//
POT =值*(3.3 /4095);
POP=sprintf (命令、"%f"、值);
sciSend (scilinREG、pot、command);
sciSend (scilinREG、2、(unsigned char*)"\r\n");
pwmStart (hetRAM1、pwm0);
如果(POT > 0){
pwmSetDuty(hetRAM1, pwm0, 1U*POT*30.303);
}
其他
pwmSetDuty (hetRAM1、pwm0、0U);
}
}
谢谢、
Ozden

