Micro Community

1.

This is a common question with lots of replies and lots of opinions.
Preferred option. Tie pins to ground or "high" through 5k to 20k resistors.
Option to avoid: Don't let unused pins float as inputs.
My option: Set unused pins as outputs with no connections.
Floating input can play havoc on chip operation. The resistor technique is most conservative. Setting to outputs works fine for non critical applications.

2.

They are various alternatives.
Software set the pin to output (except the MCLR, e.t.c.).
Software set internal pull-up resistor if exists.
Tied an external resistor to Vcc or Vss

3.

You're right. Like all CMOS devices, PIC input pins should not be left floating. 

I don't know that there is any general rule, though. (That's like asking "What's the best car?") 
Everybody seems to have a different opinion of what to do and why their particular way is "the best way". Some of the opinions include:
1) Set the unused pins as outputs and pull them either up or down through various size resistors.
2) Set the unused pins as inputs and pull them either up or down through various size resistors. Either way avoids floating inputs. In either case, I'd suggest not connecting the pins directly to Vdd or Vss.
By using pullup or pulldown resistors, you have future possibility of using the pins as either inputs or outputs without having to cut wires or PCB traces.
This also avoids the risk of a bug being able to flip an input pin to an output and then connect ground and Vdd by trying to drive the wrong state onto the pin.

StackExchange

16
down vote
There are many things that you can do, but the correct one depends on what you are trying to accomplish. I'll go over each of the common things:
Leave the pin unconnected, set as an input, and no pullup/pulldown. This is probably the worst thing you can do. A floating input could cause input noise, even if that input is not being used for anything. This could result in increased EMI and increased power consumption. There is no good reason to do this.
Leave the pin unconnected, set as an input, with internal or external pullups/pulldowns. This option is nice because the pin is available for future use (in case your design is not proven to work). Accidentally shorting the pin will likely not cause problems. This solution does nothing for EMI, however.
Leave the pin unconnected, set as an output, and driven high or low. This is nice because the pin is still available for future use, but accidental shorts could easily kill the thing. This is the worst case scenario for EMI, because each pin forms a tiny stub of an antenna.
Set the pin as a input, connect the pin to GND or VCC. The pin is not easily available for use if you have to rework the design. A good solution solution for EMI. One nice side benefit of this is that you can sometimes more easily route your power/gnd on the PCB since you can use the pads as a "route through"-- especally helpful on 2 layer PCB's with QFN or TQFP packages.
Set the pin as an OUTPUT, connect the pin to GND , drive the pin low as appropriate. Sometimes this is called a "virtual gnd", and improves the grounding of the chip. This solution is the absolute best for EMI, but does not tolerate mistakes of any kind. For example, if you enable the output before setting the output value low and the pin is driven high for a moment then you risk damaging the part. This is almost never done in MCU's, but is more frequently used in FPGAs where additional grounding helps to minimize simultaneous-switching-noise. I would not do this without consulting the chip manufacturer.
Without knowing specific issues that you might be having, solution #2 or #3 are the best balance of pro's and con's. Solutions #4 and #5 are reasonable solutions if EMI is a problem but your design is otherwise close to final (I.E., you are not likely to have a design change that will require more pins).

  另外分享一篇PIC单片机的官方文章

http://www.piclist.com/techref/logic/xtrapins.htm

  • Hardware:using resistors, to either ground ("pulldown") or the positive supply voltage ("pullup"). Anything from about 1K to about 10K will work fine.
  • Software: If they are programmable I/O pins, also leave them tri-stated.

[cpu]cpu unused pin应该怎样从硬件和软件上处理的更多相关文章

  1. ]# dmesg | grep ATAcentos下查看网卡,主板,CPU,显卡,硬盘型号等硬件信息

    centos下查看网卡,主板,CPU,显卡,硬盘型号等硬件信息 osc_4o5tc4xq 2019/10/11 15:03 阅读数 253 centos下查看网卡,主板,CPU,显卡,硬盘型号等硬件信 ...

  2. centos下查看网卡,主板,CPU,显卡,硬盘型号等硬件信息

    centos下查看网卡,主板,CPU,显卡,硬盘型号等硬件信息 rose_willow rose_willow 发布于 2016/06/16 11:32 字数 902 阅读 405 收藏 0 点赞 0 ...

  3. 安装 SQL Server 2012 的硬件和软件要求(官方全面)

    以下各节列出了安装和运行 SQL Server 2012 的最低硬件和软件要求. 有关 SharePoint 集成模式下 Analysis Services 的要求的详细信息,请参阅硬件和软件要求(S ...

  4. 安装 SQL Server 2005 的硬件和软件要求(官方全面)

    SQL Server 2005 安装要求 本主题介绍了安装 SQL Server 205 的硬件和软件要求,以及查看安装文档的说明. 硬件和软件要求(32 位和 64 位) 访问 SQL Server ...

  5. 安装 SQL Server 2008 R2 的硬件和软件要求(转)

    以下各部分列出了安装和运行 SQL Server 2008 R2 的最低硬件和软件要求.有关 SharePoint 集成模式下的 Analysis Services 的要求的详细信息,请参阅硬件和软件 ...

  6. 硬件和软件兼容i2c协议的24Cxx系列EEPROM存储器(转)

    源:硬件和软件兼容i2c协议的24Cxx系列EEPROM存储器 硬件上由于24c01的A0A1A2管脚不允许悬空,故暂时的想法是兼容24c02 ---24c16 使用一个dip8封装的芯片插座,A0 ...

  7. Linux串口设备树硬件、软件流控设置

    /********************************************************************** * Linux串口设备树硬件.软件流控设置 * 说明: ...

  8. 解决Win7启动时出现“windows未能启动。原因可能是最近更改了硬件或软件”的问题

    昨天公司终于大发慈悲,统一更换电脑配置,终于要摆脱“手扶拖拉机”的时代了,赶上“动车时代”了.不过不想换硬盘,因为重新要安装太多东西,环境配置一大堆,所以就硬盘没有换,不过当我开机启动的时候,悲剧发生 ...

  9. Windows未能启动,原因可能是最近更改了硬件或软件,解决此问题的步骤

    电脑开机出现显示这样一段文字"Windows未能启动,原因可能是最近更改了硬件或软件,解决此问题的步骤":出现问题的界面是这样的 步骤如下: 1.直接按"Enter&qu ...

随机推荐

  1. 学习笔记之 curl 命令用法详解

    [前言]     本文翻译和整理自 Linux-2.6.32 中和 curl 相关的 Manual Page 描述文档. 文档目的仅在提醒读者所遗忘的知识点,故在整理时削弱了阅读流畅性,适用于对 cu ...

  2. Shell脚本:向磁盘中批量写入数据

    一.关于本文 工作要做的监控系统需要监控磁盘空间的使用率并报警.在测试这个功能的时候需要模拟两个场景:一是磁盘空间不断增长超过设定的阈值时,需要触发报警机制:二是磁盘空间降落到低于报警阈值的时候,不再 ...

  3. 用SQL语句将远程SQL Server数据库中表数据导入到本地数据库相应的表中

    一.方法一 访问不同电脑上的数据库(远程访问,只好联好网就一样),如果经常访问或数据量较大,建议用链接服务器方法. 1.创建链接服务器 exec sp_addlinkedserver ‘srv_lnk ...

  4. Source Insight中代码块注释

    转载:http://blog.csdn.net/cindylx422/article/details/7560786 修改工程目录下的utils.em文件,将下面代码添加到末尾,然后将此文件添加到工程 ...

  5. 转: 使用Hystrix实现自动降级与依赖隔离

    使用Hystrix实现自动降级与依赖隔离 原创 2017年06月25日 17:28:01 标签: 异步 / 降级 869 这篇文章是记录了自己的一次集成Hystrix的经验,原本写在公司内部wiki里 ...

  6. Python 爬虫 不得不说的 清洗

    今天就聊聊爬虫的清洗,下载网页只是最简单的一个步骤,最让人头疼的是数据的清洗. 为什么要这样说呢,因为爬虫首先是获得数据,清洗是把非结构化的数据转换成结果化的数据,这个时候是最考验人的时候. 如果是国 ...

  7. JS 工具函数 方法(其中js的crc32和php的crc32区别)

    var util = {}; util.indexOf = function (array, item) { for (var i = 0; i < array.length; i++) { i ...

  8. msf web_delivery模块攻击

    目标机:win7                    ip:192.168.31.136 攻击机:kai liunx                      ip:192.168.31.54 一. ...

  9. 【iOS XMPP】使用XMPPFramewok(四):收发消息

    转自:http://www.cnblogs.com/dyingbleed/archive/2013/05/16/3075105.html 收发消息 接收消息 通过实现 - (void)xmppStre ...

  10. vue全面介绍

    Vue.js 是一个JavaScriptMVVM库,是一套构建用户界面的渐进式框架.它是以数据驱动和组件化的思想构建的,采用自底向上增量开发的设计.相比于Angular.js,Vue.js提供了更加简 ...