http://plc-kita.blogspot.com/ AS-Interface... Let the Sensors Do the Talking - Part 2 | PLC.com

Sunday, February 21, 2010

AS-Interface... Let the Sensors Do the Talking - Part 2

 

Let's continue with our AS-Interface discussion. You will remember from last time that we discussed the physical hardware features. we pointed out that up to 31 sub devices can be connected to 1 main device. maximum separation between them can be up to 100 meters...
that's a far distance, isn't it?

Regarding speed, it's 'reasonably' quick. Each device added to the network increases the time needed for communication. Each device requires a maximum of 150 us to talk. Plus the network needs 300 us to
do some housekeeping.
So, a network with the maximum 31 devices needs
(31 x 150) + 300 = 4650 + 300 = 4950 us or 4.95 ms

A network of only 15 devices would therefore require:
(15 x 150) + 300 = 2250 + 300 = 2550 us or 2.55 ms

As you can see from the above, less units mean a quicker speed. If we have 15 devices connected we can pretty much guarantee that they will be spoken to every 2.55 milliseconds. Not bad...

Now let's see what actually gets sent during each message transfer and  understand what goes on throughout the network.


Messages sent throughout the network are called telegrams. The main unit sends as many telegrams as there are connected and active sub devices on the network. So, if we have 25 devices connected the main
unit will send 25 telegrams.

Each sub unit will be sequentially polled by the telegrams from the main unit. The sub unit with the lowest address gets polled first and then the next higher, etc. If a sub unit becomes disconnected the main
unit will notice within 1 cycle time (a maximum of 5 ms).

An AS-Interface telegram sends/receives a message in both directions  with the sub units. First the main unit sends a request to the subs (a write command) and then the subs reply (a read command) all within a
single telegram.

So, we have a main call, then a main unit pause, then a sub unit reply and a sub unit pause.

A telegram will actually look like the below if we break it down into digestible pieces:

St Cb A4 A3 A2 A1 A0 I4 I3 I2 I1 I0 Pb Eb

St= Start Bit. This is always a 0. It's a 1 when not transmitting...

Cb= Control bit. This controls if we're working with 'data/parameter access' or 'command access'. It is set to 0 for data/parameter access and 1 for command access.

A4-A0= Address bits. This is the address of the sub unit we are talking with. There are 5 bits here because 11111 in binary is 31.
So we can talk to any of the sub units just by setting it's address here.

I3-I0= Information bits. This is the actual information that we are sending to the sub unit... depending upon the command.
Pb= Parity bit. this is used for error checking. If there are an even
number of 1's in the message this is a 0. if there are an odd number of 1's in the message this is a 1.

Eb= End bit. This terminates the message and is always a 1.

Now, let's put together a telegram where we are talking with only one  sub unit. It will look like the below string of data:

main unit call
St Cb A4 A3 A2 A1 A0 I4 I3 I2 I1 I0 Pb Eb
main unit pause
3 to 10 bit times
sub unit response
St I3 I2 I1 I0 Pb Eb
sub unit pause
1 bit time

Remember that the above communication happens in 1 telegram. If there were 25 sub units connected to the main unit it would still all be sent in only 1 telegram.

Well, hopefully we can see how easy this network is to understand. Not much to it when we break it down into pieces and analyze the results.

Related Post



No comments:

Post a Comment