Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(EOD).Mechatronics.pdf
Скачиваний:
82
Добавлен:
23.08.2013
Размер:
5.07 Mб
Скачать

page 530

Computer

RS-232/ethernet/devicenet

 

 

 

 

PLC

Process

 

Sensors

 

 

normal connections

 

Process

 

process

 

 

 

Actuators

 

 

 

 

 

 

 

 

 

 

 

 

 

• There are a few common methods of interfacing,

serial - a single point to point connection allows data communication over a small number of wires (eg. RS-232)

parallel - multiple wires are used for data communication. This is only common for older data bus designs such as printer parallel port and GPIB buses.

network - networks allow multiple connections to pass data. These actually are built upon the basics of serial and parallel communications

31.4 SERIAL COMMUNICATIONS

Serial communication channels send data one bit at a time.

These techniques are often slower, but are essential when transmitting using radio waves, telephone lines, or similar media.

Serial lines have become one of the most common methods for transmitting data to instruments, and most personal computers now have two serial ports.

Serial data can be transmitted two ways,

synchronous - all of the data bits are timed between sender and receiver. asynchronous - the data bits arrive unannounced, without any coordination between

sender and receiver. (this is the most common)

RS-232/RS-232C - the most common standard using voltage levels RS-422a/423a/449 - a current loop standard well suited to noisy conditions RS-485 - allows multiple talkers and listeners on one serial line (this can be the

basis for a network)

page 531

• A typical data byte looks like the one below. The voltage/current on the line is turned on/off. The width of the bits determines the possible bits per second (bps). The value shown before is used to transmit a single byte.

on

off

before

start

data

parity

stop

after

 

 

 

 

 

• The bits shown correspond to,

before - this is a period where no bit is being sent and the line is high start - a single bit to help get the systems synchronized

data - this byte could be 7 or 8 bits, but is almost always 8 now. The value shown here is 01001000 binary.

parity - this lets us check to see if the byte was sent properly. The most common choices here are no parity bit (just drop it out), or even parity, or odd parity. In this case there are two bits set. If we are using even parity the bit would be set. If we are using odd parity the bit would be off

stop - the stop bits allow form a natural pause at the end of the data. after - a period of time where the line is high before the next byte.

• Typical electrical connections look like,

page 532

50 ft

RS-232c

Txd Rxd

Txd

Rxd

com

3000 ft

RS-422a

Txd

Rxd

3000 ft

RS-423a

Txd

Rxd

31.4.1 RS-232

This standard is based on a high being +3 to +15V, and an off being -3 to -15V (+/-12V is commonly used).

The typical connection scheme is shown below. notice that the lines are crossed between connectors. Also note that in some cases the dsr/dtr lines are not used. (Note: these are the lines used when connecting to a modem)

page 533

Computer

 

 

Modem

com

 

 

 

com

 

 

 

txd

 

 

 

txd

 

 

 

rxd

 

 

 

rxd

dsr

 

 

 

dsr

 

 

 

dtr

 

 

 

dtr

 

 

 

 

 

Computer

 

 

 

 

 

Computer

A

com

 

 

 

com

B

 

 

 

 

 

 

txd

 

 

 

txd

 

 

 

 

 

 

 

rxd

 

 

 

rxd

 

 

cts

 

 

 

cts

 

 

 

 

 

 

 

rts

 

 

 

rts

 

 

 

 

 

 

 

 

• The line names are,

TXD/RXD - (transmit data, receive data) these lines pass data one way from sender to receiver.

DSR/DTR - (data set ready, data terminal ready) these handshaking lines indicate when the remote machine is ready to receive data.

COM - a common ground to keep things from blowing up, etc.

• A cable that emulates a modem connection between two devices is shown below and is called a null modem cable.

page 534

Computer

 

 

Computer

A

com

com

B

 

 

 

txd

txd

 

 

rxd

rxd

 

 

rts

rts

 

 

cts

cts

 

 

dsd

dtr

 

 

dcd

 

 

 

 

 

dtr

dsd

 

 

dcd

 

 

 

 

• There are typically two connectors used for these devices. (Note: the connectors have very fine numbers on them)

1

2

3

4

5

6

7

8

9

10 11 12 13

DB-25

 

14

15

16

17

18

19

20

21

22

23

24

25

 

 

1 2 3 4 5

6 7 8 9

DB-9

• The main pin assignments for the DB-25 are, Commonly used pins

1 - GND (chassis ground)

2 - TXD (transmit data)

3 - RXD (receive data)

4 - RTS (request to send)

5 - CTS (clear to send)

6 - DSR (data set ready)

7 - COM (common)

page 535

8 - DCD ()

20 - DTR (data terminal ready) Other pins

9 - Positive Voltage

10 - Negative Voltage

11 - not used

12 - Secondary Received Line Signal Detector

13 - Secondary Clear to Send

14 - Secondary Transmitted Data

15 - Transmission Signal Element Timing (DCE)

16 - Secondary Received Data

17 - Receiver Signal Element Timing (DCE)

18 - not used

19 - Secondary Request to Send

21 - Signal Quality Detector

22 - Ring Indicator (RI)

23 - Data Signal Rate Selector (DTE/DCE)

24 - Transmit Signal Element Timing (DTE)

25 - Busy

The pin assignments for the DB-9 are, 1 - DCD

2 - RXD

3 - TXD

4 - DTR

5 - COM

6 - DSR

7 - RTS

8 - CTS

9 - RI

There are other settings such as half/full duplex.

When communicating between two devices the setting must agree baud rate, stop bits, parity, data bits, full/half duplex, etc.

The figure below shows a PLC connected to a data terminal with a serial line. This is followed by ladder logic to use the serial connection.

page 536

e.g. Connect a dumb terminal to a PLC so that messages can be printed out.

1. Electrical Connections

Wire

PLC

RS232C Card

Terminal

MSG

Control Block N7:10

At this location in memory, we will set up some data

to describe the operation

 

i.e.

Read/Write

Write

 

 

Data Table

N7:50

 

Size

3

setup data stored

Local/Remote

Local

Remote Station

N/A

at N7:10

Link ID

N/A

 

Remote Link type

N/A

 

Local Node Addr.

20

 

Processor Type

ASCII

 

Dest. Addr.

N/A

Data Stored in memory

N7:50

65

 

N7:51

66

 

N7:52

67

--- This will result in ABC being printed on the terminal

Соседние файлы в предмете Электротехника