打印
[技术问答]

新唐MCU C位变量该如何定义

[复制链接]
1801|13
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
骗子的片子|  楼主 | 2013-12-24 20:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用惯了8051的人,伤不起,碰到这样的问题就掉坑里了
沙发
lyn3210| | 2013-12-26 17:19 | 只看该作者
同标准C,购一大本的教材学习吧!

使用特权

评论回复
板凳
niuyaliang| | 2013-12-26 18:25 | 只看该作者
新的M058S里面,支持P00,P01,P52这样的访问的,库函数里面定义了

使用特权

评论回复
地板
a_ziliu| | 2013-12-27 17:44 | 只看该作者
#define GPIO_PIN_DATA(port, pin)    (*((volatile uint32_t *)((GPIO_PIN_DATA_BASE+(0x20*(port))) + ((pin)<<2))))   
#define P00             GPIO_PIN_DATA(0, 0) /*!< Specify P00 Pin Data Input/Output */
#define P01             GPIO_PIN_DATA(0, 1) /*!< Specify P01 Pin Data Input/Output */
#define P02             GPIO_PIN_DATA(0, 2) /*!< Specify P02 Pin Data Input/Output */
#define P03             GPIO_PIN_DATA(0, 3) /*!< Specify P03 Pin Data Input/Output */
#define P04             GPIO_PIN_DATA(0, 4) /*!< Specify P04 Pin Data Input/Output */
#define P05             GPIO_PIN_DATA(0, 5) /*!< Specify P05 Pin Data Input/Output */
#define P06             GPIO_PIN_DATA(0, 6) /*!< Specify P06 Pin Data Input/Output */
#define P07             GPIO_PIN_DATA(0, 7) /*!< Specify P07 Pin Data Input/Output */
#define P10             GPIO_PIN_DATA(1, 0) /*!< Specify P10 Pin Data Input/Output */
#define P11             GPIO_PIN_DATA(1, 1) /*!< Specify P11 Pin Data Input/Output */
#define P12             GPIO_PIN_DATA(1, 2) /*!< Specify P12 Pin Data Input/Output */
#define P13             GPIO_PIN_DATA(1, 3) /*!< Specify P13 Pin Data Input/Output */
#define P14             GPIO_PIN_DATA(1, 4) /*!< Specify P14 Pin Data Input/Output */
#define P15             GPIO_PIN_DATA(1, 5) /*!< Specify P15 Pin Data Input/Output */
#define P16             GPIO_PIN_DATA(1, 6) /*!< Specify P16 Pin Data Input/Output */
#define P17             GPIO_PIN_DATA(1, 7) /*!< Specify P17 Pin Data Input/Output */
#define P20             GPIO_PIN_DATA(2, 0) /*!< Specify P20 Pin Data Input/Output */
#define P21             GPIO_PIN_DATA(2, 1) /*!< Specify P21 Pin Data Input/Output */
#define P22             GPIO_PIN_DATA(2, 2) /*!< Specify P22 Pin Data Input/Output */
#define P23             GPIO_PIN_DATA(2, 3) /*!< Specify P23 Pin Data Input/Output */
#define P24             GPIO_PIN_DATA(2, 4) /*!< Specify P24 Pin Data Input/Output */
#define P25             GPIO_PIN_DATA(2, 5) /*!< Specify P25 Pin Data Input/Output */
#define P26             GPIO_PIN_DATA(2, 6) /*!< Specify P26 Pin Data Input/Output */
#define P27             GPIO_PIN_DATA(2, 7) /*!< Specify P27 Pin Data Input/Output */
#define P30             GPIO_PIN_DATA(3, 0) /*!< Specify P30 Pin Data Input/Output */
#define P31             GPIO_PIN_DATA(3, 1) /*!< Specify P31 Pin Data Input/Output */
#define P32             GPIO_PIN_DATA(3, 2) /*!< Specify P32 Pin Data Input/Output */
#define P33             GPIO_PIN_DATA(3, 3) /*!< Specify P33 Pin Data Input/Output */
#define P34             GPIO_PIN_DATA(3, 4) /*!< Specify P34 Pin Data Input/Output */
#define P35             GPIO_PIN_DATA(3, 5) /*!< Specify P35 Pin Data Input/Output */
#define P36             GPIO_PIN_DATA(3, 6) /*!< Specify P36 Pin Data Input/Output */
#define P37             GPIO_PIN_DATA(3, 7) /*!< Specify P37 Pin Data Input/Output */
#define P40             GPIO_PIN_DATA(4, 0) /*!< Specify P40 Pin Data Input/Output */
#define P41             GPIO_PIN_DATA(4, 1) /*!< Specify P41 Pin Data Input/Output */
#define P42             GPIO_PIN_DATA(4, 2) /*!< Specify P42 Pin Data Input/Output */
#define P43             GPIO_PIN_DATA(4, 3) /*!< Specify P43 Pin Data Input/Output */
#define P44             GPIO_PIN_DATA(4, 4) /*!< Specify P44 Pin Data Input/Output */
#define P45             GPIO_PIN_DATA(4, 5) /*!< Specify P45 Pin Data Input/Output */
#define P46             GPIO_PIN_DATA(4, 6) /*!< Specify P46 Pin Data Input/Output */
#define P47             GPIO_PIN_DATA(4, 7) /*!< Specify P47 Pin Data Input/Output */

使用特权

评论回复
5
骗子的片子|  楼主 | 2014-1-5 21:49 | 只看该作者
lyn3210 发表于 2013-12-26 17:19
同标准C,购一大本的教材学习吧!

看到坛子里有c p p,等下下载看看

使用特权

评论回复
6
骗子的片子|  楼主 | 2014-1-5 21:49 | 只看该作者
niuyaliang 发表于 2013-12-26 18:25
新的M058S里面,支持P00,P01,P52这样的访问的,库函数里面定义了

还真是,库文件里里面确实定义了

使用特权

评论回复
7
骗子的片子|  楼主 | 2014-1-5 21:49 | 只看该作者
a_ziliu 发表于 2013-12-27 17:44
#define GPIO_PIN_DATA(port, pin)    (*((volatile uint32_t *)((GPIO_PIN_DATA_BASE+(0x20*(port))) + (( ...

谢谢你帮我解决了疑惑

使用特权

评论回复
8
zxf0168| | 2014-2-6 19:51 | 只看该作者
都已经定义好了的

使用特权

评论回复
9
骗子的片子|  楼主 | 2014-3-24 19:15 | 只看该作者
zxf0168 发表于 2014-2-6 19:51
都已经定义好了的

确实都早已经定义好了,头文件里

使用特权

评论回复
10
zxf0168| | 2014-3-25 22:31 | 只看该作者
骗子的片子 发表于 2014-3-24 19:15
确实都早已经定义好了,头文件里

看看头文件就好

使用特权

评论回复
11
骗子的片子|  楼主 | 2014-3-28 11:10 | 只看该作者
zxf0168 发表于 2014-3-25 22:31
看看头文件就好

原来头文件里就有啊:L

使用特权

评论回复
12
zxf0168| | 2014-4-14 21:05 | 只看该作者
骗子的片子 发表于 2014-3-28 11:10
原来头文件里就有啊

恩,你没好好看吧

使用特权

评论回复
13
骗子的片子|  楼主 | 2014-4-26 18:41 | 只看该作者
zxf0168 发表于 2014-4-14 21:05
恩,你没好好看吧

已经看了

使用特权

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

本版积分规则

122

主题

1607

帖子

3

粉丝