...
首页> 外文期刊>CQ Amateur radio >An Introduction to Microcontrollers, Part Ⅱ
【24h】

An Introduction to Microcontrollers, Part Ⅱ

机译:单片机简介,第二部分

获取原文
获取原文并翻译 | 示例

摘要

The previous microcontroller article explained how software can control digital outputs that turn LEDs - and other devices - on or off. The DIRA command set MCU pins as either inputs or outputs, and the OUTA command transferred a logic-1 or a logic-0 to identified output pins. You also learned about objects that perform operations independent of your code, and you used an object in the Timing.spin code to create a 1-second delay (see Table 1). That program also defined a byte (8-bit) variable, LEDCounter, that has 1 added to it each time through the repeat loop. Thus the value of LEDCounter can range from 00000000_2 to 11111111_2, or 0 to 255. You might have wondered what happens when a pass through the loop adds 1 to 255. The LEDCounter value becomes 0. Variables do not include a "carry" or an "overflow" bit, so although we know 255 + 1 = 256 (100000000_2), the 8-bit LEDCounter variable will hold only the eight least-significant bits - those eight on the right side of the value (underlined).
机译:先前的微控制器文章介绍了软件如何控制打开或关闭LED以及其他设备的数字输出。 DIRA命令将MCU引脚设置为输入或输出,而OUTA命令将逻辑1或逻辑0传输到已标识的输出引脚。您还了解了执行与代码无关的操作的对象,并在Timing.spin代码中使用了一个对象来创建1秒的延迟(请参见表1)。该程序还定义了一个字节(8位)变量LEDCounter,每次通过重复循环将其添加1。因此,LEDCounter的值范围可以从00000000_2到11111111_2,或者从0到255。您可能想知道通过循环传递1到255时会发生什么。LEDCounter值变为0。变量不包含“进位”或“溢出”位,因此尽管我们知道255 + 1 = 256(100000000_2),但8位LEDCounter变量将仅保留八个最低有效位-值右侧的那八个(带下划线的)。

著录项

  • 来源
    《CQ Amateur radio 》 |2015年第11期| 26-30| 共5页
  • 作者

    JONATHAN TITUS;

  • 作者单位

    14253 S. Trailview Way Herriman, UT 84096-8029;

  • 收录信息
  • 原文格式 PDF
  • 正文语种 eng
  • 中图分类
  • 关键词

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号