极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10186|回复: 2

Teleduino 代码求助

[复制链接]
发表于 2013-10-15 22:51:07 | 显示全部楼层 |阅读模式
刚好翻到这个东西:
https://www.teleduino.org/

看里面的一段reset 的代码,求高手解释一下

void Teleduino328Class::reset()
{
  delay(100);
  for(byte i = 0; i < TD328_PINS; i++)
  {
    setDigitalOutput(i, LOW);
  }
  void(* teleduino328ArduinoReset) (void) = 0;
  teleduino328ArduinoReset();
}

先定义了一个函数,然后执行一下,就可以让Arduino 重新启动了么?

回复

使用道具 举报

 楼主| 发表于 2013-10-15 22:55:55 | 显示全部楼层
本帖最后由 szpapas 于 2013-10-15 23:10 编辑

又找到一个 reset 的方法

void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers
{
    asm volatile ("  jmp 0");  
}  

It just restarts your program without initializing the state of the ATmega chip like a true reset.  

只是程序重新开始,有点像打开串口窗口,不是真的按reset button。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-10-15 23:01:11 | 显示全部楼层
哈哈,我的推断是正确的。英文好的童鞋可以去看看

http://www.instructables.com/id/ ... sing-just-software/
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-9 06:43 , Processed in 0.041909 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表