View previous topic :: View next topic |
Author |
Message |
ZZX Guest
|
question regarding rs485.c |
Posted: Thu Apr 19, 2007 2:01 am |
|
|
hi,
ive a few questions regarding the RS485.c driver file
1. why doesnt it declare single pin for both enables as we short them on trasnsceiver ( sn75176a) ? why two separate pins ?
2. where does a slave check if he has been addressed or the message is for some other slave??
Please answer
ZZX |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Apr 19, 2007 8:10 am |
|
|
Your right about the shorted enables. DE is active high, RE_bar is active low,.. so you just connect them together and use 1 pin.
That pin is defined in the #use rs232 statment.
As for the address, look at RS485_ID. This is where it is assigned and
where it is checked is in incomming_rs485(); |
|
|
ZZX Guest
|
|
Posted: Fri Apr 20, 2007 1:28 am |
|
|
thank you for the answers
One more thing, with the statement:
#define RS485_USE_EXT_INT TRUE
we cannot use the serial interrupt and need to change the isr to external interrupt trigger. right? |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Apr 20, 2007 7:19 am |
|
|
If you are using the hardware USART just set this to false and use the aysnc interrupt.
Set this to true if your using a software #use rs232 statement and want
to use some sort of interupt. Ith then will use the ext interupt. |
|
|
Guest
|
|
Posted: Fri Apr 20, 2007 9:48 am |
|
|
Thanks again. However id like to tell you my setup since im receiving garbage at the other end.
Im testing this setup using a master and single slave. Master runs ex_rs485.c and slave runs ex_rs232_rs485.c. I am using Hardware USARTS of both MCUs to communicate with PC over hyperterminal windows; as soon as the slave receives something it prints it over the PC port (hypterm). RS485_USE_EXT_INT is TRUE at both ends, since im not using C6, C7 of 16f877a (hard usart) for rs485 trasceivers. ive used sn75176b,whose pin a,b have no impedance coz ive placed the two tcvrs very close.
Now can you suggest whats the apparent cause of garbage at the slave end ?
Looking forward ...
ZZX |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Apr 20, 2007 10:59 am |
|
|
I think I understand.
Code: | master-------485-------slave
| _______________________|
|/
PC |
I would change and use the hardware USART for the 485.
((what ever requires most stability))
BUT.
Since you are using the ext_int is that pin connected to something? |
|
|
Guest
|
|
Posted: Sat Apr 21, 2007 2:10 am |
|
|
the external interrupt pins of both MCUs(B0 of 16f877a) are connected to RCV pins of both 485 trcvrs (pin1 of sn75176a) only. |
|
|
ZZX Guest
|
|
Posted: Sat Apr 21, 2007 9:10 am |
|
|
the above is my msg (w/o name)
if they werent examples i would have pasted my code here too.... |
|
|
|