OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 2299|回复: 3

怎么定义一个数组

[复制链接]

10

主题

33

帖子

0

精华

初级会员

Rank: 2

积分
106
金钱
106
注册时间
2019-3-2
在线时间
30 小时
发表于 2019-3-23 15:30:44 | 显示全部楼层 |阅读模式
1金钱
怎么定义一个符合要求的数组,把HMISends里字符串的内容代替掉。
数组内容与前面差不多。感谢!!!

u8 idfind(u8 *buf,u8 *val,u8 len);
void HMISends(char *buf1);
void HMISendb(u8 buf);

int main(void)
{                    
        delay_init();                     //延时函数初始化
        NVIC_Configuration();          //设置NVIC中断优先级
        uart_init(9600);                   //串口初始化为9600
        HMISendstart();             //为确保串口HMI正常通信
        {
                HMISends("t0.txt=20");
                HMISendb(0xff);
                HMISends("n0.val=11");
                HMISendb(0xff);
                HMISends("n1.val=11");
                HMISendb(0xff);
                HMISends("n2.val=11");
                HMISendb(0xff);
                HMISends(数组);
                HMISendb(0xff);
        }
        while(1);
}


正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

33

主题

1628

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
6679
金钱
6679
注册时间
2015-8-25
在线时间
1036 小时
发表于 2019-3-23 15:41:19 | 显示全部楼层
字符串“t0.txt=20”与数组char arr[]={'t','0','.','t','x','t','=','2','0','\0'}

完全一样的啊
He who fights with monsters should look to it that he himself does not become a monster, when you gaze long into the abyss, the abyss also gazes into you.
过于执着就会陷入其中,迷失自己,困住自己。
回复

使用道具 举报

10

主题

33

帖子

0

精华

初级会员

Rank: 2

积分
106
金钱
106
注册时间
2019-3-2
在线时间
30 小时
 楼主| 发表于 2019-3-24 19:36:23 | 显示全部楼层
szczyb1314 发表于 2019-3-23 15:41
字符串“t0.txt=20”与数组char arr[]={'t','0','.','t','x','t','=','2','0','\0'}

完全一样的啊

会报错
main.c(46): error:  #167: argument of type "char" is incompatible with parameter of type "char *"
main.c(46):错误:167:类型“char”的参数与类型“char*的参数不兼容

我觉得和它一开始的定义有关  void HMISends(char *buf1);
回复

使用道具 举报

33

主题

1628

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
6679
金钱
6679
注册时间
2015-8-25
在线时间
1036 小时
发表于 2019-3-25 10:10:46 | 显示全部楼层
Strawberries 发表于 2019-3-24 19:36
会报错
main.c(46): error:  #167: argument of type "char" is incompatible with parameter of type " ...

你怎么调用的?定义数组,用数组名,是不是你用了数组元素所以才包char型与char指针不符?
He who fights with monsters should look to it that he himself does not become a monster, when you gaze long into the abyss, the abyss also gazes into you.
过于执着就会陷入其中,迷失自己,困住自己。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-24 07:51

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表