打印
[国产单片机]

松翰单片机指针使用时遇到了问题

[复制链接]
1525|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
faithai|  楼主 | 2013-10-14 18:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 faithai 于 2013-10-14 18:07 编辑

由于初次使用松翰的单片机,还请各位大大们指出问题,感激涕零!
首先我是给所用的4个变量指定地址 代码如下:
#define PLED1_RG (*((__RAM unsigned int*)0x3C))
#define PLED2_RG (*((__RAM unsigned int*)0x3D))
#define PEN_OUT1 (*((__RAM unsigned int*)0x3E))
#define PEN_OUT2 (*((__RAM unsigned int*)0x3F))
编译可以通过,不知道这样编译后是不是就可以说PLED1_RG 这个寄存器的地址就是0x3c呢 ???

下面是我对函数的定义:
void workmode(int unsigned  *out,int unsigned  *led,unsigned long ad_en)
下面是函数的调用:
workmode( 0x3E, 0x3C,EN_ADV1);
workmode( 0x3F, 0x3D,EN_ADV2);
然后下面是编译后的提示:
error : type_error : type error in argument 1 to `workmode'; found `char' expected `pointer to int'
error : type_error : type error in argument 2 to `workmode'; found `char' expected `pointer to int'
error : type_error : type error in argument 1 to `workmode'; found `char' expected `pointer to int'
error : type_error : type error in argument 2 to `workmode'; found `char' expected `pointer to int'
错误都是指向 函数的调用。不知道问题出在什么地方了 求指点!!!

相关帖子

沙发
airwill| | 2013-10-17 12:59 | 只看该作者
void workmode(unsigned  int *out,unsigned  int *led,unsigned long ad_en)

workmode((unsigned  int *)0x3E, (unsigned  int *)0x3C,EN_ADV1);

使用特权

评论回复
板凳
老鱼探戈| | 2013-10-25 10:38 | 只看该作者
松翰的C编译器用指针,这是在谋杀RAM和ROM

使用特权

评论回复
地板
mzh1668| | 2014-6-19 11:36 | 只看该作者
松翰好少用C啊。俺们都 在用汇编啊

使用特权

评论回复
5
dictionary| | 2014-6-19 20:34 | 只看该作者
还是先熟悉 C编程吧 指针都用错了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

4

主题

18

帖子

1

粉丝