Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document...

16
Multimedia and Control Networking Technology Reply Script for MOST RapidControl V1.0.x Application Note Document Information Version: 1.0.x-1 Date: 2007-02-13 MOST ® Media Oriented Systems Transport Copyright © 2007 SMSC

Transcript of Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document...

Page 1: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Multimedia and Control Networking Technology

Reply Script

for MOST RapidControl V1.0.x

Application Note

Document Information Version: 1.0.x-1

Date: 2007-02-13

MOST®

Media Oriented Systems Transport

Copyright © 2007 SMSC

Page 2: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Legend Copyright © 2007 SMSC. All rights reserved. Please make sure that all information within a document marked as ‘Confidential’ or ‘Restricted Access’ is handled solely in accordance with the agreement pursuant to which it is provided, and is not reproduced or disclosed to others without the prior written consent of SMSC. The confidential ranking of a document can be found in the footer of every page. This document supersedes and replaces all information previously supplied. The technical information in this document loses its validity with the next edition. Although the information is believed to be accurate, no responsibility is assumed for inaccuracies. Specifications and other documents mentioned in this document are subject to change without notice. SMSC reserves the right to make changes to this document and to the products at any time without notice. Neither the provision of this information nor the sale of the described products conveys any licenses under any patent rights or other intellectual property rights of SMSC or others. There are a number of patents and patents pending on the MOST technology and other technologies. No rights under these patents are conveyed without any specific agreement between the users and the patent owners. The products may contain design defects or errors known as anomalies, including but not necessarily limited to any which may be identified in this document, which may cause the product to deviate from published descriptions. Anomalies are described in errata sheets available upon request. SMSC products are not designed, intended, authorized or warranted for use in any life support or other application where product failure could cause or contribute to personal injury or severe property damage. Any and all such uses without prior written approval of an officer of SMSC will be fully at your own risk. MediaLB, SMSC and MOST are registered trademarks of Standard Microsystems Corporation (“SMSC”) or its subsidiaries. Other names mentioned may be trademarks of their respective holders. SMSC disclaims and excludes any and all warranties, including without limitation any and all implied warranties of merchantability, fitness for a particular purpose, title, and against infringement and the like, and any and all warranties arising from any course of dealing or usage of trade. In no event shall SMSC be liable for any direct, incidental, indirect, special, punitive, or consequential damages; or for lost data, profits, savings or revenues of any kind; regardless of the form of action, whether based on contract; tort; negligence of SMSC or others; strict liability; breach of warranty; or otherwise; whether or not any remedy of buyer is held to have failed of its essential purpose, and whether or not SMSC has been advised of the possibility of such damages.

Further Information For more information on SMSC products, including integrated circuits, software, and MOST development tools and modules, contact one of our offices below, or visit our web site: SMSC Europe GmbH Bannwaldallee 48 D-76185 Karlsruhe

GERMANY Phone: +49 721 62537-0 Fax: +49 721 62537-119 Email: [email protected] SMSC 1120 South Capital of Texas Highway Building 2, Suite 100 Austin, Texas 78746

USA Phone: +1 512 306-8450 Fax: +1 512 306-8442 Email: [email protected] SMSC 38600 Van Dyke Avenue, Suite 220 Sterling Heights Michigan 48312-1172

USA Phone: +1 586 795-0545 Fax: +1 586 795-8950 Email: [email protected]

SMSC Japan KK 20th Floor

Osaki New City Building #4 1-6-4 Osaki, Shinagawa-ku Tokyo, 141-0032 JAPAN

Phone: +81 3 5487-0502 Fax: +81 3 5487-0490 Email: [email protected]

SMSC Sweden AB Amerikahuset Barlastgatan 2 S-414 63 Göteborg

SWEDEN Phone: +46 31 70460-30 Fax: +46 31 70460-31 Email: [email protected] Technical Support Europe: [email protected] Japan: [email protected] America: [email protected] http://www.smsc-ais.com

Application Note Copyright © 2007 SMSC Page 2

Page 3: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Reply Script for

MOST RapidControl

Copyright © 2007 SMSC All rights reserved

Copyright © 2007 SMSC Application Note Page 3

Page 4: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Document History Version Date Section Comment on changes V1.0.x-1 2007-02-13 - First version

Application Note Copyright © 2007 SMSC Page 4

Page 5: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Table of Contents

1 INTRODUCTION...............................................................................................................................7 1.1 Implementing the Reply Script .................................................................................................. 8

2 IMPLEMENTING THE SENDER BUTTON ................................................................................... 10 2.1 Implementing a Message Filter for Button1 ............................................................................ 10 2.2 Implementing an OnMessage for Button1 .............................................................................. 11

3 TESTING THE USER INTERFACE............................................................................................... 12 APPENDIX A: LIST OF FIGURES ....................................................................................................... 13

Copyright © 2007 SMSC Application Note Page 5

Page 6: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Conventions Within this manual, the following abbreviations and symbols are used for improving readability: Comment PIN Name of a PIN FileName.xxx Name of a file FunctionName() Name of a function PointerName Name of a pointer BIT Name of a single bit within a register x..y Range from x to y. Used as abbreviation e.g. for a group of bits like D7..0 [a,b,c] List of alternative elements to choose from. 0xzz Hexadecimal number (value zz) bREG Single byte (8bit) Register wREG Single word register (16bit) mREG Multi byte register (e.g. message buffer) RSVD The respective bit or register is reserved for future use / Inverter x Don’t care

Rising edge Falling edge API Function API Callback

Naming Conventions This manual refers to current product names. The table below shows the corresponding previously used product names:

Currently used product names Previously used product names OptoLyzer OptoLyzer 4 MOST OptoLyzer Professional OptoLyzer 4 MOST Professional OptoLyzer Standard Plus OptoLyzer 4 MOST Standard Plus,

OptoLyzer 4 MOST Standard OptoLyzer Production OptoLyzer 4 MOST Production OptoLyzer Interface Box OptoLyzer 4 MOST Interface Box OptoLyzer ActiveX OptoLyzer 4 MOST ActiveX

Application Note Copyright © 2007 SMSC Page 6

Page 7: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13 sion: 1.0.x-1 Date: 2007-02-13

1 Introduction 1 Introduction When implementing a MOST RapidControl User Interface, which reacts on received messages, it is recommended to decouple the Receiver Control from the Sender Control. This avoids infinite loops in the User Interface and makes it also more responsive.

When implementing a MOST RapidControl User Interface, which reacts on received messages, it is recommended to decouple the Receiver Control from the Sender Control. This avoids infinite loops in the User Interface and makes it also more responsive. This application note describes how a message, received by a Receiver Control, will be replied by another message outgoing from the Sender Control. This application note describes how a message, received by a Receiver Control, will be replied by another message outgoing from the Sender Control. In the example below messages are received from Script1 (Receiver Control) and sent back to the node by means of Button1 (Sender Control). In the example below messages are received from Script1 (Receiver Control) and sent back to the node by means of Button1 (Sender Control).

Script1 Button1

0x100

FF 0000 0000 01

Figure 1-1: Message Processing Figure 1-1: Message Processing

Copyright © 2007 SMSC Application Note Page 7

Page 8: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

1.1 Implementing the Reply Script The Reply Script (Script1) listens to the incoming message, like it is shown in Figure 1-1. When it receives the “FunctionCatalog.NetBlock.?.FBlockIDs.Get” message1 from the node 0x100 it sends an internal message to Button1. After that, Button1 sends a Status message back to the node 0x100. Perform the steps below to generate a dedicated script.

1. Start a new User Interface.

• In the Main Menu of MOST RapidControl Designer: click File.

• Select New.

Figure 1-2: Main Menu of MOST RapidControl

2. Place a script control (Script1).

• In the MOST RapidControl Designer: Go to the Control Palette.

• Click the Script button.

• Select Create Default Control.

Figure 1-3: MOST RapidControl Designer – Create Default Control

1 The question mark in the message means: Don’t care for this field.

Application Note Copyright © 2007 SMSC Page 8

Page 9: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

3. Place the cursor on the specific position in the Script Editor (like it is shown in Figure 1-4).

• Edit the script.

Figure 1-4: Script Editor – Place Cursor to Edit the Script

4. Type in the following Pascal script code:

//Compares ANY message with FunctionCatalog.NetBlock.?.FBlockIDs.Get if strCompare(MessageString,'00????????00010?0001*') then begin //If the condition is TRUE send an internal message // FF 00 00 00 00 01 to the button SendMessageString($FF,0,0,'01'); end;

//if Note: Because some external communication layers are (or can become) slower, the response

should not be sent immediately. Instead using SendMessageString(0,-1,$100,'000100000C04AB01CD02')

send the response by using Button1, which is controlled by an internal message: SendMessageString($FF,0,0,'01');

Figure 1-5: Script Editor – Edit the Script

5. Click Apply.

6. Click Close.

Copyright © 2007 SMSC Application Note Page 9

Page 10: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

2 Implementing the Sender Button Add a new button (Button1), which will react on the internal messages sent by Script1 after reception of message FF 0000 0000 01. The reply message (00 XXXX 0100 00 01 00 000 C 04 AB 01 CD 02) of Button1 (Sender Control) will then be transmitted to the node 0x100, see Figure 1-1 for coherences.

2.1 Implementing a Message Filter for Button1 For implementing a Message Filter for Button1 accomplish the following steps:

1. Call the Filter Editor on Button1.

• On MOST RapidControl Designer: Mark Button1.

• Call the context menu.

• Click Edit Filter (2).

Figure 2-1: MOST RapidControl Designer – Edit Filter

2. Make sure that the Message Filter for Button1 looks like as shown below in Figure 2-2.

Figure 2-2: Message Filter for Button1

3. Click OK.

Application Note Copyright © 2007 SMSC Page 10

Page 11: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

2.2 Implementing an OnMessage for Button1 For implementing an OnMessage for Button1 accomplish the following steps:

1. Call the OnMsg Editor for Button1.

• On MOST RapidControl Designer: Mark Button1.

• Call the context menu.

• Click Edit ON Message (1).

Figure 2-3: MOST RapidControl Designer – Edit ON Message

2. Make sure that the OnMsg Editor for Button1 looks like as shown below in Figure 2-4.

Figure 2-4: OnMessage Editor for Button1

3. Click OK.

Copyright © 2007 SMSC Application Note Page 11

Page 12: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

3 Testing the User Interface For starting the User Interface (UI) accomplish the steps listed below:

1. Press “Test UI” item in the application menu.

2. Press the script named “Script1”.

The script starts listening to the incoming events after it was clicked once. After the corresponding message was received by the node, the Script1 presses Button1 automatically. Then the button sends the Status message back to the node.

Application Note Copyright © 2007 SMSC Page 12

Page 13: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Appendix A: List of Figures Figure 1-1: Message Processing............................................................................................................. 7 Figure 1-2: Main Menu of MOST RapidControl....................................................................................... 8 Figure 1-3: MOST RapidControl Designer – Create Default Control ...................................................... 8 Figure 1-4: Script Editor – Place Cursor to Edit the Script ...................................................................... 9 Figure 1-5: Script Editor – Edit the Script ................................................................................................ 9 Figure 2-1: MOST RapidControl Designer – Edit Filter......................................................................... 10 Figure 2-2: Message Filter for Button1.................................................................................................. 10 Figure 2-3: MOST RapidControl Designer – Edit ON Message............................................................ 11 Figure 2-4: OnMessage Editor for Button1............................................................................................ 11

Copyright © 2007 SMSC Application Note Page 13

Page 14: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Notes:

Application Note Copyright © 2007 SMSC Page 14

Page 15: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script

Reply Script

for MOST RapidControl

Document Version: 1.0.x-1 Date: 2007-02-13

Notes:

Copyright © 2007 SMSC Application Note Page 15

Page 16: Reply Script for MOST RapidControlww1.microchip.com/downloads/en/AppNotes/AN_Reply... · Document Version: 1.0.x-1 Date: 2007-02-13 1.1 Implementing the Reply Script The Reply Script