advertisement
▼
Scroll to page 2
of 44
Contents 1.0 Introduction.............................................. 3 2.0 Installation.............................................. 2.1 System Requirements..................................... 2.2 Installation of CN491A-SOFT............................. 2.3 Communications Setup.................................... 4 4 4 5 3.0 CN491A-SOFT Operation..................................... 7 3.1 Start-up................................................ 7 3.1.1 Initial Set-up of CN491A-SOFT ....................... 7 3.1.2 Com Port and Database Selection ..................... 8 3.1.3 Address Selection ................................... 9 3.2 CN491A-SOFT Graphical Interface........................ 10 3.2.1 Trend Display/ Trend Printing ...................... 11 3.2.2 Bar Display ........................................ 12 3.2.3 PV Display, DevHi/DevLo Alarm and Database Control . 13 3.2.4 Communication Status Display ....................... 14 3.3 Communication and Parameters Table..................... 15 3.3.1 Polling Parameters................................... 15 3.3.2 Modifying Parameters ............................... 16 3.3.4 Saving the Updated Parameters to Database .......... 17 3.4 Modifying All Addresses, Modifying Single Address and DevHi/Lo Settings...................................... 17 3.4.1 Modifying Parameters to All Addresses .............. 18 3.4.2 Modifying Parameters to a Single Address ........... 18 3.4.3 Changing the DevHi/DevLo Settings .................. 19 3.5 Main Menu Operation.................................... 19 3.5.1 Export Data ........................................ 19 3.5.2 Export Parameters .................................. 20 3.5.3 RS485 Communication and Parameters Table ........... 20 3.5.4 ModifyAll .......................................... 20 3.5.5 Minimize ........................................... 21 3.5.6 DevHi/DevLo Setting ................................ 21 3.5.7 Data Backup ........................................ 21 3.5.8 Reset Database ..................................... 21 3.5.9 Exiting ............................................ 22 4.0 Database of CN491A-SOFT.................................. 23 5.0 Protocol................................................. 5.1 ASCII Framing.......................................... 5.1.1 Address Field ...................................... 5.1.2 Command Field ...................................... 5.1.3 Parameter Field .................................... 5.1.4 Data Field ......................................... 5.1.5 Checksum Protocol .................................. 5.2 Command Summary........................................ 5.2.1 Poll a Parameter from the Assigned Address ......... 5.2.2 Modify a Parameter to the Assigned Address ......... 1 24 24 24 24 25 25 25 27 27 27 6.0 Command, Parameter and Data Codes Tables................. 29 6.1 Command Codes Table.................................... 29 6.2 Parameter and Data Codes Table......................... 30 7.0 Programming Examples..................................... 33 8.0 DDE to other Applications............................... 35 8.1 DDE Demo............................................... 36 9.0 Appendix................................................. Appendix A................................................. Appendix B................................................. Appendix C................................................. 39 39 40 41 Notes........................................................ 42 2 1.0 Introduction The Omega Engineering CN491A controllers use serial, halfduplex communication mode with multi-drop link to exchange information. The CN491A-SOFT is a Windows-based software that allows an operator to completely configure and monitor up to 31 CN491A controllers with communications option, via a 2-wire EIA-485 serial communications line. It works on systems running Windows NT, Windows95, or later versions. The controllers will be polled one at a time and are identified by their station numbers. The main display window includes a real-time trend display, a bar graph and a table with the current process values of all the stations. The trend display can be assigned up to six stations at a time. This lets the user observe the behavior of six different processes in six different colors. The bar display lets the user observe the variations of process value, setpoint, and the amount of output from the controller. The display could be set for a specific station or to scan all the stations sequentially. The historical process database and the parameter data can be exported to a file and analyzed by other application programs. 3 2.0 Installation The installation procedure provides the necessary steps required to directly link up to 31 controllers (remote units) to the host computer (master). 2.1 System Requirements a. CN491A controller with RS485 communications (C4 option). Example: CN491A-R1-R2-C4 b. RS-485 to RS-232 converter. Example: Omega Part No. CAT-285 c. Host computer RAM: 16MB Hard Disk: 20MB free space CD-ROM drive SVGA: 800x600 resolution, 256 colors. Operating System: Windows95, WindowsNT, or later. d. Application Software: CN491A-SOFT 2.2 Installation of CN491A-SOFT The host computer should be running Windows 95 or a later version. Insert the CD-ROM provided with the controller. Open folder “Disk 1” and click on “Setup.exe” The “CN491A-SOFT Setup” dialog box will be displayed. Click “change directory” button if necessary. Create a new directory, C:\CN491A-SOFT (for example),if necessary, then click the “OK” button. Click the installation icon to install the CN491A-SOFT application to the specified destination directory. After finishing the CN491A-SOFT setup, you can start the program by clicking on the CN491A-SOFT icon in the program menu. 4 2.3 Communications Setup a. Connect the controller and the computer Remove power from both the controller and the computer before connecting them together. The RS485 communications uses a two-wire, half-duplex system. You can have up to thirty-one controllers (remote units) connected to a host computer (master) via a multi-drop link as shown below. tx1 tx2 tx1 tx2 Controller #1 RS-485 RS485 to RS232 Converter tx1 RS-232 tx2 Controller #2 Computer’s Serial Port Controller #31 Figure 2.1 RS485 interface wiring diagram when an external converter is used 5 b. Set up the remote address from the controller’s front panel 6 3.0 CN491A-SOFT Operation Features of CN491A-SOFT: Up to 31 controllers can be connected simultaneously. A built-in database lets users access and manage both the parameters and historical process data. It works like a data logger. CN491A-SOFT could function like a 6-channel recorder. A trend display lets the user observe the dynamic behaviour of up to six processes (addresses). The image of the trend display can be printed out to a system or network printer. A bar display lets users monitor the Process Value (PV), Set Value (SV), percent of output, or, manipulated variable (MV), data for a specific controller. This bar display can also be set to scan all the stations in a fixed time interval automatically. User programmable DevHi/DevLo alarm and display for monitoring real-time process values. A data grid control handles the data communication of polling/modifying parameters from/to all assigned addresses, and also performs the function of updating parameters automatically. The historical process database (PV) and the parameter data can be exported out to a file and analyzed by other applications. CN491A-SOFT is a built-in DDE (Dynamic Data Exchange) source application. You can develop your own application to take the data through the DDE mechanism. 3.1 Start-up 3.1.1 Initial Set-up of CN491A-SOFT You can run CN491A-SOFT by clicking the item CN491A-SOFT in the Windows program files list, and the Initial Setup window will appear. 7 3.1.2 Com Port and Database Selection Figure 3.1 The Initial Setup window Select COM1, COM2, COM3, or COM4 as the serial Com Port Select Whenever directly software the database file pv_database.mdb. the program is started, the database path is pointed to the directory you have created during installation. Click “OK” Button to finish the set-up of Com Port and Database. The Address Selection window will open. If you have to exit, Click “Exit” to stop execution of the program. Some error messages will be displayed if incorrect port or database path is specified. There are two options for Comm Settings, “9600,N,8,1” or “9600,N,7,2”. The default setting is “9600,N,8,1” “9600,N,8,1”= 9600 Baud, No Parity,8 Data bits,1 Stop bit. 8 3.1.3 Address Selection Figure 3.2 Address Selection window Click on icons “A01….A31” to enable/disable the addresses, and make sure the assigned addresses have the corresponding controllers with the same value for the parameter “Addr”. Make sure that no two controllers are assigned the same address number. Click “OK” to finish all the set-ups. The CN491A-SOFT graphical interface and RS485 Communication and Parameter Table windows will be opened, and the program begins operating. During Initial Setup, it fetches the old selected address stored in the database and displays in the Address Selection window, and once you click the “OK”, it updates the new assigned Com Port, Com Settings and addresses into the database as new default settings. 9 3.2 CN491A-SOFT Graphical Interface Figure 3.3 CN491A-SOFT Graphical Interface Functional Descriptions: (from top to bottom, left to right) Main Menu Trend Display PV Display and Database Control Bar Display RS485 Communication and Parameters Table Communication Status 10 3.2.1 Trend Display/ Trend Printing Figure 3.3.1 Trend Display There are up to 6 trends that can be selected in trend display. You can click on the “Address Displayed” frame members to add or remove trends assigned to the selected addresses. A different color for each trend helps you distinguish them. There is a text-box in the upper-left corner of trend display. You can enter a 6-character title name that will be saved in the database and shows in print-outs. In the “StopRanging” mode, you can click “+”,”-“ button in the “TrendScale” frame by altering the ScaleHi and ScaleLo with 50 Counts/Click or 10 Counts/Click. In the “AutoRanging” mode, the ScaleHi and ScaleLo will be changed to their appropriate value automatically. Check or uncheck the AutoRanging/StopRanging checkbox to select AutoRanging or StopRanging alternately. Click the “+”, “-“ button in the “Intvl” frame to change the trend display interval. The interval unit is secs/tick. Click the Print button to print the trend display by the system printer. Check or uncheck the ColorPrinter/MonoPrinter checkbox if using a color or monochrome printer. The trend display can also be printed out periodically, if the Auto/Manual checkbox is set on Auto mode. 11 3.2.2 Bar Display Figure 3.3.2 Bar Display Window The Bar display uses different colors for the Process Variable (PV), Setpoint Value (SV), Manipulated Variable (MV1 for output1, and MV2 for output2). Manipulated variable is the amount of control output that the controller delivers to the load. There are 2 modes for the Bar display: “AutoScan”, and “StopScan”. Check or uncheck “AutoScan/StopScan” checkbox in the “Address” frame to switch between these two modes. In “AutoScan” mode, the bar display will scan all stations periodically. In “StopScan” mode, the Bar display will scan a particular station. You can select the station to be displayed by clicking the “>|” or “|<” button in “Address” frame. Click the “+”, “-“ button in the “BarScale” frame to change the high and low scale of the bar display. Clicking the “Refresh” button will force the main program to update the active bar display. 12 3.2.3 PV Display, DevHi/DevLo Alarm and Database Control Figure 3.3.3 PV and Database Control Real-time process values (PV) are displayed in the “A01” to “A31” text box of the PV_PARA DataBase frame. Note that the process values are always displayed to one decimal place. Different background color for each cell, from A01 to A31, indicates whether the corresponding process variable is inside the DevHi/DevLo limit or not. Red background color: PV > (DevHi+SV) Black background color : (SV-DevLo) < PV < (DevHi+SV) Green background color: PV < (SV-DevLo). Note: The parameters DevHi/DevLo-Deviation High/Deviation Low are tools used only on the graphical interface on the PC, independent of the parameters dvhi/dvLo used on the controllers. You can change the value of DevHi/DevLo in run time as described in section 3.4.3. Check/uncheck the DevHiAlarmOn/DevHiAlarmOff checkbox to enable/disable the DevHiAlarm. Check/uncheck the DevLoAlarmOn/DevLoAlarmOff checkbox to enable/disable the DevHiAlarm/DevLoAlarm The database name, called pv_database.mdb which is created by the Data Manager of Visual Basic, is an Access database that is directly linked with the data control designed in the PV_PARA Database frame. You can open it in 13 real time by Datman32.exe attached in the path created by set-up, and refresh and view the historical records in the database, but do not edit it directly. See Appendix A. The database update interval, which indicates the time period for updating the database table “PVS1” (historical records of the process value), is 60 seconds for default setting. Click the “+”/”-“ button to change the database update interval. 3.2.4 Communication Status Display Figure 3.3.4 Communication Status Display The “RX” text records the number of response messages the assigned remote controllers send back to the host computer. The “Err” text records the number of incorrect Checksum responses. The “TX” text and “RX” text boxes indicate the Transmit and Receive data exchange. Click “Reset” button to reset all the above statistics. 14 3.3 Communication and Parameters Table Figure 3.4: Communication and Parameters Table The parameter table is designed by the grid control, which serves as a mechanism to display data in a tabular format. However, unlike a spreadsheet, you cannot type data inside the cell directly. Reading/writing data from/to a cell is controlled by the source code. The columns show the addresses “A01” to ”A31”, and the rows show the data for the parameters. The values of the parameters are fetched from the database that was pointed to during start-up. 3.3.1 Polling Parameters Click the relative cell position on the parameters table to select the target address and the parameter, and the corresponding “ADD” and “PARA” in “TX Framing” frame will be changed with the new selection. Click the “poll” button to read parameter from the selected remote controller, the corresponding “CMD:65(POLL)” in the “TX Framing” frame will be displayed to reflect this selection. After you have selected the “ADD”, “POLL”, and “PARA”, click the telephone icon to send the data in TX Framing to the communication port. The received result will be displayed in the “Response” 15 text,and updated in the corresponding cell of the parameters table. 3.3.2 Modifying Parameters Click the relative cell position on the Parameters table to select the target address and parameter, and the corresponding “ADD” and “PARA” in the “TX Framing” frame will be changed with the new selection. Click the “Modify” button to write parameters to the selected controller. The corresponding “CMD:66(Modify)” in the “TX Framing” frame will be displayed to reflect this selection. Enter the desired data in the “DATA” text of the “TX Framing” frame. After you have selected the “ADD”, “MODIFY”, “PARA” and “DATA”, click the telephone icon to send the text frame “ADD, Modify, PARA, DATA” to the communication port. The Receive result will be displayed in the “Response” text, and updated in the corresponding cell of the parameter table. 3.3.3 Updating Parameters Automatically If, for some reason, the parameters of the remote controllers get changed, CN491A-SOFT can detect the change. There is a timer interrupt designed in the program. Once the timer interrupt is enabled, it forces the main program to service the “Polling parameters” subroutine immediately, that will poll the parameter for that interrupt, and then poll all the other parameters. So the parameters table always keeps the newly updated parameters. You may click on any cell in the parameter table to disable the timer interrupt, and click on the telephone to alternately enable it. Please review the steps of Polling/Modifying parameters in section 3.3.1 and 3.3.2. The timer interrupt is disabled at the instant you click a cell in the parameters table, and is enabled at the instant you click the telephone icon. 16 3.3.4 Saving the Updated Parameters to Database Click the “SaveParaS” button to save the updated parameters to the database that was pointed to in the Initial Setup window, in section 3.1.2. This means that you must decide when to do “SavePara” function, otherwise, the database will always keep the old parameters. 3.4 Modifying All Addresses, Modifying Single Address and DevHi/Lo Settings When CN491A-SOFT is launched, it fetches the parameters from the database that was pointed to in the Initial Setup window, and then fills the parameters in the cells of the grid table. Unlike the grid table in section 3.3, the parameters in the grid table are not updated in run-time. It just keeps the initial (default) parameters for later use. You can open a different database file that refers to a different process, during start-up and then do ModifyAll to replace all parameters with the new settings. Figure 3.5: Modify All Parameters 17 3.4.1 Modifying Parameters to All Addresses To change a parameter, click the relative cell in the grid. The ”Data” text will display its value. Enter the desired data in the “Data” text, and the new data will be displayed in the relative cell. Click the “ModifyAll” button to write all the parameters in the grid to the corresponding remote controller. ModifyAll is used only if changing all parameters is needed at the initial state. Please make sure that all parameters are right before you proceed to do Modifyall. After clicking ModifyAll button, a warning frame will be displayed, and you can click “Ok” button to continue, or click “Cancel” button if you decide to exit ModifyAll operation. 3.4.2 Modifying Parameters to a Single Address Click a grid cell which corresponds to an address of the parameter you are going to modify. Click the ModifySingle button (on the bottom-right of Figure 3.5) to write parameters to the selected address. Click Cancel button to exit. 18 3.4.3 Changing the DevHi/DevLo Settings Figure 3.6: Deviation Hi/Lo Settings Click View/ DevHi/DevLo setting on the menu, and the Deviation Setting window will be displayed. To change a DevHi/DevLo cell in the grid, and the Enter the desired data in fill in the corresponding setting, click the corresponding data box will display its value. the box, and the new data will cell. After Changing the DevHi/DevLo setting, you must click the SaveDevSetting button to save the new setting to database. To find out how it works, go to section 3.2.3 3.5 Main Menu Operation 3.5.1 Export Data Click File/Export Data to export data. A file-export dialog box will be displayed. Specify a filename and the path the data file needs to be exported. The exported data file can easily be processed by any text editor or imported to spreadsheets like Microsoft™ Excel. 19 3.5.2 Export Parameters You can use the “Export Parameters” function to export the parameters saved in the database table to any specified file. Click the File/ExportParameters in the “File” menu to export parameters. A dialog box will be displayed asking you whether to export parameters or not. Click “Yes” button, and a “File Save” dialog box will be displayed to let you specify the path of the file that you want the parameters exported to. The exported file is a simple text file, every field of a record will be separated by comma, and every record will be separated by CR and LF. So it can easily be processed by any text editor or exported to spreadsheets like Microsoft™ Excel or Wordpad. See Appendix B. 3.5.3 RS485 Communication and Parameters Table Click the “View/RS485 Communication/Parameters” item, the “RS485 Communication and Parameters Table” window will be displayed. 3.5.4 ModifyAll Click the “View/ModifyAll” item, and the “ModifyAll” window will be displayed. 20 3.5.5 Minimize Click the “Minimize” item to minimize the CN491A-SOFT graphical interface to an icon. 3.5.6 DevHi/DevLo Setting Click the “DevHi/DevLOSetting” item, the Deviation Hi/Lo setting window will be displayed. 3.5.7 Data Backup Click the “Data/Data Backup” to backup the database file, and a dialog box will be displayed to inform you to backup the database file. Click the “Yes” button, and a dialog box will be displayed to let you specify the path of file that you want to backup the database to. The database file will have the format of a Microsoft™ Access data file with the extension name “*.mdb” 3.5.8 Reset Database Click the “Data/Reset Database” item to clear all the historical records in the “PVS1” table of the database file. 21 After clicking the “Data/Reset database” item, a dialog box will be displayed to inform you whether to clear all the historical records in the database file or not. If you click the “Yes” button, all the historical records in table “PVS1” of the database file will be deleted. 3.5.9 Exiting Click the “File/Exit” item to end CN491A-SOFT. A Yes/No box will be display. Click “Yes” button to continue Exit or Click “No” button to cancel Exit. Clicking on the “close” button in the control box on the top-right corner of CN491A-SOFT window will also let you exit the program. 22 4.0 Database of CN491A-SOFT The database that is created by the Data Manager of Visual Basic is called pv-database.mdb. It is designed to store the initial setup process Value (PV), and parameter information essential for operation. Whenever the program starts, it fetches the initial setup variables and parameters from the database pointed by start-up as described in section 3.1. During the program run-time, the real-time PV values are written into the database at the specified interval. To store the updated parameters into database, please follow the steps in section 3.3.4. The database is composed of two tables: PVS, PVS1. PVS stores all the parameters and initial settings for all remote controllers. PVS1 stores the historical data of process values (PV) for all remote controllers. It is a standard Access™ database file, so you can easily open it by any Access compatible tools. But in the program run-time, you have to open it by Dataman32.exe that is attached with Visual Basic tools, because database is directly linked to CN491A-SOFT through Data Control. 23 5.0 Protocol In the half-duplex, multi-drop system, the Data Terminal Equipment (DTE) are connected together by two wires as shown in Figure 2.1. Therefore we must ensure that all transmissions are carried out in a controlled way and that two transmissions do not occur simultaneously. Such architectures are normally used in applications that involve a single master computer communicating with a number of remote computers. In order to control access to the shared transmission messages equitably, a character-oriented data link protocol is used to operate in a poll-modify mode. When the master wishes to receive data from a remote unit it sends the remote unit a poll framing, and then stops and waits until a poll-response framing is received. If the master wants to send data to a remote unit, it sends a Modify command and then stops and waits until a Modify response framing is received. 5.1 ASCII Framing Framing in ASCII transmission mode is accomplished by the use of the unique colon “:” character to indicate beginning of frame and carriage return “CR” and line feed “LF” to delineate end of frame. The line feed character also serves as a synchronizing character which indicates that the transmitting station is ready to receive an immediate reply. See Figure 5.1. BEG. OF ADD CMD PARA FRAME ADDRESS COMMAND PARAMETER : 2-CHAR 2-CHAR 2-CHAR DATA 6-CHAR CHECKSUM CS1+CS2 2-CHAR EOF CR READY TO RECEIVE LF Figure 5.1 ASCII Message Frame Format 5.1.1 Address Field The address field immediately follows the beginning of frame and consists of 2 ASCII characters that indicate the userassigned address of remote device. Each remote unit must be assigned a unique address and only the addressed remote unit will respond to a query that contains its address. When the remote unit sends a response, the address of that unit lets the master know which unit it is communicating with. The addresses for the remote units can be set from 1 to 191. 5.1.2 Command Field The Command Field follows the address field and consists of 24 2 characters (ASCII decimal) that specify the poll or modify query the master wants to send to the assigned address. See Command Codes Table, section 6.1 In response to the poll or modify query from the master, the response message from the assigned address must contain the same command code. Poll command code = 65 Modify command code = 66. 5.1.3 Parameter Field The parameter field also consists of 2 characters. Every parameter on the remote controller must be assigned a corresponding code for data exchange. See Parameter and Data Codes Table, section 6.2. Example: Parameter = RAMP Code = 02 In response to a query from the master, the response message from the assigned address must contain the same parameter code. 5.1.4 Data Field The data field consists of 6 characters. It is a 6-digit decimal number specified in section 6.2, Parameter and Data Codes Table. Example: Data = K thermocouple input Code = 000001 The “+” character is assumed if the data is unsigned, and the “-“ character is always the first digit of the data field. Decimal point character is also assigned a digit. 5.1.5 Checksum Protocol The Checksum is used to increase security on the RS485 link. The protocol enables both the master and the remote units to detect errors in transmission, making the data exchange more reliable. The procedure for adding checksum a. Take the Sum of the ASCII code of the message’s character in the “ADD”,”CMD”,”PARA” and the “DATA” fields. Ignore the carries of Sum. b. Take the 2’s complement of Sum. 2’s Complement Sum=1’s complement Sum + 1 The 2’s complement sum is an 8-bit binary, and can be formatted with 2-Hex. c. Take Checksum1 = the hex of the four MSBs of 2’s 25 complement sum Checksum2= the hex of the four LSBs of 2’s CSum. Example 5.1: If ADD=01, CMD=65, PARA=27 then checksum = ?. Code ADD 0 1 CMD 6 5 PARA 2 7 Sum 1’s C Sum ASCII 0011 0000 0011 0001 0011 0110 0011 0101 0011 0010 0011 0111 0011 0101 1100 1010 + 1 2’CSum 1100 1011 2’Csum = Checksum = CB (Hex) So the ASCII frame = “:” + “016527CB” + “CR” + “LF” Example 5.2: If ADD=01, CMD=66, PARA=26, DATA = -12.5 then checksum = ?. Code ADD 0 1 CMD 6 6 PARA 2 6 DATA 0 1 2 . 5 Sum 1’s CSum ASCII 0011 0000 0011 0001 0011 0110 0011 0110 0011 0010 0011 0110 0010 1101 0011 0000 0011 0001 0011 0010 0010 1110 0011 0101 0101 1000 1010 0111 + 1 2’CSum 1010 1000 2’Csum = Checksum = A8 (Hex) So the ASCII frame = “:” + “016626-12.5A8” + “CR” + “LF” 26 5.2 Command Summary 5.2.1 Poll a Parameter from the Assigned Address START CHAR ADD : X CMD X 6 PARA 5 X X CHECK SUM CR LF X CR LF X Figure 5.2 Poll Framing A “Poll Framing” message sent to the RS485 port allows the master to read a parameter from any controller on the RS485 link. Figure 5.2 shows the “poll framing” message format. The following codes must be entered into its corresponding field. ADD: from 0 to 191, the assigned address CMD: 65 (poll) PARA: See section 6.2, the Parameter & Data Codes Table. Checksum: See Section 5.1.5, Checksum Protocol. START CHAR : ADD X CMD X 6 PARA 5 X X DATA X X X X X X CHECK SUM CR LF X CR LF X Figure 5.3 Poll Response Framing When there is a “Poll” request from the master, only the assigned address can answer with the “poll response framing” to inform the master of the parameter and the data attached with it. The codes of “ADD”, “CMD” and “PARA” in the “poll response framing” must be the same as the codes in the “poll framing.” Figure 5.3 shows the poll response framing. 5.2.2 Modify a parameter to the Assigned Address START CHAR : ADD X X CMD 6 6 PARA X X DATA X X X X X X CHECK SUM CR LF X CR LF X Figure 5.4 Modify Framing A “Modify Framing” message to the RS485 port allows the master to write a parameter to any controller on the RS485 link. Figure 5.4 shows the “modify framing” message, and the 27 following codes must be entered into its corresponding field. ADD: from 0 to 191, the assigned address CMD: 65 (poll) PARA: See section 6.2, the parameter and data codes table for reference. See section 5.1.4 and section 5.1.5 Checksum: See Section 5.1.5, Checksum protocol STA CHAR : ADD X X CMD 6 6 PARA X X DATA X X X X X X CHECK SUM CR LF X CR LF X Figure 5.5 Modify Response Framing In response to the “Modify” request from the master, only the assigned address can answer the “Modify response framing” to inform the master that the “modify command” is followed completely. The codes of the “ADD”, “CMD” and “PARA” in the “Modify response framing” must be same as the codes in the “modify framing”. Figure 5.5 shows the Modify Response framing. 28 6.0 Command, Parameter and Data Codes Tables 6.1 Command Codes Table CMD Poll CODE MEANING ACTION 65 Read the parameters with Only the master can issue the data from the selected “poll” request. It allows the address by the master master to retrieve the parameter with data from the selected remote address. The “poll framing” is defined in Figure 5.2 Only the selected remote address is permitted to answer the “poll response framing”, which is defined in Figure 5.3, to the master. 66 Write the parameters with 1. Only the master can issue the Modify data from the master to the “modify” request, It allows the selected remote address master to write the parameter with data to the selected remote address. 2. The “modify framing” is defined in Figure 5.4. 3. Only the selected remote address is permitted to answer the “modify response framing”, which is defined in Figure 5.5, to the master. 29 6.2 Parameter and Data Codes Table PARAMETERS PARA ASP_1 DATA CODE DESCRIPTION 01 CODE Alarm 1 Set Point Value or Dwell Time (A1_SF = T0_ON or T0_OFF) RAMP 02 Ramp Rate VALUE XXXX.X Low Scale to High Scale Value (for Full Scale Alarm), -110.0 to 111.0°C or -199.9 to 199.9 °F (for Deviation and Deviation Band Alarm),0 to 999.9 minutes (for Dwell Time) **18.0 °F XXXX.X 0 to 55.55 °C/minute or 0 to 99.9 °F/minute XXX.XX 0 to 100 % ** 0.0 OFST SHIF 03 Offset Value for Manual Reset 04 Shift Process Value PB 05 Proportional Band of Output 1 TI TD 06 Integral (Reset) Time of Output 1 07 Derivative ( Reset) Time of Output XXXXXX 0 to 1000 Seconds ** 40 AHY_1 08 1 Hysteresis of Alarm 1 XXXX.X -111.0 to 111.0 °C or -199.9 to 199.9 °F ** 0.0 °F XXXX.X 0 to 200 °C or 0 to 360 °F 0: For ON-OFF Control / **18.0 °F XXXXXX 0 to 3600 Seconds ** 120 XXXX.X 0 to 11.0 °C or 0.1 19.9 °F **0.0 HYST 09 Hysteresis of On/Off Control ADDR 10 Address of the Unit for XXXX.X 0 to 11.0 °C or 0.1 19.9 °F **0.0 LO_SC NONE Communication Low Scale of Range Adjust for your process 1 to 199, Poll (Read) Only PL1 13 Power Limit of Output 1 XXXX.X Minimum Value for the Selected Input (INPUT) to High Scale (HISC) **000.0 °F XXXX.X Low Scale (LOSC) to maximum value for the selected Input (INPUT) **999.9 °F XXXXXX 0 to 100 % **100 PL2 14 Power Limits of Output 2 XXXXXX 0 to 100 % **100 11 HI_SC 12 High Scale of Range Adjust for your process 30 PARAMETERS PARA INPT CODE 15 DATA DESCRIPTION CODE Input Type Selection 000000 00 0001 000002 000003 000004 000005 000006 000007 000008 000009 000010 000011 000012 000013 000014 000015 UNIT 16 Units Selection 000000 000001 000002 VALUE J-tC : J Type T/C ** K-tC : K Type T/C t-tC : T Type T/C E-tC : E Type T/C b-tC : B Type T/C r-tC : R Type T/C S-tC : S Type T/C n-tC : N Type T/C Pt_dn : PT100 DIN Pt_JS : PT100 JIS 4-20 : 4 to 20 mA 0-20 : 0 to 20 mA 0-1V : 0 to 1V 0-5V : 0 to 5V 1-5V : 1 to 5V 0-10V : 0 to 10V C : Degree C ** F : Degree F P.U: Process Unit (Voltage or Current Input) RESO 17 Resolution Selection 000000 no.dP: No Decimal Point 1.dP: 1 Digit Decimal 000002 2.dP: 2 Digit Decimal ( Only for 000001 Linear Voltage or Current Input) CONA 18 Control Action of Output 1 000000 dirt : Direct (Cooling) Action 000001 ** rEvr : Reverse(Heating) Action 31 PARAMETERS PARA A1_MD CODE 19 DATA DESCRIPTION CODE Alarm 1 Mode 000000 000001 000002 000003 000004 000005 A1_SF 20 Alarm 1 Special Function 000000 000001 000002 000003 VALUE ** dv_hi : Deviation High Alarm dv.Lo : Deviation Low Alarm db.hi : Deviation Band High Alarm db.Lo : Deviation Band Low Alarm FS.hi : Full Scale High Alarm FS.Lo : Full Scale Low Alarm ** nonE : No Special Function LtCh : Alarm with Latch Function hoLd : Alarm with Hold Function Lt.ho : Alarm with Latch and Hold Function 000004 to.on : Dwell Timer ON as Timeout 000005 CYC 21 CCYC 22 C_PB 23 Cooling P Band D_B PV SV MV1 MV2 to.oF : Dwell Timer Off as Timeout XXXXXX 0 to 99 Seconds, 0 for Linear Current / Voltage Output **20 XXXXXX 0 to 99 Seconds, 0 for Linear Current / Voltage Output **20 XXXX.X 0.0 to 200.0 °C or 0.1 to 360.0 °F ,**18.0 °F XXXX.X -111.0 to 111.0 °C or -199.9 to 199.9 °F , ** 0.0°F None Poll (Read) Only Proportional Cycle time of Output 1 Cooling Cycle Time 24 Dead Band for PB and CPB 25 The Process Value 26 Set Point Value XXXX.X From Low Scale to High Scale Value None 0 to 100.0%, Poll (Read) Only 27 Amount of Control Output 1 28 Amount of Control Output 2 None 0 to 100.0%, Poll (Read) Only Note: ** Denotes the Default Setting 32 7.0 Programming Examples Example 7.1: The master wants to read the Process Value (PV) from the Remote address (03). What is the “ASCII framing” that has to be sent to the RS485 port by the master? Answer: Refer to the “Poll framing” format shown below. START CHAR ADD : X CMD X 6 PARA 5 X X CHECK SUM CR LF X CR LF X ADD = “03”, the assigned remote address CMD = “65”, Poll command PARA = “25”, code for “PV”. Refer to the Parameter and Data Codes Table in section 6.2. Checksum = “CB”. To get the checksum, follow the steps as described in section 5.1.5. So the “ASCII framing” = “:” + “036525CB” + “CR” + “LF” Note: After sending the “poll framing” to the RS485 port, the master must stop and wait until it receives a “poll response framing” from the assigned remote address “03” on the RS485 port. Example 7.2: The master wants to write the Setpoint Value (SV) to the Remote address(01) with a value 99.5. What is the “ASCII framing” that should be sent to the RS485 port by the master? Answer: Refer to the “Modify framing” format shown below. START CHAR : ADD X X CMD 6 6 PARA X X DATA X X X X X X CHECK SUM CR LF X CR LF X ADD = “01”, the assigned remote address. CMD = “66”, Modify command. PARA = “26”, code for “SV”. Refer to the Parameters and Data Codes Table in section 6.2. Checksum = “96”. To get the checksum, follow the steps as described in section 5.1.5. So the “ASCII framing” = “:” + “0166260099.596” + “CR” + “LF” 33 Note: After sending the “Modify framing” to the RS485 port, the master must stop and wait until it receives a “Modify response framing” from the assigned remote address 01 on the RS485 port. Example 7.3: How can you program the Com Port if using an RS232/485 converter box? Answer: If using an RS232/485 converter box, switching between transmitting and receiving is controlled by the RTS (Request to Send) handshaking signal. When the PC wishes to transmit data to a remote unit, the PC must enable the RTS first. On the contrary, when the PC wishes to receive data from a remote unit, the PC must disable the RTS. So the following steps are needed for programming: 1. Set up the Com Port 2. Enable the Com Port 3. Enable RTS 4. Move the TX Framing to the Com Port 5. Wait until TX Framing has finished transmission 6. Disable the RTS, and wait for the RX response 7. If timed out (about 0.4 second for poll (read) command, and 0.8 second for modify (write) command), then restart 8. Read the RX Response in the Com Port 9. Restart next cycle and go to step 3. Note: If the RTS signal is not controlled in time, for example, your program enables/disables the RTS during TX/RX, but the Com Port does not respond immediately, a framing error will occur and causes transmission failure. 34 8.0 DDE to other Applications The CN491A-SOFT supports DDE communication. Users can write their own application to read/write data from/to CN491A-SOFT. 1.This version now supports reading PV, SV, MV1, MV2, PB, TI, TD and writing SV, PB, TI, TD data for all remote addresses. 2.The DDE protocols are as follows: Application : CN491A-SOFT Topics : frmDDE Items : PV_DATA ( n ) SV_DATA ( n ) MV_DATA ( n ) MV2_DATA ( n ) PB_DATA ( n ) TI_DATA ( n ) TD_DATA ( n ) (n is the remote address) 3.Please create DDE link in run-time. You can reference the following codes. Maybe it is suitable to substitute them during initialization like form load: Text1.LinkMode = vbLinkNone Text1.LinkTopic = ”CN491A-SOFT|frmDDE” Text1.LinkItem = ”PV_DATA(1)” Text1.LinkMode = vbLinkAutomatic Assume Text1 is a text contro1 that you want to link to PV of remote Address 1. 4. You can write back to remote controllers through DDE LinkPoke. The parameters that can be modified are: SV, PB, TI, TD. The DDE protocol is similar to item 2. A sample code is illustrated as follows: Text2.LinkMode = vbLinkNone Text2.LinkTopic = ”CN491A-SOFT|frmDDE” Text2.LinkItem = ”SV_DATA(1)” Text2.LinkMode = vbLinManual Text2.Text = InputBox(“Enter New SV:”) Text2.LinkPoke Text2.LinkMode = vbLinkAutomatic Assume Text2 is linked to SV of Remote node 1. The CN491ASOFT will check the data poked from DDE. If it is different from the parameter in database, communication will be started to set the corresponding parameter to a new value. 5. Copy & Post Link mechanism to create DDE link in design time is not supported. 35 8.1 DDE Demo Design a DDE to read/write data from/to Address01 Design Time: Figure 8.1 the from DDE Demo Design a form like Figure 8.1 Write source code: Option Explicit Private Sub cmdSetSV_Click() Text2.LinkMode = vbLinkNone Text2.LinkTopic = "CN491A-SOFT|frmDDE" Text2.LinkItem = "SV_DATA(1)" Text2.LinkMode = vbLinkManual Text2.Text = InputBox("Enter SV") Text2.LinkPoke Text2.LinkMode = vbLinkAutomatic End Sub Private Sub cmdSetTI_Click() Text6.LinkMode = vbLinkNone Text6.LinkTopic = "CN491A-SOFT|frmDDE" Text6.LinkItem = "TI_DATA(1)" Text6.LinkMode = vbLinkManual Text6.Text = InputBox("Enter TI") Text6.LinkPoke Text6.LinkMode = vbLinkAutomatic End Sub 36 Private Sub cmdSetTD_Click() Text7.LinkMode = vbLinkNone Text7.LinkTopic = "CN491A-SOFT|frmDDE" Text7.LinkItem = "TD_DATA(1)" Text7.LinkMode = vbLinkManual Text7.Text = InputBox("Enter TD") Text7.LinkPoke Text7.LinkMode = vbLinkAutomatic End Sub Private Sub cmdSetPB_Click() Text5.LinkMode = vbLinkNone Text5.LinkTopic = "CN491A-SOFT|frmDDE" Text5.LinkItem = "PB_DATA(1)" Text5.LinkMode = vbLinkManual Text5.Text = InputBox("Enter PB") Text5.LinkPoke Text5.LinkMode = vbLinkAutomatic End Sub Private Sub Form_Load() Text1.LinkMode Text2.LinkMode Text3.LinkMode Text4.LinkMode Text5.LinkMode Text6.LinkMode Text7.LinkMode = = = = = = = Text1.LinkTopic Text2.LinkTopic Text2.LinkTopic Text3.LinkTopic Text4.LinkTopic Text5.LinkTopic Text6.LinkTopic Text7.LinkTopic vbLinkNone vbLinkNone vbLinkNone vbLinkNone vbLinkNone vbLinkNone vbLinkNone Text1.LinkItem Text2.LinkItem Text3.LinkItem Text4.LinkItem Text5.LinkItem Text6.LinkItem Text7.LinkItem = = = = = = = = = = = = = = = "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "CN491A-SOFT|frmDDE" "PV_DATA(1)" "SV_DATA(1)" "MV_DATA(1)" "MV2_DATA(1)" "PB_DATA(1)" "TI_DATA(1)" "TD_DATA(1)" 37 Text1.LinkMode Text2.LinkMode Text3.LinkMode Text4.LinkMode Text5.LinkMode Text6.LinkMode Text7.LinkMode = = = = = = = vbLinkAutomatic vbLinkAutomatic vbLinkAutomatic vbLinkAutomatic vbLinkAutomatic vbLinkAutomatic vbLinkAutomatic End Sub Make an executable file named: DDECLT.exe Run Time: Figure 8.2 The DDECLT linking CN491A-SOFT Execute the file DDECLT.exe, and a form like Figure 8.2 will appear. The DDECLT.exe is now linked to CN491A-SOFT! The corresponding text box shows the linked data. To write SV, PB, TI, TD to Address 01 through DDECLT.exe, click the corresponding Set__ button. An input box will show; enter a set value and click “OK” button to write it to CN491A-SOFT or click “Cancel” button to cancel it. 38 9.0 Appendix Appendix A Open the database file named: PV_Database.mdb by Datman32.exe. execute Datman32.exe in run time open the file PV_Database.mdb, you will see a form like Figure 9.1. Figure 9.1 Opening database in run time Click the “Refresh” button. You may view the new updated data but do not edit it unless it is necessary. 39 Appendix B Open the Parameters file created in section 3.5.2 by an application program such as Microsoft Excel. A spreadsheet as shown in Figure 9.2 will open that can be edited or printed out for reference. Figure 9.2 Parameters file edited by Microsoft Excel 40 Appendix C Figure 9.3 Trend Recording Print-out 41 Notes 42 Notes 43 Notes 44
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project