CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

question regarding rs485.c

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ZZX
Guest







question regarding rs485.c
PostPosted: Thu Apr 19, 2007 2:01 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 19, 2007 8:10 am     Reply with quote

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







PostPosted: Fri Apr 20, 2007 1:28 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Fri Apr 20, 2007 7:19 am     Reply with quote

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








PostPosted: Fri Apr 20, 2007 9:48 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Fri Apr 20, 2007 10:59 am     Reply with quote

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








PostPosted: Sat Apr 21, 2007 2:10 am     Reply with quote

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







PostPosted: Sat Apr 21, 2007 9:10 am     Reply with quote

the above is my msg (w/o name)

if they werent examples i would have pasted my code here too....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group