在线时间227 小时
UID261364
注册时间2020-5-12
NXP金币0
该用户从未签到
金牌会员
 
- 积分
- 1367
- 最后登录
- 2024-12-31
|
为了跑modbus 在设计硬件时把uart2设计成了485,想使用官方的485例程,我的硬件是这样设计的txd,rxd ,再加一个enable-pin,觉得就是下面的485sel
下面是官方的设置那位能解释一下含义吗
485的应用一般会需要地址,存在cpu或flash里面,接受数据时比对,
/* RS485 mode definition. */
#define RS485_NMMEN (0x1<<0)
#define RS485_RXDIS (0x1<<1)
#define RS485_AADEN (0x1<<2)
#define RS485_SEL (0x1<<3)
#define RS485_DCTRL (0x1<<4)
#define RS485_OINV (0x1<<5)
TO test RS485, program one board with RS485_RX to 1(RX), one
board with RS485_RX to 0(TX). reset TX board to send out a string
with a RS485 slave address first, and then check the content of
UARTBuffer in the RX board. */
#define RS485_RX 0 /* 1 is RX, 0 is TX. */
#define DIR_CTRL 0
#define RS485_NMM 1 /* 1 is NMM mode, 0 is AAD mode. */
/*if RS485_ENABLED is set, set RS485 slave address. */
#define RS485_SLAVE_ADR 0xC0
最佳答案
串口模拟485也行啊,用个GPIO口控制收发好了
|
|