Ttelmah
Joined: 11 Mar 2010 Posts: 19215
|
|
Posted: Sat Jan 25, 2020 7:46 am |
|
|
There is a generic issue, that doesn't apply at present, but needs to be thought
about. Problem is how are your 'slave' devices going to know which byte in
the data is the 'address'?. If your data may contain the values you use as
addresses, then things will go wrong.
Two solution suggestions:
1) Only send data as ASCII (so A to Z and numbers), and use the values
below 0x20 as the addresses.
2) Use 9bit serial, and set the 9th bit on the address.
The latter is a very simple and good way of doing this. Slaves simply
read values till they see one with bit 9 set, then test for the address.
RS485.c uses this approach.
Your #use rs232, is being overridden by the one internal to the rs485
driver. So the same port is being setup twice. Your setup doesn't have the
right stream name for the driver, so I've no idea how this will interfere.... |
|