|
|
View previous topic :: View next topic |
Author |
Message |
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
RS485 help |
Posted: Tue Jan 16, 2007 8:50 pm |
|
|
hi all;
i can't understand the idea of serial RS485!!
when i use a RS485-RS232 converter,,then can i use
the serial RS232 library usually??!!
if yes,,so do the RS485 driver (RS485.c and other examples that included in the CCS) is an alternative of hardware conversion??or should i use both simultaneously,,and how?
thanx alot |
|
|
Ttelmah Guest
|
|
Posted: Wed Jan 17, 2007 3:39 am |
|
|
First key thing to understand, is that CCS's 'nomenclature', is wrong!...
The internal UART (software or hardware), does _not_ generate 'RS232'. RS232, is a signalling standard, involving relatively high voltage signals (up to +/-15v under load), over which can be sent 'asynchronous serial' data. The internal libraries generate such data (in a limited subset of formats), _which can then be sent ovr RS232, using a RS232 transceiver chip_. Exactly the same data, can also be sent over a number of other hardware interfaces (RS485 etc.), so the '#USE' line, should really be called '#USE_ASYNC', rather tha '#USE_RS232', given the lack of RS232 hardware!...
Now, you don't need to get involved in RS232-RS485 transceivers at all. You only need a logic serial to RS485 converter chip. To use a RS232-485 transceiver, you would need to have a MAX232 or equivalent chip to turn the output of the PIC, into 'RS232', and then have the RS232-RS485 converter on top of this. The latter is more expensive. Both approaches offer the same basic performance.
A MAX485, or one of the equivalents from any one of a dozen manufacturers, will take the logic level async serial from the PIC, and convert it to RS485 signalling.
Both approaches, basically result in the same 'RS485' signals. Then you have the question of how the transmission/reception is handled 'over' this link. Now a single RS485 link, uses a differential 'pair' of wires, and unlike RS232, where there can only be a single 'master' device, talking to a 'slave', with a direct wire connection, RS485, supports having multiple receivers present on the same wire 'pair'. The transmission over the 'pair',is only ever half duplex (data only travels in one direction at a time). With RS232, there is normally a seperate path on a second wire, in the opposite direction at the same time. So with RS485, the data 'format', needs a significant degree of intelligence, either sending data from one 'master' to a lot of slaves, or (more complex), supporting multiple devices, which can each become a 'master'. The CCS example, shows the first situation, with the idea of multiple 'addressable' slave devices, returning data over the same pair of wires, while code has also been published here in the past (look in the code forum), supporting 'multiple master' switching.
One other thing applies. Because the same pair of wires is used to send data and receive data, the bus needs to be 'turned around' between transactions. The various examples show how to do this with a hardware transceiver, diectly connected to the PIC. Some RS232-485 transceiver 'modules', have their own intelligence, and will reverse the bus for you. However you still need to verify that data is not lost because of collisions on the bus (two things trying to talk atonce).
Best Wishes |
|
|
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
|
Posted: Wed Jan 17, 2007 5:42 pm |
|
|
thank you Ttelmah i found your reply valuable |
|
|
|
|
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
|