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 support@ccsinfo.com

RS485

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







RS485
PostPosted: Sun Jun 01, 2003 1:09 pm     Reply with quote

Dear all,

I am trying to develop a communications solution using the PIC16F872 and an RS485 bus. I am using the Maxim 1487 RS485 chip. One module will transmit and the other will listen without problems. When I want a different module to transmit and the other to listen nothing appears to happen. I think I am controlling RE and DE correclty. Are there any timing issues that I need to be aware of during the swap over from transmiter to receiver? Can anyone point me in the direction of some help. To simplify things I have removed all but two modules and stil nothing works. The link is less that 12 inches long and it is terminated in 100 ohms and both ends. The link is not biased.

Many thanks,

Jason James.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514929
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: RS485
PostPosted: Mon Jun 02, 2003 8:47 am     Reply with quote

:=Dear all,
:=
:=I am trying to develop a communications solution using the PIC16F872 and an RS485 bus. I am using the Maxim 1487 RS485 chip. One module will transmit and the other will listen without problems. When I want a different module to transmit and the other to listen nothing appears to happen. I think I am controlling RE and DE correclty. Are there any timing issues that I need to be aware of during the swap over from transmiter to receiver? Can anyone point me in the direction of some help. To simplify things I have removed all but two modules and stil nothing works. The link is less that 12 inches long and it is terminated in 100 ohms and both ends. The link is not biased.
:=
:=Many thanks,
:=
:=Jason James.

Tie driver enable to recieve enable. When not transmitting a packet set recieve enable low. Do this at every node on the bus. Only terminate on the extreme ends of a multidrop bus.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514952
jamesjl
Guest







Re: RS485
PostPosted: Mon Jun 02, 2003 9:47 am     Reply with quote

:=:=Dear all,
:=:=
:=:=I am trying to develop a communications solution using the PIC16F872 and an RS485 bus. I am using the Maxim 1487 RS485 chip. One module will transmit and the other will listen without problems. When I want a different module to transmit and the other to listen nothing appears to happen. I think I am controlling RE and DE correclty. Are there any timing issues that I need to be aware of during the swap over from transmiter to receiver? Can anyone point me in the direction of some help. To simplify things I have removed all but two modules and stil nothing works. The link is less that 12 inches long and it is terminated in 100 ohms and both ends. The link is not biased.
:=:=
:=:=Many thanks,
:=:=
:=:=Jason James.
:=
:=Tie driver enable to recieve enable. When not transmitting a packet set recieve enable low. Do this at every node on the bus. Only terminate on the extreme ends of a multidrop bus.

Thanks fo the information. However, I have done this already and yet I still do not appear to be able to have any one of the devices take control of the bus when they need to and then release this control when they have finished so that another device and start to transmit.

Regards,

Jason.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514959
R.J.Hamlett
Guest







Re: RS485
PostPosted: Mon Jun 02, 2003 10:18 am     Reply with quote

:=Dear all,
:=
:=I am trying to develop a communications solution using the PIC16F872 and an RS485 bus. I am using the Maxim 1487 RS485 chip. One module will transmit and the other will listen without problems. When I want a different module to transmit and the other to listen nothing appears to happen. I think I am controlling RE and DE correclty. Are there any timing issues that I need to be aware of during the swap over from transmiter to receiver? Can anyone point me in the direction of some help. To simplify things I have removed all but two modules and stil nothing works. The link is less that 12 inches long and it is terminated in 100 ohms and both ends. The link is not biased.
:=
:=Many thanks,
:=
:=Jason James.
I'd start by adding bias to the link.
This way, you can detect if any device is driving. You have to consider a 'retry' ability in your protocol as well.
So the proceedure becomes:
Test if bus is idle.
If not, loop.
If bus is idle, enable the chip, and start sending data.
While sending, verify that the data received matches the transmission. If it doesn't, stop sending (disable the chip), and pause for a random time. Then loop back to the initial bus test.
You should only get here, if the sending device has seen the entire packet go onto the bus without interruption (if another device has tried to use the bus while the transmission was happening, the data received would differ from the transmission, and the transmission would stop, and restart.
When the packet is complete, the opposite end, can acknowledge with a 'receipt'.
The 'keys', are having random times in the retries, and having the bus initially biased. Otherwise it is very difficult to know if any transmission is occuring, and the risk of a 'deadlock' exists if multiple units, try to send at the same time, and keep looping with the same time delay.
I have used a multi unit RS485 bus like this for years, between equipment, in some cases having twenty or thirty units on busses that include things like fibre optic sections as well.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514960
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: RS485
PostPosted: Mon Jun 02, 2003 11:11 am     Reply with quote

:=:=:=Dear all,
:=:=:=
:=:=:=I am trying to develop a communications solution using the PIC16F872 and an RS485 bus. I am using the Maxim 1487 RS485 chip. One module will transmit and the other will listen without problems. When I want a different module to transmit and the other to listen nothing appears to happen. I think I am controlling RE and DE correclty. Are there any timing issues that I need to be aware of during the swap over from transmiter to receiver? Can anyone point me in the direction of some help. To simplify things I have removed all but two modules and stil nothing works. The link is less that 12 inches long and it is terminated in 100 ohms and both ends. The link is not biased.
:=:=:=
:=:=:=Many thanks,
:=:=:=
:=:=:=Jason James.
:=:=
:=:=Tie driver enable to recieve enable. When not transmitting a packet set recieve enable low. Do this at every node on the bus. Only terminate on the extreme ends of a multidrop bus.
:=
:=Thanks fo the information. However, I have done this already and yet I still do not appear to be able to have any one of the devices take control of the bus when they need to and then release this control when they have finished so that another device and start to transmit.
:=
:=Regards,
:=
:=Jason.

I had a problem like this that was caused by turning the transmit enable off too soon. Everything was interupt driven and I was turning the transmit enable off when I had finished loading bytes into the serial transmit buffer. You have to wait one byte time after loading the last byte into the transmit buffer before turning the transmitt enable off on the 485 driver.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514964
Tomi
Guest







Re: RS485
PostPosted: Mon Jun 02, 2003 11:34 am     Reply with quote

Exactly, it works for me in many applications.
As an alternative, you can test the TMRT bit of the TXSTA register to wait for the bit goes high what indicates that the serial shift register is empty. I use this method in my newer applications (because it is baud-rate-independent).

:=You have to wait one byte time after loading the last byte into the transmit buffer before turning the transmitt enable off on the 485 driver.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514965
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Nice
PostPosted: Mon Jun 02, 2003 11:51 am     Reply with quote


___________________________
This message was ported from CCS's old forum
Original Post ID: 144514966
jamesjl
Guest







Re: RS485
PostPosted: Mon Jun 02, 2003 1:18 pm     Reply with quote

:=:=Dear all,
:=:=
:=:=I am trying to develop a communications solution using the PIC16F872 and an RS485 bus. I am using the Maxim 1487 RS485 chip. One module will transmit and the other will listen without problems. When I want a different module to transmit and the other to listen nothing appears to happen. I think I am controlling RE and DE correclty. Are there any timing issues that I need to be aware of during the swap over from transmiter to receiver? Can anyone point me in the direction of some help. To simplify things I have removed all but two modules and stil nothing works. The link is less that 12 inches long and it is terminated in 100 ohms and both ends. The link is not biased.
:=:=
:=:=Many thanks,
:=:=
:=:=Jason James.
:=I'd start by adding bias to the link.
:=This way, you can detect if any device is driving. You have to consider a 'retry' ability in your protocol as well.
:=So the proceedure becomes:
:=Test if bus is idle.
:=If not, loop.
:=If bus is idle, enable the chip, and start sending data.
:=While sending, verify that the data received matches the transmission. If it doesn't, stop sending (disable the chip), and pause for a random time. Then loop back to the initial bus test.
:=You should only get here, if the sending device has seen the entire packet go onto the bus without interruption (if another device has tried to use the bus while the transmission was happening, the data received would differ from the transmission, and the transmission would stop, and restart.
:=When the packet is complete, the opposite end, can acknowledge with a 'receipt'.
:=The 'keys', are having random times in the retries, and having the bus initially biased. Otherwise it is very difficult to know if any transmission is occuring, and the risk of a 'deadlock' exists if multiple units, try to send at the same time, and keep looping with the same time delay.
:=I have used a multi unit RS485 bus like this for years, between equipment, in some cases having twenty or thirty units on busses that include things like fibre optic sections as well.
:=
:=Best Wishes

Thanks for the advice. I hope that biasing the bus works. I'll let you know if I get any success.

Regards,

Jason.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514971
jamesjl
Guest







Re: RS485
PostPosted: Fri Jun 06, 2003 8:44 am     Reply with quote

:=Exactly, it works for me in many applications.
:=As an alternative, you can test the TMRT bit of the TXSTA register to wait for the bit goes high what indicates that the serial shift register is empty. I use this method in my newer applications (because it is baud-rate-independent).
:=
:=:=You have to wait one byte time after loading the last byte into the transmit buffer before turning the transmitt enable off on the 485 driver.

Thanks everyone for all of your help. I slowed so things down and put some delays into the code and everything seems to be working fine for the moment.

Regards,

Jason.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515067
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