微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PJON Arduino 通讯总线方案

程序名称:PJON

授权协议: 未知

操作系统: 嵌入式

开发语言: C/C++

PJON 介绍

@H_502_1@

PJON (Padded Jittering Operative Network) 是一个简单的连线、多 master 通讯总线系统。是 i2c
、1-Wire、串口以及其他 Arduino 兼容协议的替代方案。@H_502_1@

  • 单个物理层连接,可支持高达 50 个节点@H_502_1@

  • 实现了设备编码来支持高达 254 个设备通讯 @H_502_1@

  • 循环冗余校验 (CRC).@H_502_1@

  • 确保数据包发送的正确@H_502_1@

  • 多 master 支持中的避免冲突@H_502_1@

  • 提供广播功能@H_502_1@

  • 包管理机制来跟踪和重新发送失败的数据包发送@H_502_1@

  • 错误处理@H_502_1@

  • 传输速率: 32256 baud/s or 4.32kB/s@H_502_1@

  • 带宽: 2.7kB/s@H_502_1@

  • 精确度: 99.95%@H_502_1@

  • Arduino Diecimila / Duemilanove@H_502_1@

  • Arduino Mini@H_502_1@

  • Arduino Uno@H_502_1@

  • Arduino Nano@H_502_1@

  • Arduino Mega@H_502_1@

示例代码:@H_502_1@

#include <PJON.h>     // Transmitter board code
PJON network(12, 45); // Bus connection to pin 12, device id 45

void setup() {
  network.send(44, "B", 1, 1000000); 
  // Send to device 44, "B" content of 1 byte length every 1000000 microseconds (1 second)
}

void loop() {
  network.update();
}

/* ---------------------------------------------------------------------------- */

#include <PJON.h>     // Receiver board code
PJON network(12, 44); // Bus connection to pin 12, device id 45

void setup() {
  network.set_receiver(receiver_function); // Set the function used to receive messages
};

static void receiver_function(uint8_t length, uint8_t *payload) {
  if(payload[0] == 'B') { // If the first letter of the received message is B 
    digitalWrite(13, HIGH);
    delay(30);
    digitalWrite(13, LOW);
  }
}

void loop() {
  network.receive(1000);
}

PJON 官网

https://github.com/gioblu/PJON

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐