37
Communication Protocol FB Version 9/03 Table Of Contents Communication Protocol ................................................................................................................. 1 Protocol: Configuration ................................................................................................................ 2 Protocol: Scan.............................................................................................................................. 2 Protocol Messages ................................................................................................................... 6 Protocol: Send ............................................................................................................................. 7 Protocol Messages ................................................................................................................. 12 Protocol: Copy Buffer Contents ................................................................................................. 13 Protocol: Reset Buffer ................................................................................................................ 15 Variables .................................................................................................................................... 16 Variable Types: Send ............................................................................................................. 16 Variable Types: Scan ............................................................................................................. 20 Checksum Configuration............................................................................................................ 24 Communication Protocol Error Messages ................................................................................. 28 COM Port: Init ............................................................................................................................ 29 Example: Mitsubishi Frequency Converter ................................................................................ 30 About the Mitsubishi Protocol ................................................................................................. 31 Protocol message structure.................................................................................................... 32 Index .............................................................................................................................................. 35 i

Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB Version 9/03

Table Of Contents Communication Protocol ................................................................................................................. 1

Protocol: Configuration ................................................................................................................ 2 Protocol: Scan.............................................................................................................................. 2

Protocol Messages................................................................................................................... 6 Protocol: Send ............................................................................................................................. 7

Protocol Messages................................................................................................................. 12 Protocol: Copy Buffer Contents ................................................................................................. 13 Protocol: Reset Buffer................................................................................................................ 15 Variables .................................................................................................................................... 16

Variable Types: Send ............................................................................................................. 16 Variable Types: Scan ............................................................................................................. 20

Checksum Configuration............................................................................................................ 24 Communication Protocol Error Messages ................................................................................. 28 COM Port: Init ............................................................................................................................ 29 Example: Mitsubishi Frequency Converter ................................................................................ 30

About the Mitsubishi Protocol................................................................................................. 31 Protocol message structure.................................................................................................... 32

Index .............................................................................................................................................. 35

i

Page 2: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use
Page 3: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol Via the Communication Protocol operations, you can enable your controller to exchange data with external devices, such as frequency converters, bar-code readers, and printers via a Vision COM port.

Communication Protocol operations are located on the FBs menu.

Note that before you can use Communication Protocol operations, you must configure the COM port to be connected to the external device in accordance with the device's requirements. This is done by placing a COM Port Init FB in your Ladder application.

C o m m u n i c a t i o n P r o t o c o l O p e r a t i o n s

C o n f i g u r a t i o n

S c a n

S e n d

C o p y B u f f e r C o n t e n t s

R e s e t B u f f e r

E x a m p l e s

The application listed below uses this FB. To locate application examples, select Examples from the Help menu.

Mitsubishi.vlp

1

Page 4: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Protocol: Configuration You create messages and attach variable data in Protocol Send and Scan operations. Each operation is linked to a Protocol Configuration. When a Send operation is called in your program, the Configuration determines which COM port is used for outgoing messages; when a Scan operation is activated, the PLC monitors that COM port for incoming messages.

Note that before you place this FB in your Ladder, you must use a COM Port INIT FB to configure a COM port.

Parameter Function

Name Iden t i f i es the conf igu ra t ion . You use the name to l i nk P ro toco l Send and Scan opera t ions to a con f igu ra t ion .

COM Por t

De te rmines wh ich po r t i s used fo r commun ica t i ng the conf igu red pro toco l .

Func t i on i n P rog ress

L ink an MB; th i s MB wi l l be ON when the Con f igu ra t ion i s ac t i ve .

S ta tus

I f e r ro rs occur when the Con f igu ra t ion i sused fo r a Send o r Scan opera t ion , the va lue o f the l i nked MI i nd ica tes wh ich e r ro r has occur red .

Protocol: Scan A Protocol Scan operation contains messages. Activating the Scan causes the PLC to check if it has received any of the messages contained within the Scan. Scan is located on the FBs menu.

Each Protocol Scan operation is linked to a particular Protocol Configuration. The Scan only registers messages that are received via the COM port defined in that Configuration.

2

Page 5: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Parameter Function

Sess ion Comple te • Tu rns ON when the PLC rece ives the message 's STX and te rm ina to r

• Tu rns OFF whenever the Pro toco l Scan opera t ion i s ca l l ed by the p rog ram.

• Tu rns OFF when Rese t Buf fe r opera t ion runs . • In your p rog ram, l i nk the Sess ion Comp le te b i t t o a pos i t i ve

t rans i t i on con tac t , then use th i s cond i t i on to ac t i va te a Copy Bu f fe r FB , as we l l as number o f By tes Rece ived and Number o f Rece ived Message .

Number o f By tes Rece ived

Th is ho lds the number o f by tes cu r ren t l y i n the bu f fe r . I t i s i n i t i a l i zed by the sys tem when a d i f f e ren t message i s rece ived .

Number o f Rece ived Message

Th is ho lds the index number o f the rece ived message. I t changes when ano the r message en te rs the sys tem.

S ta r t o f Tex t (STX)

Check S ta r t O f Tex t to use an STX paramete r to i nd i ca te the beg inn ing o f a message.

• Leng th : En te r the number o f by tes requ i red by the ex te rna l dev ice ' s p ro toco l to mark STX.

• STX: - En te r an ASCI I charac te r : c l i ck a ' by te ' box and t ype i t .

- En te r a con t ro l cha rac te r : doub le -c l i ck a ' by te ' box , then doub le -c l i ck a charac te r .

3

Page 6: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

• End o f Message :

- C l i ck to de f ine checksum p lacement and fo rmat . - Use the op t ions to con f igu re the checksum accord ing to the requ i rements o f your pa r t i cu la r p ro toco l .

Terminators Se lec t one o f the te rmina to r pa ramete rs to i nd i ca te where the message ends .

4

Page 7: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

End o f Tex t (ETX)

The ETX paramete r i nd ica tes where the message ends . • Leng th :

En te r the number o f by tes requ i red by the ex te rna l dev ice ' s p ro toco l to mark ETX.

• ETX: - En te r an ASCI I charac te r : c l i ck a ' by te ' box and t ype i t .

- En te r a con t ro l cha rac te r : doub le -c l i ck a ' by te ' box , then doub le -c l i ck a charac te r .

• End o f Message :

C l i ck he re to de f ine checksum p lacement and fo rmat .

5

Page 8: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Message

Leng th Se lec t ing th i s causes the func t ion to use the length o f a da ta b lock a lone to de te rmine i t s end .

S i l ence : Dura t i on

(mS)

• Th is de f ines the leng th o f a s i l en t pe r iod tha t s igna ls the end o f a message.

• No te tha t the du ra t ion o f a s i l en t ' counte r ' un i t i s approx imate ly 1mS.

Note ♦ Scan Length can be defined for each message via the drop-down box that follows Message index #. Scan length causes the Scan FB to use the length of a message to define whether an incoming message is legal. This parameter overrides Start Of Text and Terminator settings. If you use Scan Length, arrange the messages in ascending order, for example, message #0 may contain 3 bytes, #1 may contain 4 bytes, #2 may contain 6 bytes, etc.

Protocol Messages Messages can include:

Fixed Text This text does not change.

Control Characters These can be added according to protocol requirements.

Variables These variables may be received by the PLC: Numeric, Numeric Stream, and Checksum.

6

Page 9: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Scan operations containing more than one message

Note that if a Scan operation contains more than one message with identical variables that use the same format, the PLC will overwrite the variable values as they are received.

To enable the PLC to differentiate between the messages and their attached variables, include fixed text and/or control characters within the message.

Protocol: Send Each Protocol Send operation is linked to a particular Configuration; outgoing messages are sent via the COM port selected in that Configuration. Send is located on the FBs menu.

7

Page 10: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Sta r t o f Tex t (STX)

Check S ta r t O f Tex t to use an STX paramete r to i nd i ca te the beg inn ing o f a message.

• Leng th : En te r the number o f by tes requ i red by the ex te rna l dev ice ' s p ro toco l to mark STX.

• STX: - En te r an ASCI I charac te r : c l i ck a ' by te ' box and t ype i t .

- En te r a con t ro l cha rac te r : doub le -c l i ck a ' by te ' box , then doub le -c l i ck a charac te r .

8

Page 11: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

• End o f Message : -C l i ck to de f ine checksum p lacement and fo rmat . -Use the op t ions to con f igu re the checksum accord ing to the requ i rements o f your pa r t i cu la r p ro toco l .

9

Page 12: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

End o f Tex t (ETX)

Check End Of Tex t to use an ETX paramete r to i nd ica te the end o f a message. • Leng th :

En te r the number o f by tes requ i red by the ex te rna l dev ice ' s p ro toco l to mark ETX.

• ETX: - En te r an ASCI I charac te r : c l i ck a ' by te ' box and t ype i t .

- En te r a con t ro l cha rac te r : doub le -c l i ck a ' by te ' box , then doub le -c l i ck a charac te r .

• End o f Message :

C l i ck he re to de f ine checksum p lacement and fo rmat .

10

Page 13: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Send Message Number

De te rmines wh ich message in the FB w i l l be sen t . I n the p rog ram, s to re a message index numbers in the l i nked reg i s te r . When the FB i s ca l l ed , message whose index number cu r ren t l y i n the l i nked MI w i l l be sen t .

Advanced Button

11

Page 14: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Protocol Messages

Messages can include:

Fixed Text Fixed text must be included if there is more than one message in a Scan. This enables the PLC to identify the message.

Control Characters These can be added according to protocol requirements.

Variables These variables may be sent by the PLC: Binary, Numeric, Numeric Stream, List of Texts, Checksum, Date, and Time.

Example

The protocol in this example is used to send a data request message to an AC servo.

The protocol requires the beginning of a message to be marked by the ASCII character SOH (01), and the end of a message to be marked by the character ETX (03). This protocol also requires that the checksum be placed after the ETX character.

These parameters, SOH, ETX, and the checksum are defined as shown below. When these messages are sent, these parameters are automatically attached.

The message itself contains commands according to the protocol's format.

12

Page 15: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Protocol: Copy Buffer Contents You can copy the current contents of the buffer which receives incoming messages at any point in your application by including the Copy to Buffer operation, which is located on the FBs menu.

This operation copies whatever information is in the buffer at the time the operation is called.

Copy Format

The format determines which of the received bytes are copied.

1->1 Select this to copy the low byte (first 8 bits) of each received register value currently in the buffer to a vector defined in the PLC.

13

Page 16: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

2->1

Select this to copy both low and high bytes of each received register value currently in the buffer to a vector defined in the PLC. Note that this is an entire 16-bit register, and the first 2 bytes of a 32-bit register.

3->1

Select this to copy all 4 bytes of each 32-bit register currently in the buffer into a defined vector.

14

Page 17: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Protocol: Reset Buffer In order to receive new messages, you must clear the communication buffer by using the Reset Buffer operation, which is located on the FBs menu.

Note that the Session Complete bit turns OFF automatically when the Reset Buffer operation runs.

15

Page 18: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Variables Variables enable you to send and receive a variety of dynamic data from your process.

Variable Types: Send

The PLC sends messages via the Configuration linked to the Send operation. These are the types of variables that can be attached to an outgoing message.

Binary text Use this type of variable to send text based on the status of a linked bit.

Numeric

Use a Numeric variable to send a vector of registers. You can send register values as Binary, Hex as ASCII, or Decimal ASCII. The variable field automatically adjusts to fit the size of the data to be sent.

16

Page 19: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Numeric Stream

Use Numeric Stream to send a vector of registers to a target device.

Format

The format determines which bytes are sent from within a register.

1->1 Select this to send the low byte (first 8 bits) of each register in the vector.

17

Page 20: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

2->1

Select this to send both low and high bytes from each register in the vector. Note that this is an entire 16-bit register, and the first 2 bytes of a 32-bit register.

4->1

Select this to send all 4 bytes of each 32-bit register in a vector.

18

Page 21: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

List of texts This type of variable contains a list of numbered lines of text. The value within the linked operand 'points' to the number of a line within the list. When the operand value is equal to a particular line number, the text of that line is included in the variable.

Selecting the Define Length option enables you to make all of the text lines a uniform length, regardless of the number of characters a specific line may have. If a text line is shorter than the defined length, empty spaces will be added; if the text line is longer than the defined length, excess characters will be cut off.

Checksum

Via this variable, you can calculate a checksum and attach it to a message. Use the options to configure the checksum according to the requirements of your particular protocol.

Date Use this variable to send the current date according to a selected format.

Time Use this variable to send the current time according to a selected format.

19

Page 22: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Variable Types: Scan The PLC scans for messages that enter the system via the Configuration linked to the Scan operation. These are the types of variables that can be attached to an incoming message.

To correctly identify incoming variables, use either Scan Length, or include fixed text.

Note ♦ Scan Length can be defined for each message via the drop-down box that follows Message index #. Scan length causes the Scan FB to use the length of a message to define whether an incoming message is legal. This parameter overrides Start Of Text and Terminator settings. If you use Scan Length, arrange the messages in ascending order, for example, message #0 may contain 3 bytes, #1 may contain 4 bytes, #2 may contain 6 bytes, etc.

Note that if a Scan operation contains more than one message with identical variables that use the same format, the PLC will overwrite the variable values as they are received.

To enable the PLC to differentiate between the messages and their attached variables, include fixed text and/or control characters within the message.

20

Page 23: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Numeric Receive

Use a Numeric variable to receive a vector of registers. You can receive register values as Binary, Hex as ASCII, or Decimal ASCII.

Numeric Receive Stream

Use Numeric Stream to receive a vector of register values from an external device and copy them into a defined vector of registers within the PLC.

Note ♦ A vector is read either until the end of the defined vector length, or until a 'null' character is encountered. By adding a null character to the end of the stream, you can mark the end of a data string. This can prevent other data, that might be present in a vector, from being added to the data string when the vector is read.

21

Page 24: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Format

The format determines which of the received bytes are copied.

1->1 Select this to copy the low byte (first 8 bits) of each received register value to a vector defined in the PLC.

2->1

22

Page 25: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Select this to copy both low and high bytes of each received register value to a vector defined in the PLC. Note that this is an entire 16-bit register, and the first 2 bytes of a 32-bit register.

4->1

Select this to copy all 4 bytes of each 32-bit register into a defined vector.

Checksum

Via this variable, you can process the checksum of an incoming message. Use the options to configure the checksum according to the requirements of your particular protocol.

23

Page 26: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

A S C I I t a b l e

Checksum Configuration Use the options to configure the checksum according to the requirements of your particular protocol. Format Se lec t the da ta rep resenta t ion method : Dec ima l ASCI I , Hex as ASCI I , o r B ina ry .

Ca lcu la te O f f se t

The two Of fse t pa ramete rs de te rmine the de l im i te rs o f the da ta to be ca lcu la ted fo r checksum.

Ca lcu la t i on Type

Th is i s the t ype o f ca l cu la t i on tha t w i l l be pe r fo rmed on the da ta de f ined above. SUM Adds a l l o f t he da ta by tes in the se lec ted ce l l s i n to one sum.

24

Page 27: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

XOR Ca lcu la te checksum us ing exc lus i ve -OR opera t ion .

25

Page 28: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

CRC-16 Ca lcu la tes checksum accord ing to CRC-16 .

Modu lus method

256 (100H) : 8 b i t s Se lec t to s to re the f i rs t 8 b i ts ( l ow da ta by te ) o f t he resu l t i n to the checksum f ie ld . 65536 (10000H) : 16 b i ts Se lec t t o s to re the en t i re resu l t i n to the checksum f ie ld .

Checksum Leng th

Th is de te rmines the leng th o f the f i e ld wh ich w i l l ho ld the ca lcu la ted checksum resu l t . Examp le

If the result is 7563 and the 16-bit modulus method is selected, the results stored in checksum fields of different lengths as follows:

Length: 1 Length: 2 Length: 3

Binary

63 7563 0075, 63

26

Page 29: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

Decimal 33 36, 33 35, 36, 33

Hex as ASCII (7563 =1D8B)

42 38, 42 44, 38, 42

Advanced : Se t L im i ts

F rom Va lue and To Va lue de te rmine a range fo r the checksum resu l t ; i f the f i na l va lue fa l l s w i th in these l im i ts , t he func t ion can au tomat i ca l l y add a se t va lue to the ca l cu la ted checksum.

27

Page 30: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Communication Protocol Error Messages The error message shows whether the problem exists in messages that are sent or received.

Value Error Message Indication

0 No Er ro r Opera t ions success fu l

1 Send : Genera l E r ro r Ind ica tes an unknown sys tem e r ro r .

2 Send : COM Por t busy The COM por t t ha t i s se lec ted in the ac t i ve Pro toco l Con f igu ra t ion canno t cu r ren t l y be accessed .

3 Send : Inva l i d Message Index

The message tha t i s re fe renced in the Send opera t ion does no t ex i s t .

4 Send : Inva l i d Operand Type

The message re fe rences an operand t ype tha t does no t ex i s t i n the sys tem.

5 Send : Inva l i d Operand Address

The message re fe rences an operand address tha t does no t ex i s t i n the sys tem.

6 Send : Da ta Over f l ow The message da ta exceeds 512 by tes .

7 Send : Fo rmat E r ro r The message conta ins va r iab le f i e lds tha t a re no t l ong enough fo r the a t tached var iab le da ta .

257 Rece ive : Genera l E r ro r Ind ica tes an unknown sys tem e r ro r .

258 Rece ive : Inva l i d message

The rece ived message does no t ex i s t i n the sys tem.

259 Rece ive : Checksum Er ro r

The message may have been co r rup ted du r ing t ransmiss ion .

28

Page 31: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

COM Port: Init About Communication Ports

All Vision controllers comprise RS232 serial communication ports. RS232/RS485 adaptors are available by separate order. Certain models, such as the Vision120, support both RS232 and RS485. For details on communications hardware settings, refer to the User Guides and documentation supplied with relevant models.

Separate CANbus ports are also provided with specific controller models.

Note ♦ All ports can be used simultaneously. For example, a single controller may use one serial port to send messages to a modem via RS232, another port to communicate with a frequency converter, while the controller engages in communications via its CANbus port.

COM Init is located on the FB menu. Use this function block:

To initialize communication port settings and enable the controller to communicate with external devices such as modems.

To synchronize port settings, enabling the controller to engage in inter-device communications via protocols such as MODBUS.

Note ♦ COM Init is generally performed once in a program. It is usually a power-up task, however a one-shot transitional contact may also be used.

29

Page 32: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Note ♦ Communications cannot flow through the port during initialization. To avoid conflicts in your program, use the Modem Initialization Status SBs.

Modem status can be checked via the System Bits listed below.

SB Description

80 Modem In i t i a l i zed : COM 1

81 Modem In i t i a l i za t i on Fa i led : COM 1

82 Modem In i t i a l i zed : COM 2

83 Modem In i t i a l i zed Fa i led : COM 2

84 Modem In i t i a l i zed : COM 3

85 Modem In i t i a l i zed Fa i led : COM 3

120 DTR COM 1

122 DTR COM 2

124 DTR COM 3

E x a m p l e s

The applications below use the COM Init function. To locate application examples, select Examples from the Help menu.

SMS messaging.vlp MODBUS Slave.vlp MODBUS Master.vlp

Example: Mitsubishi Frequency Converter The information below is intended to accompany the sample application Mitsubishi.vlp. This application shows how to exchange data between networked Mitsubishi frequency converters and a Vision controller.

Data exchange is performed using the Mitsubishi communication protocol, via VisiLogic's communication Protocol FB. By modifying the FB's parameters, you can exchange data between Vision controllers and external devices using many different protocols.

30

Page 33: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

About the Mitsubishi Protocol The Mitsubishi manual for the converter used in the example may be found by accessing the Mitsubishi site at:

http://www.meau.com/eprise/main/Web_Site_Pages/Public/Documents_Downloads/P-DD-Technical-Manuals,

entering SH(NA)3197-B under Title, and then pressing Search. Note that this manual is in .pdf format and requires you to have Adobe's Acrobat Reader installed on your system.

The manual includes complete protocol requirements. The elements used in the sample application to implement the Mitsubishi protocol are presented below.

Read Commands

Write

Station ID #

31

Page 34: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol FB

Each converter is assigned a station number. Station numbers are transmitted in hexadecimal.

Protocol message structure Send

The FB shown below is located in Net 8 within subroutine: Send command to Mitsubishi. Note how the messages in the Protocol Send FB are configured to conform to the Mitsubishi message structure.

Scan

The FB shown below is located in Net 3 within subroutine: Check answer after sending. Note how the messages in the Protocol Send FB are created to conform to the Mitsubishi message structure.

Error codes

The Mitsubishi protocol uses an error code to determine if data is transmitted correctly. When a converter receives a message, it replies by sending a message to the controller, according to the table below.

32

Page 35: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Communication Protocol

33

Page 36: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use
Page 37: Communication Protocol FB - Elmarksupport.elmark.com.pl/unitronics/PDF/Communication_Protocol_FB.pdfCommunication Protocol FB Message Length Selecting this causes the function to use

Index B buffer..........................................................15 C communication.............................2, 7, 13, 15 configure ......................................2, 7, 13, 15 F FB ................................................2, 7, 13, 15

P protocol ....................................... 2, 7, 13, 15 S scan ............................................................ 2 send ............................................................ 7 send, Advanced .......................................... 7

35