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

Modbus rtu 485

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



Joined: 30 May 2015
Posts: 3

View user's profile Send private message

Modbus rtu 485
PostPosted: Sat May 30, 2015 10:44 am     Reply with quote

Hello, I need help you, i have a problem with a net modbus rtu 485, i can not communicate properly a master in visual basic 6 with 3 slaves in ccs.
Who can help me?.
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Sat May 30, 2015 11:53 am     Reply with quote

Seriously, you are asking for commercial help. As such anyone competent to do it would charge. £1500/day for me, and I'm sure anyone else competent would probably have similar fees.

We will help you if you have a small problem in a part of your code, but if you want an open assistance like this, it's not the sort of thing this group is for.
yohan5034



Joined: 30 May 2015
Posts: 3

View user's profile Send private message

PostPosted: Sat May 30, 2015 12:29 pm     Reply with quote

Ttelmah wrote:
Seriously, you are asking for commercial help. As such anyone competent to do it would charge. £1500/day for me, and I'm sure anyone else competent would probably have similar fees.

We will help you if you have a small problem in a part of your code, but if you want an open assistance like this, it's not the sort of thing this group is for.


Hi Ttelmah, i'm not asking for commercial help, is for a work of the university, i want make a net modbus rtu 485. In this moment works properly only with one slave, but when i enable the others slaves the system crashes.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat May 30, 2015 1:17 pm     Reply with quote

Well now you've told us a bit more of the problem...
so pointers...
1) will every slave work properly with the master, one at a time?

2) will two work or does it take 3 to 'crash' ?

3) what value are the 'bias' resistors on the RS485 network ? Only ONE set of resistors ?

4) speed /distance between slaves and master ?

5)addresses of slaves unique ?

6) can't help with the VB side of the system

7) If your code is using the CCS drivers it's fairly solid,suggesting a hardware problem.

8) would need to see schematics of the 'system' to further diagnose

Jay
yohan5034



Joined: 30 May 2015
Posts: 3

View user's profile Send private message

PostPosted: Sat May 30, 2015 3:41 pm     Reply with quote

temtronic wrote:
Well now you've told us a bit more of the problem...
so pointers...
1) will every slave work properly with the master, one at a time?

2) will two work or does it take 3 to 'crash' ?

3) what value are the 'bias' resistors on the RS485 network ? Only ONE set of resistors ?

4) speed /distance between slaves and master ?

5)addresses of slaves unique ?

6) can't help with the VB side of the system

7) If your code is using the CCS drivers it's fairly solid,suggesting a hardware problem.

8) would need to see schematics of the 'system' to further diagnose

Jay




Hello Temtronic, Thanks for you answer,

only works one slave at a time, with two or three slaves the system didn't work and i am not using the library of ccs, the address is unique, the speed is 9600bps and the distance is 10 meters.
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Sun May 31, 2015 12:43 am     Reply with quote

OK.

The thing was (as you have now seen), the question was much too generic.

Lets ask a couple of basic questions:

Does _one_ slave work if the other two are physically connected, but not running?.

If not, then you have narrowed the problem down to one of signalling.

Guesses:

1) How is the bus terminated?. It wants to be a single pair of wires, terminated at each end of the run. If instead (for example), the layout was a 'spider', then the actual signalling behaviour of the bus would be appalling.
2) How is the RS485 direction control handled at the PC?.

The way RS485 (in the standard configurations involved here), 'works', is that you have a pair of wires with a fairly well known characteristic impedance (typically 100R to 120R), and termination resistors at each end to give a reasonably good impedance 'match' to this, _and to bias the bus to the 'off' state, when it is not driven_. Look at the circuit here:

<www.ti.com/lit/an/slyt324/slyt324.pdf>

The circuit on the last page, shows a 120R bus terminated at each end, and with bias applied. Now, if your bus is not biassed 'off', the behaviour will become very difficult to work out. Devices will think they are seeing signals, and may give error returns, when nothing is being sent on the bus. The 'stubs' (bits sticking out the side of the bus to the transceivers) should be kept short (not terribly critical at the low data rate, but preferably less than about 4").

Getting the impedance matching reasonable, and the topology sensible, reduces bus reflections, which otherwise can lead to spurious edges being seen on the bus....

In your case, the data rate, and bus length are low enough, that layout is probably not the issue, but get the termination right, otherwise devices may be seeing random data....

Then we come to the question of how the direction control is handled at the PC?. This could easily be a major problem. Does the VB application handle this?. You say 'VB'. VB.Net?. What actual interface class are you using?. Historically on 'old' VB, you would be using MSCOMM. With .net, probably NETcomm. If your hardware uses (say) RTS/CTS, to control the bus direction, you need to be sure that this is configured correctly in the VB application.
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Mon Jun 01, 2015 5:08 am     Reply with quote

The basics must be right as the others have said: You need a "linear" bus topology, which starts at one node and goes in turn to each of the other nodes with no "star" or "Y" junctions. Each end must be terminated, typically with a 120R resistor. There must be no other termination resistors. Some transceiver ICs have built-in termination resistors. Make sure they are only enabled at the end nodes of the bus.

There must be one pair of bias resistors on the bus. They can be at any node, but there must only be one. Cross-connecting the bias resistors, pulling up the "-" and pulling down the "+", may work with just two nodes, but causes confusing errors - messing up bus turnround and giving spurious characters - and probably won't work with more than two nodes. Which is the positive going, "+" and which negative is confusing and varies between manufacturers of driver ICs. Be very careful, and triple check to make sure you REALLY know which is which, as its easy to get wrong. A few RS485 ICs have built-in bias resistors. Again make sure you've only got one set enabled.

RS485 driver ICs can be quite easy to damage, for example if you short one or both lines to ground, or even if two nodes try to drive the bus at the same time (e.g. due to software/firmware error). I've blown up several USB-RS485 convertors this way. :-(( The bus may appear to still work, just about, but the voltage levels will be wrong and it probably wont work with more nodes connected. If the voltage levels are wrong - check them with an oscilloscope - then one or more ICs will need to be replaced.

While some RS485 based protocols have collision detection or are full-duplex, MODBUS is not. It is half-duplex, and the CCS C firmware drivers are half-duplex implementations. This mean that the receiver part of the RS485 transceiver must be disabled when transmitting, otherwise the driver will see its own message being transmitted and will get confused. Some tranceiver ICs have separate receiver and transmitter enables (in which case connect them together and to the enable pin on the PIC) or may have just one, with internal connections.

There are a LOT of RS485 tranceiver ICs out there. They are basically similar, but differ in details, such as the way the enables are connected, whether they have ternimating, and/or bias resistors, their level of ESD protection and so on. One size does not fit all. Read the datasheets very carefully.
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