psoc的引脚使用

[复制链接]
13195|7
 楼主| hanwangwang 发表于 2011-5-7 10:51 | 显示全部楼层 |阅读模式
psoc的引脚可以像定义51程序中的sbit一样吗?还有应该怎么使其是数字IO口
rocky_bian 发表于 2011-5-8 09:35 | 显示全部楼层
不可以,
如果pin脚作为数字输出,让其模式变成strong 模式,对其置1 设置0
如果pin脚作为数字输入,可以让其变成 pull up/pull down, open drain low,.....
具体可以参考 TRM 中  关于GPIO 部分的大概在 98页.
 楼主| hanwangwang 发表于 2011-5-10 11:30 | 显示全部楼层
谢谢啦
wuyb0512 发表于 2011-5-16 12:40 | 显示全部楼层
什么是TMR
Go_PSoC 发表于 2011-5-16 16:45 | 显示全部楼层
4# wuyb0512
就是技术参考手册
bishufeng 发表于 2011-5-28 07:31 | 显示全部楼层
论坛里 能下到 技术参考手册?
Go_PSoC 发表于 2011-5-28 23:36 | 显示全部楼层
6# bishufeng
这个帖子下有
PSoC1/3/5 TRM链接 https://bbs.21ic.com/viewthread.php?tid=202817
ershou 发表于 2011-6-22 22:21 | 显示全部楼层
但是在AN2033里有介绍使用bit操作啊
Simple Macro to Flip Bits
A desirable feature would be to flip an I/O port bit with a simple statement like P0.0 = 1. Using C macro programming this is easily accomplished.
Consider the following C code:
#include "m8c.h"
#define Port0_0(b) (PRT0DR = (b==0) ? (PRT0DR&0xFE) : (PRT0DR|0x01))
void main()
{
Port0_0(1); // Set Port 0, bit 0 to 1
}
The C Compiler pre-processor in PSoC Designer replaces this Port0_0(1) call in main() with the macro definition before compiling. The assembly code generated is:
OR REG[0],1
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

16

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部