PJON(PaddedJitterigOperativeNetwork)是一个简单的连线、多master通讯总线系统。是i2c、1-Wire、串口以及其他Arduio兼容协议的替代方案。
特性单个物理层连接,可支持高达50个节点
实现了设备编码来支持高达254个设备通讯
循环冗余校验(CRC).
确保数据包发送的正确
多master支持中的避免冲突
提供广播功能
包管理机制来跟踪和重新发送失败的数据包发送
错误处理
性能传输速率:32256baud/sor4.32kB/s
带宽:2.7kB/s
精确度:99.95%
兼容性ArduioDiecimila/Duemilaove
ArduioMii
ArduioUo
ArduioNao
ArduioMega
示例代码:
#iclude <PJON.h> // Trasmitter board codePJON etwork(12, 45); // Bus coectio to pi 12, device id 45void setup() { etwork.sed(44, "B", 1, 1000000); // Sed to device 44, "B" cotet of 1 byte legth every 1000000 microsecods (1 secod)}void loop() { etwork.update();}/* ---------------------------------------------------------------------------- */#iclude <PJON.h> // Receiver board codePJON etwork(12, 44); // Bus coectio to pi 12, device id 45void setup() { etwork.set_receiver(receiver_fuctio); // Set the fuctio used to receive messages};static void receiver_fuctio(uit8_t legth, uit8_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() { etwork.receive(1000);}
评论