【发布时间】:2025-12-31 13:40:11
【问题描述】:
我有两台Pro XBee Pro S3B,一台通过USB连接到我的电脑,另一台连接到微控制器AT90CAN64。
这是我使用 XCTU 配置的每个 XBee 的设置:
- A (coordinator)
CE: Indirect Msg Coordinator [1]
ID: 71FF
SH: 13A200
SL: 418CCABF
DH: 13A200
DL: 418CCAB4
- B (router)
CE: Standard Router [0]
ID: 71FF
SH: 13A200
SL: 418CCAB4
DL: 418CCABF
我都处于透明模式。
如果我在我的计算机上同时连接 A 和 B,如果我使用 XCTU 终端,我可以在它们之间交换消息。
我的主要问题是:打开AT90CAN64后,如果我将DIN/DOUT(XBee)连接到TX/RX(AT90CAN64),加载XCTU并尝试交换消息,我没有成功。但是,如果我不连接TX/RX - DIN/DOUT,等待一段时间,然后我连接TX/RX - DIN/DOUT,然后加载XCTU,我可以交换消息。
我查看了文档和论坛,没有任何内容涉及这个问题。有没有人知道可能是什么问题或任何关于如何解决它的线索?
您可以在下面找到在微控制器中运行的代码:
#ifndef __cplusplus
#define __cplusplus
#endif
#ifndef F_CPU
#define F_CPU 16000000
#endif
#include <avr/io.h>
#include <util/delay.h>
#include "usart.h"
void sendTest(void);
void sendTest(){
USART0_Transmit8(0x07);
}
int main(){
DDRG |= (1 << PG0)|(1 << PG1)|(1 << PG2)|(1<<PG3); //Make pins PG[0...3] output.
PORTG |= (1 << PG0)|(1 << PG1)|(1 << PG2)|(1<<PG3); //Turn all LEDs off
PORTG &= ~(1<<PG0); //Turn red LED on
_delay_ms(30000);
PORTG |= (1<<PG0); //Turn red LED off
USART0_Init8(103);
while (1){
//test1echo();
PORTG &= ~(1<<PG0); //Turn red LED on
sendTest();
_delay_ms(1000);
PORTG |= (1<<PG0); //Turn red LED off
}
}
【问题讨论】:
标签: microcontroller xbee