PIC24FV16KM202 捕捉模块CCP1设置成功能输入捕捉中断

[复制链接]
2652|26
 楼主| jiahy 发表于 2021-10-10 15:06 | 显示全部楼层
我看到的datasheet里没这样说的详细
 楼主| jiahy 发表于 2021-10-10 15:09 | 显示全部楼层
面的说法读LAT也是可以啊。( Writes to the latch, write the latch.)

All port pins have three registers directly associated
with their operation as digital I/O. The Data Direction
register (TRISx) determines whether the pin is an input
or an output. If the Data Direction register bit is a ‘1’,
then the pin is an input. All port pins are defined as
inputs after a Reset. Reads from the Data Latch register
(LATx), read the latch. Writes to the latch, write the
latch. Reads from the port (PORTx), read the port pins;
writes to the port pins, write the latch.
juventus9554 发表于 2021-10-10 15:15 | 显示全部楼层
操作IO口的目的是实现与外部信号的交互,读PORT, 写LATx。
spark周 发表于 2021-10-10 15:17 | 显示全部楼层
只有这样的操作才是真正的读外部引脚,和输出到外部引脚。
如果读LATx,只是读缓存而已。。。
wangpe 发表于 2021-10-10 15:19 | 显示全部楼层
写PORT的话,可能会因为你外部电路设计不好的问题,引起莫名的异常。
zhanghqi 发表于 2021-10-10 15:22 | 显示全部楼层
其实,上面的操作datasheet上都有说的。你一字不漏的把datasheet看5遍,就有收获了。。。
 楼主| jiahy 发表于 2021-10-10 15:24 | 显示全部楼层

明白了,多谢大家讨论这么多哈
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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