[bascom] Re: RS485
Hi Eric!
I would suggest a 2nd RS485-cable for a "I want transmit now" alert, so if
this line changed every staion is listening now. So before transmitting
something, the transmitter has to look for this level....
You can also do a Master-reset with this line, if you do some timeouts for
the specific level (64 bytes + overhead + delays for the100m ~ 15 mS, so
if the line stays longer then 16ms on transmitting-level, do a reset,
because something went wrong)
To avoid a situation, where 2 stations try to send at the same time, every
station shouldhave an other timeout to change the alert-RS485 after 64
received bytes (could be generated from the station-adress).
I didn`t do the maths, but I think, you should also pay attention for
cable-delays.
This is only usefull, when you don`t have much traffic, because the station
with the longest timeout could never send when others send very much....
I don`t know how price-sensitiv your HW is and where you want locate the
uploaded programm (RAM, Flash....) you can do a lot with the second line
and some more "discrete" HW using this line as a stobe, clock, reset and so
on.
Uploading doesn`t need to be done with 115K2, so the x51 could stay in
reset, and with some shiftregisters, counters and glue you could fill the
RAM, with becomes a ROM when running the RS485 at full speed.....
Well, of course you can do this also with a single-RS485, so the station,
which want send something must listen, then change the RS485 for some mS
which tell all other stations that they must listen for the next
64bytes.... but it is a little more complex.
I did something similar with the C167-Series, this uC has a great feature
called Bootstrap-mode, which can be entered when D4 is pulled low during
reset.
So I sent to the (adressed!) C167 some magic bytes, the C167 toggeld a FF
and then I did a reset via RS485. Voila, The uC was waiting for the
Bootstrap-uploader, which was then sent via RS485..... It`s great to
reprogram a 15uC-"farm" on stage without a srewdriver :-)))
We used synced ~500kbit for the RS485 for 100m in a dirty environment.
btw: will there be a BASCOM for the C16x-Series??????
I would buy one, imediatly!!!!!!
hth
>
>For my project I will have about 10 modules interconnected by rs485.
>Total cable length less than 100 metres and the baudrate 115K2.
>Each module will have its own address.
>3 modules will have a display and a keypad and must be able to quickly
>retrieve actual data from the 7 modules.
>This could be done on-demand or whenever the data of one of the modules
>changes.
>For the communication I will use the 9-bit format where the 9th bit will
>determine whether the byte represents an address or data.
>The packet length will be 64 bytes at most and the overall traffic on the
>network will be light.
>
>I've been reading Jan Axelson's book "Serial port complete" but I do not
>want to use a master/slave or token-passing protocol and she says that the
>collision detecting protocol is not suitable for rs485 ?!
>
>I'm hereby seeking for general advise, dos and donts.
>A possibility to upload the program over rs485 would be fantastic.
>
>Thanks,
>
>Eric Le Baron
>Wageningen
>The Netherlands
>
>
>
>
Michael Wieser
m.k.w@magnet.at
Service and Audiodesign