background image

DUEMMEGI

MCP 4 – User's manual

Contatto

4- PROGRAM WRITING

The program writing is the first step of the MCP 4 controller. The equations, SCRIPTs, and all concerning the
operating program, must be written according to the related syntax as described in the previous paragraphs.

To write a program for MCP 4, the software package 

MCP IDE

 (Integrated Design Environment) has to be

used; this package is provided free of charge by 

DUEMMEGI

 together to MCP 4 module. This program must

be installed on a Personal Computer with the following minimum characteristics:

-

operative system WINDOWS

 XP, 7 or 8

-

processor with 1000MHz clock minimum

-

512M RAM memory

-

HD with 50MB free space

-

Video with graphic resolution 1024x768 pixel minimum

-

mouse

MCP IDE, in addition to the program writing support, allows all operation related to the setting up an to the
maintenance. 

For more details on the using of this program, refer to the related documentation.

Essentially, MCP IDE software tool includes:

a te4 editor to write the program, the SCRIPT, the configuration, MACRO, etc.

a compiler to allow the translation of an ASCII file, containing the operating information, in a binary file
adequate to be transferred in the non volatile memory (FLASH type) of MCP 4 module

an section to transfer the program from the PC to MCP 4 (or vice-versa)

MCP   VISIO,   that   is   a   graphical  utility  to   display  the   status   of   the   plant   (input   and  output   modules,
counters, virtual points, registers, etc.)

a simulator to verify the written program, or a part of it, before to transfer it into MCP 4 memory

The file containing the program is in ASCII format and must have the 

.EQU

 (or 

.EXT

) extension; for instance:

filename

.EQU

where 

filename

 is the name of the program file and may be any name allowed by the WINDOWS

 syntax.

The  

.EQU

  extension   is   mandatory  because   the   following   steps   of   MCP   4   programming   (compiling   and

transferring) require that the source file have that extension.

MCP 4 controller programming takes place in a 3 sequential steps, through the MCP IDE support:

building (or editing) of the 

filename

.EQU file, containing the operating program in readable format (ASCII)

compiling of  

filename

.EQU, that is the conversion of the ASCII file in the related  

filename

.BIN written in a

format ready to be transferred into MCP 4 memory

uploading of 

filename

.BIN into MCP 4 memory

If some syntax errors are detected during the step 2, these ones will be reported by the compiler, together to
some information about the error type and the line number where the error occurs.

4.1- Rule for program writing

The program must be written according to the syntax described in its relevant paragraph (logic, counter,
timer, etc. ...). To write and compile a program, it is not necessary to connect MCP 4 controller to PC.

DUEMMEGI

 s.r.l. - Via Longhena, 4 – 20139 MILANO

Tel. 02/57300377 - Fax 02/55213686 – 

www.duemmegi.it

Rel.: 1.2 October 2018

Page 45 of 87

Summary of Contents for Contatto MCP 4

Page 1: ...DUEMMEGI Contatto Contatto Contatto MCP 4 MCP 4 Programmable Control Module User s Manual Release 1 2 October 2018 Via Longhena 4 20139 MILANO Tel 02 57300377 FAX 02 55213686 www duemmegi it...

Page 2: ...rk 15 2 1 13 Scheduler 16 2 2 Event triggered Equations 17 2 2 1 Logic equations 17 2 2 2 SET RESET equations 17 2 2 3 TOGGLE equations 18 2 2 4 COUNTER Equations 18 2 2 5 THRESHOLD Equations 20 2 2 6...

Page 3: ...software package 60 10 2 MCP IDE 60 10 2 1 MCP IDE 64 10 2 2 Program transferring 64 10 3 MCP VISIO 65 10 3 1 The Groups of MCP VISIO 66 10 3 2 The Projects of MCP VISIO 69 10 3 3 The Simulator of MCP...

Page 4: ...ns Standards and regulations The design and the setting up of electrical systems must be performed according to the relevant standards guidelines specifications and regulations of the relevant country...

Page 5: ...d continues to operate without interruption only when downloading of the new program is completed and if everything goes well the automatic switch from the old program to the new one will be performed...

Page 6: ...itialization of Ethernet interface V2018 activated when a communication loss on COM4 RS485 occurs for more than 5 seconds V2017 activated when one or more MODBUS slaves do not answer to MCP 4 set in M...

Page 7: ...2 point 2 of channel 1 of output module 3 AO15 1 channel 1 of output module 15 AI20 2 channel 2 of input module 20 R12 register R12 R14 5 bit 5 of register R14 for script only V100 virtual point 100...

Page 8: ...V1 V16 1 V17 V32 R12 means that R12 maintains the value before the power down RAM has a battery for back up AO16 AO17 247 means that outputs AO16 channel 1 channel 2 channel 3 channel 4 and AO17 chann...

Page 9: ...s a SLAVE device in a MODBUS network Alternatively the MODBUS MASTER mode can be activated for MCP 4 exclusively on COM4 using the following directive MODBUS a T Vm Wx n Ry where a is the address in t...

Page 10: ...le Registers The words read written are those mapped from WORD 0000 to 9998 in the slave If the specified WORD number is in the range 50001 to 65535 MCP4 performs reading via function 3 Read Holding R...

Page 11: ...ted to the sunrise time in the range 127 to 127 and the optional register reporting the calculated sunrise time SUNSET minutes to be added or subtracted to the sunset time in the range 127 to 127 and...

Page 12: ...the first 32 registers of MCP 4 SHARE V1025 V1152 SHARE V1153 V1280 SHARE R0 R7 SHARE R8 R15 SHARE R16 R23 SHARE R24 R31 2 1 9 Management of fault modules Assign a virtual point to the failure conditi...

Page 13: ...e allowed 2000 virtual points 0 registers 1000 virtual points 62 registers 512 virtual points 93 registers 0 virtual points 125 registers In other words the number of virtual points divided by 16 adde...

Page 14: ...published by the other components of the same network even if it does not contain any NETWORK directive the data exchange mechanism here described also applies between Contatto MCP 4 controllers and...

Page 15: ...ormation by all the components or nodes of the network needs a sure time Due to the particular management of the mechanism to access to the network this time can be optimized instructing each MCP 4 ab...

Page 16: ...with 8 time slots 8 ON OFF intervals for each day of the week The resolution of the Scheduler is 1 minute The Scheduler will be activated by the following directive SCHEDULER n Vx where n is the Sched...

Page 17: ...RESET priority on the level O1 1 SI1 1 RI1 2 Set Reset edge triggered O1 1 SI1 1 RI1 2 Set Reset edge triggered O1 1 SI1 1 RLI1 2 Reset on the level out is locked OFF if I1 2 is activated O1 1 SPLI1...

Page 18: ...virtual inputs each one with its own specific function 1 one or more inputs for forward or backward counting S k 2 one or more inputs for the zeroing or to load the counter with a defined value P z PP...

Page 19: ...ding the underflow or the overflow of the counter MIN is the minimum value that can be assumed by the counter the default value is 0 MAX is the maximum value that can be assumed by the counter the def...

Page 20: ...Hysteresis must be in the range 0 to 65535 Other allowable operators AND and OR Examples O1 1 AI1 240 2 V2 AI1 40 AI2 30 V2 AI1 40 5 O1 4 AI1 128 AI1 30 O1 5 AI1 600 R50 30 O1 1 AI1 R51 R52 AI1 1000...

Page 21: ...Equations for mathematical and logic calculation Allowed MATH and LOGIC operators MATH LOGIC Symbol Function Symbol Function Sum AND Subtract OR Multiply XOR divide P Preset Preset options P Preset on...

Page 22: ...When V1 goes ON only the value 20 will be sent to the output because it is a Preset on level AO1 1 P 10 V1 PL 20 V1 P 30 V1 When V1 goes ON only the value 10 will be sent to the output because it is...

Page 23: ...ents are stored has the battery back up feature therefore the events remain stored even if the main supply voltage fails at least until the battery does not reach the minimum retaining voltage of the...

Page 24: ...be stored in the RAM of MCP 4 since the section of the RAM where these events are recorded has the battery back up feature the values remain stored even if the main supply voltage fails at least unti...

Page 25: ...ed if the counting is greater or equal to 100 The input I1 1 when activated will reset the counter to 0 V10 AI10 4 R0 The virtual point V10 will be activated if the counting of the channel 4 of ModCNT...

Page 26: ...s Example AO1 2 DALI G1 AI44 2 Send AI44 2 to Group 1 G2 R1 Send R1 to Group 2 G3 R1 10 Send R1 incremented by 10 to Group 3 G4 R1 10 Send R1 decremented by 10 to Group 4 B1 AI45 2 Send AI45 2 to Ball...

Page 27: ...1440 hh x 60 mm Variable yearly dates specified in a register Rx or in a Word WORD x containing a number in the range 1 to 372 corresponding to the day of the year starting from January 1 372 Decembe...

Page 28: ...l be ON every week from Monday 11 15 to Friday 17 00 O1 1 CLOCK WORD32770 WORD32771 As the previous equation but time are specified by the shown Words O1 1 DATE R0 XX R1 XX Switching ON every year at...

Page 29: ...RO definition that are variable parameters because they change from a call to the other one cannot have the same names reserved to the parameters or the keywords of MCP 4 The following example defines...

Page 30: ...3 I2 4 V12 C5 R 1 P 129 I2 3 P 130 I2 4 P 128 V11 AO6 R5 This example well clarify how to use the MACRO utility to execute block of repetitive equations where only some parameters change In addition a...

Page 31: ...w or if the result of the previous operation is negative underflow or if a division by 0 occurred the value of this bit is 0 in all other cases ZERO bit flag whose value is 1 if the result of the prev...

Page 32: ...ollowed by a number in the range 1 to 127 The keyword TRIGGER specifies the event triggering the execution of the script or every how many time it must be executed The events triggering the scripts ca...

Page 33: ...s a script that the variable has been declared in another script In the following example the variable TEMP1 is declared as local both for script 1 and for script 2 while the variable is shared by bot...

Page 34: ...nstruction included between ELSE and ENDIF will be executed Each IF block must be always closed by an ENDIF which is mandatory on the contrary to ELSE which is optional The condition of the block IF T...

Page 35: ...w or if a division by 0 occurred The ZERO flag value is 1 if the result of the previous operation is zero The following SCRIPT shows the use of these flags script 1 trigger 2 R0 R1 R2 somma R1 R2 if C...

Page 36: ...lue equals one of the moments when the light brightness must be changed the two instructions RAMP1 K and PERC1 Z will be executed the effect of this instructions that are identical to A01 K and A01 Z...

Page 37: ...in a direct mode The following rule is always true Use CALL if the subroutine after the calling does not return any value Call directly the function if after the calling it must return a value At ever...

Page 38: ...tant value R100 CALCULATE R10 R11 function to which 2 parameters are passed and which will return a value copied in R100 The parameter R11 will be passed as reference therefore the function can change...

Page 39: ...n be achieved also using the following script where the destination registers will be passed as reference and therefore the subroutine works directly on them Prefer however the version of the previous...

Page 40: ...T x must be used in subroutines or functions only The declaration BIT X must be placed in the subroutine declaration ONLY The following script uses a function having as input parameters a value REG an...

Page 41: ...vious two examples This script uses a function having as input parameters a value REG and a bit ENABLE therefore declared by BIT ENABLE the function returns a bit TEST therefore declared by BIT TEST R...

Page 42: ...umber of register R0 The notation ptr inside square brackets returns the content of the pointed register In the following script the R15 value will be increased by 1 every time the content of each reg...

Page 43: ...by notations as Cx Ry etc and they are an option to the pointer method described before 3 2 12 SWAP x The SWAP x function exchange the high byte with the low byte of the specified Word x The Word can...

Page 44: ...oint the subroutine executes the OR between the Word containing the point and the mask which as said contains only one bit set to 1 at the position of the bit related to the desired point To reset the...

Page 45: ...ical utility to display the status of the plant input and output modules counters virtual points registers etc a simulator to verify the written program or a part of it before to transfer it into MCP...

Page 46: ...tion define Command I1 1 Input definition Pump1 Command Equation The previous equation is fully equivalent to O1 1 I1 1 but it can be easily interpreted The variable names defined through the define d...

Page 47: ...CP 4 memory 4 3 Uploading the program to MCP 4 memory Last step of MCP 4 programming process is the uploading to its flash MEMORY of the binary file containing the system configuration and the program...

Page 48: ...Following figures show the proper connections to be made and the description of the terminals note that terminal 17 must be left unconnected Connections of MCP module ETH 24V BUS 0V L1 L2 RS485 RS485...

Page 49: ...s Read to read the current MCP 4 setting for the Baud Rate on RS 232 and RS485 ports The other three parameters Wait Time are the delay time before the answer of MCP 4 to a Host request these wait tim...

Page 50: ...ation The Read button allows to report the MCP4 ETH current configuration and its MAC address 2 Via LAN network and browser MCP4 ETH has the factory settings as shown in the figure above particularly...

Page 51: ...of device that can be connected on RS485 line must be limited to 32 5 5 WEBS communication port MCP 4 features a special communication port COM3 under the terminal cover on the bottom left side see fo...

Page 52: ...d addresses the doubled modules are displayed on the screen in yellow color The doubled addresses signaling however cannot be assured because if the answer of the two modules is exactly superimposed e...

Page 53: ...channel Available communication ports 1 x RS232 opto coupled 2 x RS485 opto coupled 1 x dedicated port 1 x Ethernet port optional Peripheral devices handling Touch screen video terminals Bus display w...

Page 54: ...ata1 DataN Writing to RAM memory of N bytes 1 252 starting from address specified by the first 3 data bytes Note 1 0x7D 4 Add_U Add_H Add_L N Reading from microcontroller memory of N bytes 1 255 start...

Page 55: ...e Mod_Addr Data7 Data8 CH4 of module Mod_Addr 0x7A 8 256 Data1 Data Nx8 Answer to reading message of N 1 32 input modules starting from address module Mod_Addr The answer contains Nx8 bytes in the dat...

Page 56: ...d from the MCP 4 timekeeper chip 1 Monday 2 Tuesday 7 or 0 Sunday Note 3 0F08 0F09 1924 Day of the month in BCD format Read from the MCP 4 timekeeper chip Note 3 0F0A 0F0B 1925 Month in BCD format Rea...

Page 57: ...ddress 0 STATUS 0 means BUS OK 5 SYS F 1 Module_Address 0 STATUS 1 means MOD F 6 SYS F 1 Module_Address 0 STATO 0 means MOD OK 7 The symbol means not used Note 5 The list of analog events values or co...

Page 58: ...installed The information are organized in one byte for each MODCNT module with offset Module_Address as follows offset 0 Byte 0xEB00 not used offset 1 Byte 0xEB01 input module MODCNT 1 offset 2 Byte...

Page 59: ...0A23 1297 Scheduler number Sx Writing a value 1 to 16 in this Word MCP 4 will copy the data of the day Dy of the schedule Sx in the Words 1280 1296 8 scheduling times ON OFF Enabling 0A24 0A25 1298 Da...

Page 60: ...s tool can work connected to MCP 4 through the serial port or it can simulate the program written by MCP IDE in order to debug it before the writing into MCP 4 FLASH memory MCP MAP is an advanced tool...

Page 61: ...on or the menu item View Show Keywords List is the life belt and it allows to switch ON or OFF the opening of a space on the right side containing all the keywords allowed in the related TAB When Conf...

Page 62: ...riting the standard equation of MCP 4 The Macros workspace allows writing the Macro definitions The Script workspace allows writing the Scripts Page 62 of 87 Rel 1 2 October 2018 DUEMMEGI s r l Via Lo...

Page 63: ...after compiling information about the resources used in the just compiled program The Decompiling workspace read only is reserved to expert user and contains after de compiling information about how t...

Page 64: ...nd the messages on the Ethernet port of the PC where it has been installed instead to RS232 port The answer of MCP 4 afterward will follow the reverse way Use Server Name allows to specify an address...

Page 65: ...ts registers counters timers and events both digital and analog ones The reading setting window opened by the butto n looks like in the figure on this right side The clock panel shows Hours Minutes Se...

Page 66: ...ts From MCP create a group for all configured Output Modules Load Mixed Module from MCP create a group for all configured Mixed Modules Through these functions the module configured in MCP 4 will be s...

Page 67: ...ual point Click on the right side of each LED while holding down the Shift button on the keyboard to assign a label to the related point Finally click on the white band on the lower side of the virtua...

Page 68: ...the module itself while holding down the Ctrl button on the keyboard To paste the module from the Clipboard to a group press the button in the destination group Each group can be saved or updated in...

Page 69: ...MCP 4 program or part of it The simulator is a fully software tool therefore no serial connection to MCP 4 is required The simulator shows the behavior of the output parameters of a program e g real a...

Page 70: ...ated paragraph To localize the input and output points virtual points registers etc refer to the external RAM memory described in a previous chapter or better refer to the tables listed in the followi...

Page 71: ...he real module of Contatto system starting from which the status of the outputs has to be read and CH the channel then the value of Start will be Add x 16 2048 x CH 1 Allowed values from 0 to 8176 how...

Page 72: ...alue is suggested to be multiple of 16 and equal to the number of modules to be read multiplied by 16 Allowed values from 16 to 8176 MCP 4 will answer with a number of bytes equal to Number divided by...

Page 73: ...hose most significant byte is zero and the less significant byte is contains the status of the output points of module 25 in binary code 1 out ON 0 out OFF The less significant bit is related to the o...

Page 74: ...lue is the module 16 of the starting number this result is always an integer number in the range 0 to 7 The parameters to be passed to the MODBUS driver for virtual point V328 are Start 1173 Number 1...

Page 75: ...The function 16 is more used than the function 6 The following parameters have to be specified Number this value is the Word address where the new value has to be written Allowed values for Number fro...

Page 76: ...r Start 541 Number 1 normally in this case this parameter is not required by the driver Bit 2 Value 1 or ON it depends on the used driver Note the point 3 of an output module correspond to bit 2 of th...

Page 77: ...procedure however is normally executed automatically by the MODBUS driver of the MASTER system Example 4 Write the value 157 into counter C22 remember that for the Contatto system the counter are num...

Page 78: ...been used see description of the PROTOCOL directive All numbers in the tables are in decimal format As option DUEMMEGI provides free of charge a small program named WordFinder which immediately gives...

Page 79: ...216 226 236 246 009 137 147 157 167 177 187 197 207 217 227 237 247 Channel 3 IN 000 010 020 030 040 050 060 070 080 090 100 110 120 000 266 276 286 296 306 316 326 336 346 356 366 376 001 257 267 277...

Page 80: ...758 009 649 659 669 679 689 699 709 719 729 739 749 759 Channel 3 OUT 000 010 020 030 040 050 060 070 080 090 100 110 120 000 778 788 798 808 818 828 838 848 858 868 878 888 001 769 779 789 799 809 81...

Page 81: ...44 V360 V376 V392 V408 V424 V440 V456 V472 V488 V504 Bit 8 V265 V281 V297 V313 V329 V345 V361 V377 V393 V409 V425 V441 V457 V473 V489 V505 Bit 9 V266 V282 V298 V314 V330 V346 V362 V378 V394 V410 V426...

Page 82: ...1065 V1081 V1097 V1113 V1129 V1145 V1161 V1177 V1193 V1209 V1225 V1241 V1257 V1273 Bit 9 V1034 V1050 V1066 V1082 V1098 V1114 V1130 V1146 V1162 V1178 V1194 V1210 V1226 V1242 V1258 V1274 Bit 10 V1035 V1...

Page 83: ...7 V2003 V2019 Bit 3 V1796 V1812 V1828 V1844 V1860 V1876 V1892 V1908 V1924 V1940 V1956 V1972 V1988 V2004 V2020 Bit 4 V1797 V1813 V1829 V1845 V1861 V1877 V1893 V1909 V1925 V1941 V1957 V1973 V1989 V2005...

Page 84: ...2427 2437 2447 2457 2467 2477 2487 2497 2507 2517 2527 R 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 000 2528 2538 2548 2558 2568 2578 2588 2598 2608 2618 2628 2638 2648 2658 2668...

Page 85: ...3 3153 3163 3173 3183 3193 3203 3213 3223 002 3074 3084 3094 3104 3114 3124 3134 3144 3154 3164 3174 3184 3194 3204 3214 3224 003 3075 3085 3095 3105 3115 3125 3135 3145 3155 3165 3175 3185 3195 3205...

Page 86: ...3611 3621 3631 3641 3651 3661 3671 3681 3691 3701 3711 C 640 650 660 670 680 690 700 710 720 730 740 750 760 770 780 790 000 3712 3722 3732 3742 3752 3762 3772 3782 3792 3802 3812 3822 3832 3842 3852...

Page 87: ...4084 4094 003 4035 4045 4055 4065 4075 4085 4095 004 4036 4046 4056 4066 4076 4086 005 4037 4047 4057 4067 4077 4087 006 4038 4048 4058 4068 4078 4088 007 4039 4049 4059 4069 4079 4089 008 4040 4050 4...

Reviews: