View previous topic :: View next topic |
Author |
Message |
Dave Clark Guest
|
Rs485 Wait_for_Bus |
Posted: Tue Jun 19, 2007 12:00 pm |
|
|
Hello all,
I have a ittle trouble with RS485, i would like to block RS485 transfer when i like. I mean not disable the RS485, but do something so that everybody on the RS485 line sees it has busy , so that when i use "wait_for_bus" everybody waits.
utils i decide to free it again.
I tryed to output_high(RS485_ENABLE_PIN) and RS485_TX_PIN
Code: | void rs485_wait_for_bus(int1 clrwdt)
{
int16 i;
RCV_OFF();
for(i=0; i <= (rs485_wait_time*20); ++i)
{
if(!input(RS485_RX_PIN))
i = 0;
else
delay_us(50);
if(clrwdt)
restart_wdt();
}
|
any help ? or idear ? |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: Rs485 Wait_for_Bus |
Posted: Tue Jun 19, 2007 12:40 pm |
|
|
Dave Clark wrote: | any help ? or idear ? |
A 485 Bus is not intended to be driven from more than one device at a time. You need a Protocol to keep this from happening. |
|
|
Guest
|
|
Posted: Wed Jun 20, 2007 2:00 am |
|
|
first thx, for answer.
second, damn ....
is there a way to send a message to ALL id's ? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jun 20, 2007 8:54 am |
|
|
It all depends on the protocol YOU write. RS485 just specifies the voltages on the wires, not the bits that go on them. If each node checks for a Stop bit condition before talking, and one node sets a Start bit condition and holds it, then everyone will eventually stop and stare at the line waiting for a Stop bit. Is this what you are looking for? _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Guest
|
|
Posted: Thu Jun 21, 2007 1:06 am |
|
|
yes this is something like this i was looking for. I forgot to say that i am using the RS485.c provided by CCS. I am going to take a look at modbus.c provided too.
thank you |
|
|
|