Home
QD51(-R24) A1SD51S AD51H-S3
Contents
1. 2 D gt B EM 0 EM0000 0 0 3 4 MELSEC Q Enter the number of the target device from which the writing of bit information is started Enter a hexadecimal number with 2 digits or less if X has been specified or a decimal number with 4 digits or less if EM has been specified X 0to1F EM 0to 1023 In an example figure to the left EMO is specified The result of the command execution is displayed in the succeeding line If the command ends normally the specified device number and the bit information are displayed as shown below using o or 1 Enter the bit information to be written at the cursor position ea 0 or 1 Number Enter bit information to be Device type written using 0 or 1 Bit information of the device to the left is displayed using 0 or 1 The following keys are used in the bit information write operation 0 Used to turn the target bit off 1 Used to turn the target bit on Used when backing up the target device number Used to end the bit information write operation If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where the command ends normally is shown D gt is displayed in the line following the command execution result Enter the next command eee SSS 1 Processing when exceeding target device memory range e The processing of the B command is automatically t
2. 1 Online programming 2 Offline programming Esc Clase Description E H x H l H T H Enter 1 Enter the EXIT command to display the main menu screen S gt EXIT Cee 1 Status of each BASIC program by the execution of the EXIT command The BASIC programs in each BASIC task area execute continuously even when the EXIT command is executed 2 Precaution when entering the command Stop the execution of BASIC programs before entering the EXIT command so that the execution does not interfere with the system control when displaying the main menu to edit BASIC programs in each BASIC task area etc 4 ONLINE PROGRAMMING OPERATION MELSEC Q 2 The screen displays the result of the command execution the user can perform necessary operations from this point If the command ends normally the main menu screen is displayed on the console select a displayed item to perform a necessary operation The content is displayed when the command ends normally See the following manual for an explanation of the operations from the main menu screen SW1IVD AD51HP SW1NX AD51HP AD51H BASIC Operating Manual Menu Programming 1 Online programming 2 Ofin programming If the command ends abnormally an error message or similar is displayed eee 2 About changing the mode of the communication module See Section 2 3 for the mode change diagram of the communication module 3 Reference Ope
3. Canvas Size OK bytes File Size 128K bytes 8 6 0 2 Description ChE OR RA MBAR T 1 Enter the CFORMAT command to display the formatting information of the memory card S gt CFORMAT 0 a 2 Enter the memory card interface number for the memory card for which the formatting information is to be displayed SsCFORMAT 0 followed by a colon Only O or 1 can be specified 0 The MEMORY CARD 1 drive on the AD51H S3 1 The MEMORY CARD 2 drive on the AD51H S3 Note that 0 may be omitted when specifying the memory card interface number If it is omitted simply press Enter In the example figure to the left the memory card in MEMORY CARD 1 is specified 4 ONLINE PROGRAMMING OPERATION MELSEC Q 3 The screen displays the result of the command execution If the command ends normally the formatting information of the specified memory card is displayed from the next line If the command ends abnormally an error message or similar is displayed The following information is displayed when the command ends normally see the figure to the left S gt CFORMAT 0 Card Name TASK DTM Card Size 512K bytes Program Size 384K bytes Canvas Size OK bytes 8 6 0 File Size 128K bytes 2 e Card Name Memory card name assigned during formatting e Card Size The capacity corresponding to the value specified as the overall size during
4. KMODE Commands 11 106 KNJ With restriction Section 8 8 2 27 KTYPE Commands 11 110 LEFT Commands 11 111 LEN Commands 11 112 LET Commands 11 113 LFILES Not supported by the compiler Section 8 8 2 28 LINE INPUT With restriction Section 8 8 2 29 LINE INPUT Commands 11 118 LIST Not supported by the compiler Section 8 8 2 30 LLIST Not supported by the compiler Section 8 8 2 31 LOAD Not supported by the compiler Section 8 8 2 32 LOC Commands 11 122 LOCATE Commands 11 123 LOF Commands 11 125 LOG With restriction Section 8 8 2 33 LPRINT Commands 11 127 Commands 11 128 Commands 11 129 Not supported by the compiler Section 8 8 2 34 MID 1 Commands 11 132 MID 2 Commands 11 133 MKD Commands 11 134 MKDMBF With restriction Section 8 8 2 35 MkI Commands 11 137 MKS Commands 11 138 MKSMBF With restriction Section 8 8 2 36 NAME Commands 11 141 NEW Not supported by the compiler Section 8 8 2 37 OCT With restriction Section 8 8 2 38 ON COM GOSUB With restriction Section 8 8 2 39 ON ERROR GOTO Commands 11 148 DIOIL IO JOJO JOJO JOJO IS IE xO JOJO IL JOJO JO x JOJOJO IE IO JO O X x x JOIP x JOJO O O b JO ON GOSUB Commands 11 150 ON GOTO Commands 11 152 OPEN Commands 11 153 PCRD Commands 11 155 PCWT Commands 11 220 PRINT Commands 11 291 PRINT USING With restriction Section 8 8 2 40 PRINT Commands
5. The task size value specified at the START command execution is set Startup order No setting is made 4 ONLINE PROGRAMMING OPERATION a S gt MSAVE 1 V SAVE Y N Y 5 S gt MSAVE 1 V SAVE Y N Y SAVE OK S gt 6 MELSEC Q The screen displays SAVE Y N Enter Y to save Enter N to stop saving The console returns to waiting for a system command entry In the example figure to the left the save is specified The screen displays the result of the command execution in the succeeding line If the command ends normally SAVE OK is displayed If the command ends abnormally an error message or similar is displayed In the example figure to the left a display where the command ends normally is shown S gt is displayed in the line following the command execution result Enter the next command El 4 Reference Operation for saving executable programs from a memory card EEP ROM flash ROM to the main memory MLOAD command Section 4 3 1 Operation for specifying multitask settings and changing the setting contents SET command Section 4 4 1 Operation for displaying the setting contents of the multitask settings SET Command Section 4 4 2 Operation for changing the mode of the communication module to the edit mode 1 START command Section 4 5 1 4 15 4 15 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 4 Operating Procedure for Specifying Multitask Settings Cha
6. Z S T A T U S 1 Enter the ZSTATUS command to display information managed by the OS and S to specify resource numbers as the information type to be displayed SP S Enter 1 About exclusive access control of resources by reserving freeing resource numbers Exclusive access control of resources can be achieved using the following instructions in BASIC programs when multiple BASIC programs are being executed at the same time See the AD51H BASIC Programming Manual Commands for more information e Reserving a resource number ZRESERVE instruction e Releasing a resource number ZRELEASE instruction 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q DsZSTATUS S 2 The result of the command execution is displayed Semaphore PESERVE Basic If the command ends normally the reserved released status No RELEASES NG corresponding to each of the resource numbers from 0 to 31 is displayed from the succeeding line The descriptions of the displayed information are as follows Semaphore No column Resource number RESERVE RELEASE _ Shows the reserved released column status of the corresponding resource number RESERVE Shows that the status is reserved RELEASE Shows that the status is released BASIC No column Corresponding resource number If the command ends abnormally Error message and an error code are displayed in the succeeding line In an example figure to the left a display where the command end
7. 1 210 55 11 Fax 40 0 1 210 5511 e mail sirius_t_s fx ro AutoCont Control CZECHIA Systems s r o Nemocnicni 12 CZ 702 00 Ostrava 2 Phone 420 0 69 615 21 11 Fax 420 0 69 615 21 12 e mail petr pustovka autocont cz DENMARK louis poulsen Geminivej 32 DK 2670 Greve Phone 45 0 43 95 95 95 Fax 45 0 43 95 95 91 e mail pia lpmail com UTU Elektrotehnika AS P rnu mnt 160i EE 11317 Tallinn Phone 372 6 51 72 80 Fax 372 6 51 72 88 e mail utu utu ee ESTONIA Beijer Electronics OY FINLAND Elannontie 5 FIN 01510 Vantaa Phone 358 0 9 615 2011 Fax 358 0 9 615 20 500 e mail info elc beijer fi MITSUBISHI ELECTRIC EUROPE B V Irish Branch Westgate Business Park IRL Dublin 24 Phone 353 0 1 419 88 00 Fax 353 0 1 419 88 90 e mail sales info meuk mee com IRELAND ACP AUTOCOMP a s Chalupkova 7 SK 81109 Bratislava Phone 421 0 7 592 22 48 Fax 421 0 7 592 22 54 e mail acp autocomp nextra sk INEA d o o SLOVENIA Ljubljanska 80 SI 1230 Dom ale Phone 386 0 1 721 80 00 Fax 386 0 1 724 1672 e mail inea inea si SLOVAKIA Beijer Electronics AB SWEDEN Box 325 S 20123 Malm Phone 46 0 40 35 86 00 Fax 46 0 40 93 23 01 e mail info elc beijer se ECONOTEC AG Postfach 282 CH 8309 N rensdorf Phone 41 0 1 838 48 11 Fax 41 0 1 838 48 12 e mail info econotec ch GTS TURKEY Dar laceze
8. Change the start condition from BOOT to the SET command START 13 Run the program Enter GO R D to run the program in programming mode Set mode setting switch 1 to 1 or 0 and reset the communication module to run the program in execution mode 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 3 Software Required for Compilation An assembler and linker are required to compile a program created in the communication module Because the SW1SRX AD51HP software package does not include an assembler and linker these must be purchased separately Some assembler and linker products are recommended below Recommended products assembler and linker 1 For IBM PC AT compatible PCs Please purchase the Borland C Suite product Borland C Suite includes Turbo Assembler English version for IBM PC AT Turbo Assembler Turbo Assembler Ver 5 0 compatible Inprise Corporation Sasazuka South Building 1 64 8 Sasazuka Shibuya ku Tokyo 151 0073 Japan Tel 03 5350 9380 2 For PC 9800 series Microsoft MASM PC 9800 series compatible 1 25 MB Fj Macro Assembler Ver 6 0 for PC 9800 series format Microsoft Corporation Sasazuka NA building 1 50 1 Sasazuka Shibuya ku Tokyo 151 8533 Japan Tel 03 5454 8000 7 4 Installing Assembler and Linker Refer to the manual for the software for how to install the assembler and linker for compilation The path of the assembler and linker should be added to the Auto
9. Create the BASIC program using the general purpose editor 4 Save the BASIC program The program should be saved in the location C AD51H USR OCO and have the file extension BAS 5 End the general purpose editor 6 Start up the line numbering tool to add line numbers Enter DRENUM lt file name gt and add line numbers 7 Start up the software package 4 8 Execute the program using the interpreter to check the operation 6 3 Software Required to Create Programs with a General Purpose Editor It is necessary to purchase any of the following software in order to create programs using a general purpose editor Any software that can convert text can be used Word Word Pad Notepad Ichitaro MIFES etc 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR MELSEC Q 6 4 Precautions when Using a General Purpose Editor Please take the following precautions when using a general purpose editor 1 About the end of line processing within a program Make sure to enter CR amp HOA or LF amp HOA at the end of each line in the program In a general purpose editor they are automatically entered by pressing the Return key J or the Enter key Failing to enter CR or LF will cause an error The file has nonetheless been read it should be saved using the BASIC instruction SAVE as is in order to make it a valid file 2 About the end of file processing of a BASIC program file Enter EOF amp H1A at the end of a
10. etc The line number change operation is continued Correct the line numbers referenced in the corresponding line App 1 APPENDIX MELSEC Q Appendix 2 Error Messages at Compilation This section explains the error messages generated at compilation Error messages are divided into the following three types 1 Fatal errors These are errors that make it difficult for the compilation to continue such as errors related to files errors due to memory shortage and errors inside the compiler Example of error display FATAL file I O error If a fatal error is detected the compiler immediately stops compiling Remove the cause of the error and compile again When the compiler stops compiling the message compiler aborted is displayed Errors These error messages point out instructions etc that cannot be compiled correctly such as syntax errors in the BASIC program or infringements on restricted items Example of error display gt 10A 12345 AN LEEI syntax error in string expression The compiler detects as many errors as possible before it stops compiling Remove the causes of the errors and check the operation using the interpreter then compile the program again When the compiler stops compiling the message compiler aborted is displayed 3 Warnings App 2 Warnings are messages that point out instructions etc that are problematic but not as bad as errors Typically a warning is
11. 11 296 PRINT USING With restriction Section 8 8 2 41 Continued on the following page 7 CREATING PROGRAMS USING A COMPILER MELSEC Q Table 7 1 List of whether or not instructions functions can be compiled continued Instruction function Compilation Remarks Reference page reference section PUT Commands 11 298 PUTMEM Commands 11 299 RDSET With restriction Section 8 8 2 42 READ With restriction Section 8 8 2 43 REM Commands 11 307 RENUM Not supported by the compiler Section 8 8 2 44 RESTORE With restriction Section 8 8 2 45 RESUMU With restriction Section 8 8 2 46 RIGHT Commands 11 311 RND Commands 11 312 ROT With restriction Section 8 8 2 47 RSET Commands 11 315 RUN 1 Not supported by the compiler Section 8 8 2 48 RUN 2 Commands 11 317 SAVE Not supported by the compiler Section 8 8 2 49 SEARCH Commands 11 319 SGN Commands 11 321 With restriction Section 8 8 2 50 With restriction Section 8 8 2 51 With restriction Section 8 8 2 52 OJOJO JOE JO b e x x OJP Oix JOJO IE I gt gt O gt I Ib O O x JO JO JOJOIP Ib x JOE gt JO JO SPACE Commands 11 327 SPC With restriction Section 8 8 2 53 SQR With restriction Section 8 8 2 54 STOP With restriction Section 8 8 2 55 STR Commands 11 331 STRING Commands 11 332 SYSTEM Not supported by the compiler Section 8 8
12. 2 56 SWAP Commands 11 334 TAB With restriction Section 8 8 2 57 TAN With restriction Section 8 8 2 58 TIME Commands 11 337 TROFF Not supported by the compiler Section 8 8 2 59 TRON Not supported by the compiler Section 8 8 2 60 VAL With restriction Section 8 8 2 61 WHILE WEND With restriction Section 8 8 2 62 WIDTH Commands 11 346 WTSET With restriction Section 8 8 2 63 ZBAS Commands 11 349 ZCLOSE Commands 11 350 ZCNTL Commands 11 351 ZEVENT Commands 11 376 Continued on the following page 7 CREATING PROGRAMS USING A COMPILER MELSEC Q Table 7 1 List of whether or not instructions functions can be compiled continued Instruction function Compilation Remarks Reference page reference section Commands 11 412 Commands 11 413 ZIDV O Commands 11 377 ZLDV O Commands 11 378 ZMESSAGE O Commands 11 379 ZMESSAGE CLOSE O Commands 11 382 ZMESSAGE GET Q Commands 11 383 ZMESSAGE KILL Q Commands 11 385 ZMESSAGE OPEN Q Commands 11 386 ZMESSAGE PUT O Commands 11 387 ZMOVE Q Commands 11 389 ZODV Q Commands 11 393 ZOPEN O Commands 11 394 ZRECEIVE O Commands 11 396 ZRELEASE O Commands 11 401 ZRESERVE O Commands 11 402 ZSEND O Commands 11 404 ZSIGNAL O Commands 11 409 ZSTART A With restriction Section 8 8 2 64 Commands 11 141 Continued on the following page 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 8 2 Instructions
13. 5 01 20 Copyright C Microsoft Corp 1984 1988 All right reserved Definitions File NUL DEF Press the Enter key This may not be instructed LINK warning L4021 no stack segment Ignore this warning C AD51HUSR gt 4 C AD51HUSR The compilation is complete 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 6 Precautions when Compiling 1 About compilation Make sure to use Microsoft Macro Assembler or Turbo Assembler when compiling It is not possible to compile programs with assemblers other than Microsoft Macro Assembler or Turbo Assembler About work files created by the compiler The file names shown below are reserved for files the BASIC compiler creates The user should not use them n ASM Assembler source file A number is placed in stead of n n OBJ Object file BC TMP Temporary work file BASIC INC Include file About errors at compilation Errors generated during compilation are displayed on the screen as well as stored in the assembler source file n ASM Errors can also be viewed by referring to this file About checking the correct operation of a program Make sure to check thoroughly that the program operates correctly by running it using the interpreter before attempting to compile it The program cannot be edited once it has been compiled If an error occurs after the program is compiled and run it will be necessary to correct and re compile the program About the warning when usi
14. 847 478 21 00 Fax 1 847 478 22 83 EUROPE JAPAN GEVA GmbH Wiener Stra e 89 A 2500 Baden Phone 43 0 2252 85 55 20 Fax 43 0 2252 488 60 e mail office geva co at AUSTRIA Getronics bv BELGIEN Getronics bv NETHERLANDS Control Systems Donauweg 2B NL 1043 AJ Amsterdam Phone 31 0 20 587 68 30 Fax 31 0 20 587 68 39 e mail info gia getronics com MIDDLE EAST REPRESENTATIVE TEXEL Electronics LTD Rehov Hamerkava 19 IL 42160 Netanya Phone 972 0 9 863 08 91 Fax 972 0 9 885 24 30 e mail texel_me netvsion net il ISRAEL Control Systems Beijer Electronics A S NORWAY Pontbeeklaan 43 Teglverksveien 1 B 1731 Asse Zellik N 3002 Drammen Telefon 32 0 2 467 1751 Phone 47 0 32 24 30 00 Telefax 32 0 2 467 17 45 Fax 47 0 32 84 85 77 E Mail infoautomation getronics com e mail info elc beijer no TELECON CO BULGARIA MPL Technology SP z o o POLAND 4 A Ljapchev Blvd ul Wroclawska 53 BG 1756 Sofia PL 30011 Krak w Phone 359 92 97 44 05 8 Phone 48 0 12 632 28 85 Fax 359 92 97 44 06 1 Fax 48 0 12 632 47 82 e mail e mail mpl krakow ipl net INEA CR d 0 0 CROATIA Sirius Trading amp Services srl ROMANIA Drvinje bb Bd Ghica nr 112 BI 41 Sc 2 ap 98 HR 10000 Zagreb Phone 385 0 1 366 71 40 Fax 385 0 1 366 71 40 e mail inea cr zg tel hr RO 72235 Bucaresti 2 Phone 40 0
15. Cad No 43A KAT 2 TR 80270 Okmeydani Istanbul Phone 90 0 212 320 1640 Fax 90 0 212 320 1649 e mail gts turk net SWITZERLAND EURASIAN REPRESENTATIVES MITSUBISHI ELECTRIC EUROPE B V Moscow Representative Office 52 Kosmodamianskaya Nab bld 5 RUS 113054 Moskow Phone 7 0 95 721 2070 Fax 7 0 95 721 2071 e mail info mitsubishi electric ru NPP Uralelektra RUSSIA Sverdlova 11A RUS 620027 Ekaterinburg Phone 7 34 32 53 27 45 Fax 7 3432 53 2461 e mail elektra etel ru JV CSC Automation 15 Marina Raskovoyi St U 02002 Kiev Phone 380 44 238 83 16 Fax 380 44 238 83 17 e mail mkl csc a kiev ua RUSSIA UKRAINE AFRICAN REPRESENTATIVE Circuit Breaker SOUTH AFRICA Industries Ltd Private Bag 2016 ZAF 1600 Isando Phone 2711 928 2000 Fax 2711 392 2354 PLC12 01 Printed in Germany Aa MITSUBISHI ELECTRIC NDUSTRIAL AUTOMATION Gothaer Strasse 8 D 40880 Ratingen Phone 49 2102 486 0 Hotline 49 1805 000 7650 Fax 49 2102 486 7170 www mitsubishi automation de megfa mail meg mee com www mitsubishi automation com
16. Functions with Different Specifications at Compilation This section provides a more detailed explanation of instructions whose specifications are different when using the compiler instead of executing them using the interpreter Instructions other than the ones explained here can be used with the same specifications as in the interpreter please refer to the explanation for the interpreter i Specifications different from the interpreter Reference page in No Instruction function oa Corrective action restrictions and precautions the Commands 1 JATN If lt numerical expression gt contains a double e Use the CSNG function on the precision real number a double precision value lt numerical expression gt to make sure is returned otherwise a single precision value that it becomes single precision is returned pae The AUTO instruction is not supported e AUTO can be used as a variable name 3 BINS e If a value outside the range from 32758 to e Check the range using the IF instruction 65535 is specified in lt numerical expression gt before the BIN function and generate the result is the same as if 32767 is specified an error using the ERROR instruction if necessary 4 CHAIN e The CHAIN instruction is not supported Substitute with the RUN 2 instruction e A not supported error is generated at Be careful when using the RUN 2 compilation instruction however It does not support the following functionality of
17. Y FORMAT OK S gt MELSEC Q The screen displays FORMAT Y N Enter LY to format Enter N to stop formatting In the example figure to the left formatting is specified The screen displays the result of the command execution in the succeeding line If the command ends normally FORMAT OK is displayed If the command ends abnormally an error message or similar is displayed In the example figure to the left a display where the command ends normally is shown S gt is displayed in the line following the command execution result Enter the next command 2 Reference Operation for physically formatting a memory card CFORMAT command Section 4 2 2 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 MULTITASK DEBUGGING OPERATIONS Multitask debugging refers to operations for finding and correcting errors in each program while executing multiple BASIC programs at the same time This chapter explains how to use the debug commands entered from the debugger in order to start executing BASIC programs with multitask settings and debug each BASIC program 1 This chapter mainly explains the key inputs and displays on the debugger side It is therefore generally omitted to state this fact explicitly for most key inputs and displays When necessary it is pointed out explicitly that key inputs and displays are on the console side 2 Itis necessary to perform the following tasks in advance in order
18. a source file or This may happen because the disk is damaged there is not intermediate file was accessed enough free space on the disk disk full etc If the disk is full delete unnecessary files and compile again line too long The length of one line in a source program is This may happen because the source file was not stored by too long This error occurs at 299 characters the AD51H S3 BASIC interpreter the source file is or more damaged etc Save the file correctly source file XXXX not found App 1 A source file specified in a command line Specify a correct source file cannot be found App 1 APPENDIX MELSEC Q symbol table overflow There are too many variables labels or FN functions This error occurs when there are 500 variables with 9 character names Corrective action Change the names of variables labels and FN functions with long names to short ones Delete unnecessary variables labels and FN functions too many target line numbers There are too many line numbers referenced in statements such as GOTO and GOSUB Replace some of the line numbers with labels or divide the program unexpected end of file in XXXX A source file ends in the middle of a sentence Complete the program before compiling dbb obj not found dbc lib not found The startup module file and or library file cannot be found Two files dbb obj and bdc lib must b
19. bit information to extension relays EM area Command Device name Operation example Write the bit information 0 1 1 0 to EMO to EM3 Before input PoC ICOM OOO Command Device name Starting number Meets owe ee o H Enter Ma H Enter H H Enter T H Enter H H Enter After input v Write end Loe to EM3 D gt B EM 0 Writing to EM2 EM0000 0 0 Writing to EM1 EM0001 0 1 Writing to EMO EM0002 0 1 EM0003 0 0 ff n n off on on off EM0004 0 D a n Description B H eH H E H M H l 1 Enter the B command to write bit information along with the type of the target device D gt B EM Enter the device type using the following characters XxX Name when specifying general purpose inputs PLC CPU lt Communication module EM Name when specifying extension relays In an example figure to the left extension relay EM is specified lt 1 About general purpose input output devices between the PLC CPU and the communication module General purpose input output devices handle bit information communicated between sequence programs on the PLC CPU side and BASIC programs on the communication module side as well as bit information controlled by each OS 2 Precautions when using the command e Do not write bit information to general purpose inputs XOB to XOF In order to operate the communication module normally 5 MULTITASK DEBUGGING OPERATIONS
20. code 824 error may occur during the MSAVE operation indicating that there is no work area If this occurs set the start conditions of all tasks to OFF and perform the MSAVE operation for all tasks again Reset the communication module after performing the MSAVE operation 7 CREATING PROGRAMS USING A COMPILER MELSEC Q The procedure below shows an example of the steps involved when performing an MSAVE operation on a compiled file COMP EXE in this example to task No 1 at location 32 1 S gt MSAVE 1 3 COMP EXE 32 Save to the executable program area of task 1 SAVE Y N Y Select Y SAVE OK S gt The save is complete 2 S gt SET 1 START Change start up condition from BOOT to SET OK START S gt 3 S gt GO R Change to execution mode 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 8 Instruction Function List 7 8 1 List of Whether or not Instructions Functions can Be Compiled The table below shows whether or not each command can be compiled O Can be compiled without any difficulties A Can be compiled with restrictions x Not supported by the compiler Table 7 1 List of whether or not instructions functions can be compiled Instruction function Compilation Remarks Feference pags reference section ABS O Commands 11 2 AKCNV O Commands 11 3 ASC O Commands 11 4 ATN A With restriction Secti
21. figure to the left loading is specified The screen displays the result of the command execution in the succeeding line If the command ends normally LOAD Ok is displayed If the command ends abnormally an error message or similar is displayed In the example figure to the left a display where the command ends normally is shown S gt is displayed in the line following the command execution result Enter the next command CEO 3 Reference Operation for saving executable programs of the communication module to a memory card EEP ROM flash ROM already set data MSAVE command Section 4 3 2 Operation for specifying multitask settings and changing SET command Section 4 4 1 Operation for displaying specified data of multitask settings SET command Section 4 4 2 Operation for changing the mode of the communication module to the edit mode 1 START command Section 4 5 1 Operation for ending the operation of the interpreter in the specified BASIC task area TKILL command Section 4 6 4 12 4 12 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 3 2 Saving Executable Programs to a Memory Card EEP ROM Flash ROM from the Communication Module MSAVE Command This operation saves an executable program in the specified BASIC task area of the communication module onto the target BASIC task area in a memory card EEP ROM flash ROM The multitask settings are automatically specified for the relevant task a
22. formatting total capacity of the memory card This is the value specified as the overall size during formatting e Program Size The capacity corresponding to the value specified as the executable program area size during formatting the capacity of the executable program area The value in parentheses is the value specified for the executable program area size when the CFORMAT command was used to format the memory card e Canvas Size Please ignore e File Size The capacity corresponding to the value specified for the file area size during formatting the capacity of the file area The value in parentheses is the value specified for the file area size when the CFORMAT command was used to format the memory card 4 S gt is displayed on the line following the command execution result Enter the next command Cee 1 Reference e Operation for formatting a memory card CFORMAT command Section 4 2 2 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 3 Operating Procedure for Loading Saving Executable Programs This chapter explains how to use each of the system commands for controlling executable program information and the operating procedure These commands can be used to load an executable program in a BASIC task number area of the communication module to a memory card EEP ROM flash ROM and vice versa 4 3 1 Loading Executable Programs to the Communication Module from a Memory Card EEP ROM Flash ROM MLOAD Command
23. input output devices between the PLC CPU and the communication module General purpose input output devices handle bit information communicated between the sequence programs on the PLC CPU side and the BASIC programs on the communication module side as well as bit information controlled by each OS 5 MULTITASK DEBUGGING OPERATIONS 2 gt GE ee D gt B EM 16 Tae 3 D gt B EM 16 32 ON MELSEC Q Enter the B command to display bit information and the type of the target device Enter the device type using the following characters X When specifying general purpose inputs PLC CPU lt Communication module Y When specifying general purpose outputs PLC CPU gt Communication module EM When specifying extension relays In an example figure to the left extension relays are specified Enter the starting number of the target device range for which the bit information is to be displayed Enter a hexadecimal number with 2 digits or less if X or Y have been specified or a decimal number with 4 digits or less if EM has been specified X Y 0to1F EM 0 to 1023 In an example figure to the left EM16 is specified Enter the number of points displayed number of bits of the target device range for which bit information is to be displayed using a decimal or hexadecimal number X Y 1 1H lt number of points displayed 32 lt 20H EM 1 1H lt number of points displayed 1024 lt 400 In an e
24. is displayed If STATUS above is STOP If it is DORMANT the value 0 is displayed D gt is displayed in the line following the command execution result Enter the next command x1 The program is also forced into the STOP status when the execution of the specified BASIC program is stopped using the debug command TSTOP 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 2 2 Starting the Execution of the Specified BASIC Program TRUN Command This operation starts the execution of the BASIC program residing in the specified task area Input format shortcut of the command TR TRUN HsH Task No H Enter Command Operation example Start execution of the BASIC program residing in the area of task No 1 Before input After input D gt TRUN Description T H R H U H N HsH 1 Enter 1 Enter the TRUN command to order to start executing a BASIC program along with the task number task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area where the target program resides In an example figure to the left the BASIC program residing in the area of task No 1 starts executing D gt TRUN 1 D gt TRUN 1 2 The screen displays the result of the command execution in REQUEST OK the succeeding line If the command ends normally REQUEST OK is displayed If the command ends abnormally an error message and error code are displayed In an example figu
25. it becomes possible to debug each BASIC program executed with the multitask settings by entering debug commands to the debugger terminal see Chapter 5 By changing to execution mode 2 each BASIC program starts running according to the multitask settings By changing back to system mode it becomes possible to edit debug each BASIC program by entering system commands to the console The following table lists the relationship between the mode and debugging start specification when the GO command is entered and the statuses of the console and the debugger terminal after the GO command has been executed Debugging startup specification Yes No Mode setting Yes R To debug mode Execution mode 1 No To execution mode 2 P System mode within Cannot be specified programming mode Console status The contents of the display are deleted The console display changes to the one used for BASIC programs The contents of the display are deleted and S gt is displayed It becomes possible to enter system commands Status of debugger terminal The debugger initiates the contents of the display are deleted and D gt is displayed It becomes possible to enter debug commands The contents of the display are kept as is The terminal becomes a general purpose port for BASIC programs Remarks Each BASIC program is reloaded to the corresponding task area according to the multitask settings and is exe
26. program that is in a status other than STOP In addition if a task area that contains a BASIC program in the STOP status is specified and the mode of the communication module is changed to edit mode 2 the execution of this BASIC program in the STOP status cannot be resumed using the TCONTINUE command It cannot even be resumed if the mode of the module is returned to debug mode by executing the SYSTEM instruction The status of a BASIC program can be checked using the TSTATUS command 2 Precautions when specifying a line number e When specifying the line number a line number that exists in a program should be entered using the same decimal format as the description format in the program If a line number that does not exist in a program is entered the execution is resumed from the line with the first number after the specified number 3 Reference e Operation for checking the status of the current BASIC program TSTATUS command Section 5 2 1 e Operation for stopping the execution of the specified BASIC program TSTOP command Section 5 2 3 Operation for starting the execution from the start line again TRUN command Section 5 2 2 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 2 5 Displaying Values of Specified Variables in the Specified BASIC Program T Command This operation displays the current value of the specified variable used in the BASIC program in the specified task area Input format shortcut for the comman
27. so that the system always operates normally when changing the data and control status of the PLC being operated from a peripheral device Moreover determine in advance how the system handles with communication errors by poor cable connection etc that may occur when performing online operations on the PLC CPU from a peripheral device A CAUTION e Please read this manual thoroughly and confirm the safety before starting online operations especially forced outputs and operating status modifications performed by connecting a peripheral device to the operating CPU module Incorrect online operations may cause damage to the machinery or result in accidents REVISIONS The manual number is given on the bottom left of the back cover Print Date_ Manual Number Apr 2000 _ SH NA 080091 A Sep 2000 SH NA 080091 B e C 7 3 Japanese Manual Version SH 080001 A This manual confers no industrial property rights or any rights of any other kind nor does it confer any patent licenses Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual 2000 MITSUBISHI ELECTRIC CORPORATION INTRODUCTION Thank you for purchasing the MELSEC Q A series PLC Before using the equipment please read this manual carefully to develop full familiarity with the functions and performance of the Q A
28. system mode execution mode 2 or changes back to debug mode OS information pores Displays usage statuses of events message ports resources that can be EXIT HELP Displays the main menu screen on the debugger terminal Displays the list of debug commands function overviews and command input formats x1 These commands cannot be executed on tasks in which compiled BASIC programs reside Section 5 2 6 Section 5 3 1 Section 5 3 4 Section 5 3 5 ion 5 4 1 ion 5 4 2 Section 5 4 3 ec Section 5 5 1 Section 5 5 2 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 2 Operations for Controlling the Operation of BASIC Programs This section explains how to use each of the debug commands for controlling tasks and the operating procedure to control the operation of BASIC programs 5 2 1 Displaying the Status of the Specified BASIC Program TSTATUS Command This operation displays the status of the BASIC program in the specified task area Input format shortcut for the command TS When specifying one of the task areas TSTATUS SP Task No Command When specifying all the task areas TSTATUS Command Operation example Display the status of the BASIC program in the area of task No 1 Before input y After input D gt TSTATUS 1 TASK NO STATUS PRIORITY STEP NO 1 WAIT 1 150 Description THS T A T U Ss 1 Enter the TSTATUS command to order to display the status of a BASIC progr
29. task size is increased the following tasks should be performed once again when saving a BASIC program to the execution area of a memory card EEP ROM flash ROM MSAVE command after the completion of editing and debugging 1 All the executable programs should be saved again in the execution area of the memory card 2 The set data of the multitask settings should be changed accordingly Set each task size in such a way that the maximum 8 units of executable programs can be saved within the executable program area size specified when the target memory card was formatted 3 About debugging BASIC programs after the START command execution Debug BASIC programs in edit mode 1 according to the method explained in the programming manual The debug commands listed in Chapter 4 cannot be used 4 Reference e Operation for saving task area information from the main memory to a memory card MSAVE command Section 4 3 2 Operation for changing the mode of the communication module GO command Section 4 5 2 Operation for ending the interpreter operation in the specified task area TKILL command Section 4 6 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 5 2 Changing the Mode of the Communication Module to Execution Mode System Mode GO Command This operation changes the mode of the communication module from system mode to execution mode debug mode execution mode 2 or changes it back to system mode By changing to debug mode
30. the CHAIN instruction The program edit function by program merge and delete Prepare a program already edited that has been merged and surplus code deleted Execution from a specified line number Pass the line number to the program using the GETMEM and PUTMEM instructions and use the value to jump to the target line number by the ON GOTO instruction Passing variables by the ALL options Pass variables to the program using the GETMEM and PUTMEM instructions CLEAR The CLEAR instruction is ignored e The instruction is Ignored at compilation instruction COMMON The COMMON instruction is not supported e Pass variables to the program using the e A not supported error is generated at GETMEM and PUTMEM instructions compilation 7 CREATING PROGRAMS USING A COMPILER Instruction function COS m mn 0 ies m gt MELSEC Q Specifications different from the interpreter Reference page in Mee Corrective action restrictions and precautions the Commands The CONT instruction is not supported A not supported error is generated at compilation If lt numerical expression gt contains a double precision real number a double precision value is returned otherwise a single precision value is returned The CSNI instruction does not check overflow Double quotation marks can be used only as symbols to enclose a string constant in the DATA instruction If one of a pair is missing everythin
31. the left shows the display when the interpreter has already been started Cee 1 About the size specification e Sizes can be specified in hexadecimal digits amp H instead of decimal digits 4 ONLINE PROGRAMMING OPERATION MELSEC Q SYSTEM 5 Perform one of the following operations when the editing debugging of the BASIC program is completed and the communication module is returned from edit mode 1 to J system mode Pess n S Execute the SYSTEM instruction of BASIC program to stop Pads aA e The execution of the BASIC program is stopped All open files and communication lines are closed Press D e The execution of the BASIC program is stopped e Open files and communication lines are kept open e If the BASIC program whose execution was stopped did not require modification its execution can be restarted continued with the CONT instruction of the Basic program when the START command is used to change the mode to edit mode 1 again see 2 Precautions when using the START command e In cases where a BASIC program is edited debugged in a task area that falls into one of the categories listed below and the task size must be changed the operation of the interpreter in the target task area should be terminated using the TKILL command before entering the START command 1 Task areas whose multitask settings have been specified 2 Task areas where BASIC programs are already stored In addition if the
32. to perform the multitask debugging described in this chapter Perform each operation beforehand according to the explanation in the applicable chapters sections below Setting the switches of the communication module for debugging See Chapter 2 Connecting the debugger terminal See Chapter 2 Creating and debugging each individual BASIC program See Chapter 4 Saving the programs to a memory card See Section 4 3 2 e Specifying multitask settings See Section 4 4 1 4 Precautions when entering the debug commands If the debugger function an OS that analyzes and executes debug commands cannot immediately process a command the user has entered the debugger function suspends operation until the processing can be resumed The next debug command can be entered after D gt is displayed again 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 1 Debug Command List Table 5 1 lists the debug commands used in multitask debugging operations Table 5 1 Debug Command List he de System i 3 Classification Function overview QD51 i command A1SD51S section R24 7 idino in th if k TSTATUS 1 Displays the status of the BASIC program residing in the specified tasi Section 5 2 1 area TRUN 1 Starts executing the BASIC program residing in the specified task area Section 5 2 2 Stops executing the BASIC program currently being executed in the Section 5 2 3 specified task area an ec TCONTINUE Resumes executing the BASIC progra
33. variable is specified for the input destination variable in the LINE INPUT instruction Specify a string variable as the storing destination variable line number not found line number or label not found Syntax error There are no line numbers in a source program Syntax error e There is no line number or label after GOTO or GOSUB An illegal label name is used in connection with THEN ELSE RETURN RESUME and RESTORE instructions Add the line numbers e Specify line numbers and labels e Specify a correct label name App 4 App 4 APPENDIX MELSEC Q line number XXXXX not sequential Syntax error The line numbers in a source program are not in ascending order Corrective action Change the line numbers in such a way that they are in ascending order missing operand Syntax error An argument or expression does not exist where it is necessary Specify the missing argument or expression NEXT without FOR Syntax error compiler restricted item NEXT without corresponding FOR was detected Specify the corresponding FOR ON line number or label not found Syntax error There is a syntax error in the sequence of line number or label in the ON XX GOSUB GOTO instruction Make the appropriate correction to the program according to the format ON string expression not allowed Syntax error A string expression is used in the lt expression gt i
34. 17 or more lines e The screen can display a maximum of 16 lines of word information Press any key other than to display word information of the following device number if it is specified to display 17 or more lines of values Press if you want to stop displaying bit information 3 Reference e Operation for checking values of specified memory address specification MREAD command Section 5 3 1 e Operation for writing values to specified memory address specification MWRITE command Section 5 3 2 e Operation for writing word information to extension registers ED W command Section 5 3 6 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 6 Writing Word Information to Extension Registers ED W Command This operation writes word information values to extension registers ED used by BASIC programs for data communication Input format shortcut for the command none Ce EL Command Device name Operation example Write the word information OAn 14 1EH to EDO to ED2 Before input D gt D 0o H Device name Starting number H Enter After input D gt W ED 0 EM0000 0000 000A EMO0001 0000 0014 Writing to ED2 3804 to 3805 EM0002 0000 001E EM0002 0000 Her Write end Description w H e H H E H D H 1 Enter the W command to write word information to ED and the type of internal device ED D gt W ED S
35. 54 as a result of changing the number of characters in one line or reassigning line numbers to a source file 3 About syntax error of a program Line numbers may not be reassigned properly on the lines that caused the errors if syntax errors or similar occur 4 About situations where line number cannot be reassigned Please be cautious in the following cases where line number cannot be reassigned a Line numbers of other programs The line number of execution start for the CHAIN instruction Example CHAIN MERGE 0 A BAS 200 ALL DELETE 500 1000 Not reassigned Reassigned However the line numbers in the DELETE option are reassigned b Line numbers for instructions that cannot be used in a program Line number of instructions AUTO DELETE LIST LLIST MERGE and RENUM Example LIST 100 Not reassigned c About handling errors caused by the line numbering tool The source file is processed according to the following if a line number change operation is forcefully stopped while the line numbering tool is being run or the reading writing or renaming of a file failed due to I O error etc e If the processing has not reached renaming of a source file the source file remains as is e Ifa source file has already been renamed the source file remains as is d About temporary work files used by the line numbering tool The file names shown below are reserved for files that are temporarily created by the line numbering tool T
36. BASIC program file In a general purpose editor EOF is normally appended automatically if no specific action is taken 3 About control codes in a program If a program contains control codes it does not work as a normal program 4 About description of the PRINT instruction The PRINT command can be expressed by the abbreviation but this abbreviation cannot be used in a general purpose editor 5 About assigning line numbers Assign line numbers from the start line in ascending order 6 About the number of characters in one line The maximum number of characters that can be contained in one line is 254 Here one line refers to until the end of the line 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR MELSEC Q 6 5 Addition of Line Numbers Using the Line Numbering Tool This section explains how to start up the line numbering tool and the precautions on the use The line numbering tool is provided with the type SW1IVD AD51HP SW1NX AD51HP AD51H BASIC software package 6 5 1 Starting up the Line Numbering Tool It is necessary to start up the line numbering tool in order to add or modify line numbers in a program created using a general purpose editor It is explained below how to start the line numbering tool and specify each option DRENUM s XXX t XXX i XXX e XXX source file name BAS output file name S XXX t XXX i XXX e XXX Source file name Output file name Specif
37. BASIC program stops executing e Open files and communication lines are kept open e If the BASIC program whose execution was stopped did not require modification its execution can be resumed with the debug command TCONTINUE Furthermore the execution can be resumed using the BASIC instruction CONTINUE when the mode of the communication module is changed to edit mode 2 the next time 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q eee SSS ee s_ 444 SS 1 Precautions when using the START command e The execution should be stopped using the TSTOP command if a BASIC program is being executed in the task area where the editing is going to take place 2 Operation of other BASIC programs when the START command is executed e If multiple BASIC programs are being executed and program editing is started in any task area with the START command the BASIC programs in the other task areas will be continuously executed 3 Required processing when it is necessary to change the task size of the specified task area Change the mode of the communication module to edit mode 1 using the following method 1 Return the communication module to debug mode using the BASIC instruction SYSTEM 2 Stop the execution of the BASIC programs in each task area with the STOP command so that they will not interfere with the system control 3 Change the mode of the communication module to system mode with the GO command 4 End the operation of the interpreter in
38. CARD 1 Junder the following conditions Before input Command Memory card interface No Cc F O R M A T SP 0 U After input Card name S gt CFORMAT 0 TASK DTM 8 6 0 2 ie dre i aero Naneto BER aBSIOEATO FORMAT Y N Y per the memory card FORMAT OK 3 ly S aa Ta Capaci oi ine momen S gt card 8 units of 64 K bytes Overall size program area in the memory Hen 5 eee Size of executable program area card 8 units of 64 K bytes or Ne the memory card File area size 2 units of 64 K bytes a g Format specification Description C F O R H M A T 1 Enter the CFORMAT command to format a memory card Cee 1 Precautions when using the CFORMAT command e If a memory card is formatted all data that was written is deleted e When formatting a memory card that is write protected the write protect should be canceled first e When formatting a memory card mounted in MEMORY CARD E the memory protection key switch of the AD51H S3 module should be turned off first 4 ONLINE PROGRAMMING OPERATION ogee 2 S gt CFORMAT 0 HH S gt CFORMAT 0 TASK DTM 4 S gt CFORMAT 0 TASK DTM 8 5 S gt CFORMAT 0 TASK DTM 8 6 i S gt CFORMAT 0 TASK DTM 8 6 0 MELSEC Q Enter the number of the memory card interface in which the memory card to be formatted is mounted followed by a colon Only 0 or 1 can b
39. N Y RECOVER OK S gt Description C R E C o V E 1 Enter the CRECOVER command to recover a file area of a memory card S gt CRECOVER 2 Enter the memory card interface number of the memory card whose file area is to be recovered followed by a colon S gt CRECOVER 0 Only 0 or 1 can be specified for the memory card interface number 0 The MEMORY CARD 1 drive on the AD51H S3 1 The MEMORY CARD 2 drive on the AD51H S3 In the example figure to the left the memory card mounted on MEMORY CARD 1 is specified 4 ONLINE PROGRAMMING OPERATION Pe 3 S gt CRECOVER 0 RECOVER Y N Y 4 S gt CRECOVER 0 RECOVER Y N Y RECOVER OK S gt 5 MELSEC Q The screen displays RECOVER Y N Enter LY to recover Enter N to stop recovering The console returns to waiting for a system command entry In the example figure to the left recovery is specified The screen displays the result of the command execution in the succeeding line If the command ends normally RECOVER Ok is displayed If the command ends abnormally an error message or similar is displayed In the example figure to the left a display where the command ends normally is shown S gt is displayed in the line following the command execution result Enter the next command 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 10 Formatting Logical Format the File Area of a Memory Card FFORMAT Command Fo
40. NG DEFDBL and DEFSTR instructions Check the content of a program and make the appropriate correction to the program DEF what Syntax error There is a syntax error in the DEF instruction Check the content of a program and make the appropriate correction to the program DIM syntax error Syntax error There is a syntax error in the DIF instruction Check the content of a program and make the appropriate correction to the program divide by 0 Illegal parameter Somewhere in a numerical expression a value is divided by 0 MOD Correct the program in such a way that there is no division by 0 Note The compiler detects only division between constants Division by 0 at execution does not cause an error but returns the maximum number Single precision 1 70141E 38 Double precision 1 70141183460469D 38 expression too complex Compiler restricted item A numerical expression of real number is too complicated Make the expression less complicated by assigning an intermediate value of the expression to a variable etc FOR syntax error Syntax error e There is no assignment statement for a control variable or initial value in the FOR NEXT instruction A string variable is used as a control variable by mistake Specify the control variable or initial value correctly FOR without NEXT App 3 Syntax error The NEXT corresponding to a FOR cannot
41. NG instructions PRINT USING statement PRINT USING instructions 42 RDSET e The compiler does not check array subscripts Check the range using the IF instruction 11 304 ranges and bit ranges before the RDSET function and generate an error using the ERROR instruction if necessary 7 CREATING PROGRAMS USING A COMPILER MELSEC Q F Specifications different from the interpreter Reference page in No Instruction function sine Corrective action restrictions and precautions the Commands 43 READ When reading a decimal constant the Make sure to read correctly instruction does not cause overflow even if the constant exceeds the maximum real number and returns the maximum real number When reading octal and hexadecimal constants the instruction does not cause overflow even if the constant exceeds the maximum integer value and returns the maximum integer value It the type of variable in the READ instruction and the value defined in the DATA instruction do not match a Syntax error occurs on the READ instruction side There are cases where an error is not generated For example 10 DATA amp H000012 20 READ A An error does not occur 30 DATA amp H12X 40 READ A An error occurs If an error occurs the data following the data that caused the error is read 44 RENUM e The RENUM instruction is not supported 11 308 RENUM can be used as a variable name RESTORE e The use of line number 0 is pro
42. OPY Y N Y COPY OK S gt Description L gt c H c o p P Y 1 Enter the CCOPY command to copy the contents of a memory card to another memory card S gt COOPY t input procedure and input method of the commands and parameters shown in the operation example in the order from 1 to n This shows the key input sequence This is an image of the screen after the key input 1 Precautions on using the CCOPY command Format the memory card mounted in the drive on the copy destination using the CFORMAT command before copying The capacity of the memory cards in the copy source and destination drives must satisfy the following relationship Capacity of copy source memory card lt Capacity of copy destination memory card This is a description of items that the user should know when using the command and commands related to the command being explained MELSEC Q The command name is shown here Operation performed by the command and a description The key input sequence for performing the operation is shown here The key input when using the command is shown here This is a description about the key input 3 COMMAND EXPLANATION FORMAT MELSEC Q MEMO 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 ONLINE PROGRAMMING OPERATION Online programming refers to editing and debugging BASIC programs as well as loading and saving BASIC programs from to memory cards user made flo
43. PERATIONS MELSEC Q D gt ZSTATUS E 2 The result of the command execution is displayed in the No EN DI ON OFF No EN DI ON OFF succeeding line 0 DISABLE OFF 1 DISABLE OFF 3 DISABLE OFF 4 DISABLE OFF If the command ends normally the even enable disable 6 DISABLE OFF 7 DISABLE OFF declaration status corresponding to each of the event 9 DISABLE OFF 10 DISABLE OFF bers from 0 to 63 is displayed from th dina li 12 DISABLE OFF 13 DISABLE OFF numbers from 0 to 63 is displayed from the succeeding line 15 DISABLE OFF The descriptions of the displayed information are as follows EN DI ON OFF Meaning column column The event corresponding to the number is ENABLE ON defined and declared to be enable The event corresponding to the number is ENABLE OFF defined but not declared to be enable The event corresponding to the number is DISABLE ON defined and declared to be disable The event corresponding to the number is not defined DISABLE OFF If the command ends abnormally Error message and an error code are displayed in the succeeding line In an example figure to the left a display where the command ends normally is shown 3 D gt is displayed in the line following the command execution result Enter the next command 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 4 2 Displaying the Status of Transmission to Message Ports STATUS Command This operation displays the transmission status of curren
44. Q XXXXX redimensioned array Compiler restricted item Array change XXXXX is declared twice Corrective action Make the appropriate correction to the program so that the array is not redefined XXXXX string variable expected Illegal parameter A string variable is required but a different data type is specified in a statement XXXXX Specify a string variable XXXXX undefined function Syntax error An undefined FN function is called Define the function or specify a defined function XXXXX undefined label Syntax error A non existent label XXXXX is referenced by the GOTO GOSUB instruction Change to a correct label XXXXX undefined line number Syntax error A non existent line number XXXXX is referenced by the GOTO GOSUB instruction Change to a correct line number XXXXX undefined variable Compiler restricted item An undefined variable is referenced XXXXX expected X expected Syntax error XXXXX or X is required but something else is specified Specify correctly XXXXX not supported Compiler restricted item XXXXX uses a statement function that is not supported by the compiler Make the appropriate correction to the program so that the unsupported instruction function is not used App 9 App 9 APPENDIX MELSEC Q 3 Warnings STOP assumed tobe END The compiler compiles the STOP instruction assuming it is the END
45. SP 0 a 5 1 Copy source Copy destination memory card memory card Ly interface No interface No pe A S gt CCOPY 0 1 V Matching Specifying copy COPY Y N Y COPY OK S gt Description C H C H Oo H P H v 1 Enter the CCOPY command to copy the content of a memory card to another memory card S gt CCOPY 1 Precautions on using the CCOPY command Format the memory card mounted in the drive on the copy destination using the CFORMAT command before copying e The capacity of the memory cards in the copy source and destination drives must satisfy the following relationship Capacity of copy source memory card lt Capacity of copy destination memory card 4 ONLINE PROGRAMMING OPERATION MELSEC Q se H 0 H H H 1 H 2 Enter the memory card interface number followed by a colon for both the copy source and destination Enter the copy S gt CCOPY 0 1 source first then the copy destination Only 0 or 1 can be specified 0 The MEMORY CARD 1 drive on the AD51H S3 1 The MEMORY CARD 2 drive on the AD51H S3 In the example figure to the left the contents of a memory card in MEMORY CARD 1 are copied to a memory card in MEMORY CARD 2 H V H Enter 3 Specify V if it should be checked that the contents of the j copy source and destination match after the copying S gt CCOPY 0 1 V Press Enter if it is not required to check that the contents match I
46. SS OU 1 About writing to ED internal devices e Writing to ED internal devices can also be performed by the debug command MWRITE 5 MULTITASK DEBUGGING OPERATIONS 0 Enter D gt W ED 0 Mi gee Ce D gt W ED 0 ED0000 0000 Pisa nos ae ee a E EHe D gt W ED 0 ED0000 0000 000A 0 0 1 4 Enter D gt W ED 0 ED0000 0000 000A ED0001 0000 0014 D gt W ED 0 ED0000 0000 000A ED0001 0000 0014 ED0002 0000 001E MELSEC Q Enter the starting number of the ED range to which the word information is written using a decimal number up to 4 digits 0 to 1023 In an example figure to the left EDO is specified The result of the command execution is displayed in the succeeding line If the command ends normally the specified device number and the word information are displayed as shown below Enter the word information to be written using a hexadecimal number up to 4 digits only valid digits can be ee Enter the word information to be written using a hexadecimal number up to 4 digits Te word information stored in the device number to the left is displayed as a 4 digit hexadecimal number The number is displayed Word information to be displayed or written 6 rep a Pe TAI Address mi 2 3 4 EDnH nH 34 H f n 1H 12 H ae The following keys are used in the word information write operation 0 to 9 A to F Used when entering word informatio
47. Specify a format string PRINT USING illegal parameter Syntax error There is a syntax error in the sequence of display data in the LPRINT PRINT USING instruction Limited to 8 data items in the compiler Make the appropriate correction to the program according to the syntax PRINT USING too many parameters Compiler restricted item There are too many display data items lined up for the LPRINT PRINT USING instruction Limited to 8 data items in the compiler Divide the PRINT USING statement into several PRINT USING instructions RESTORE line number or label not found Syntax error A line number label is required after RESTORE but something else is specified Specify a line number or label RESUME syntax error Syntax error There is a syntax error in the RESUME instruction Make the appropriate correction to the program according to the format statement expected STEP string expression not allowed App 6 Syntax error An assignment statement or instruction statement is required at the beginning of a sentence but something else e g a function constant symbol is specified Syntax error A string expression is used as the increment value indicated by STEP in the FOR NEXT instruction Modify the program and place assignment statement or instruction at the beginning of the sentence Make the appropriate correction to the program according to the fo
48. T 1 48 AD51H BASIC ON LINE PROGRAMING Ver _i OK Me oe eee Or OK We So eS 3 4 MELSEC Q Enter one of the following numerical values in order to set change the task size of the target task area in K byte units 16 32 48 64 The task size entered here will be the size set in the automatic multitask setting which is specified when saving the contents of the target BASIC task area to a memory card EEP ROM with the MSAVE command after the completion of the BASIC program editing debugging Make sure to enter the task size if a BASIC task number whose multitask settings have not already been specified has been selected Also make sure to enter the task size if the multitask settings have already been specified but the task size change is required Simply press if the task size already set is not to be changed In the example figure to the left the task size of the area of BASIC task No 1 is set changed to 48 K bytes The screen displays the result of the command execution If the command ends normally the display shows in the figure to the left the BASIC program can be edited debugged The operating procedure for editing debugging BASIC programs is explained in the AD51H BASIC Programming Manual If the command ends abnormally an error message or similar is displayed in the succeeding line The upper figure to the left shows the display when the interpreter has not been started The lower figure to
49. This operation loads an executable program from the specified BASIC task area in a memory card EEP ROM lash ROM to the specified BASIC task area of the communication module Input format shortcut for the command ML When checking that the contents of the load source and destination match after loading uono sP ease reene Hv Matching Command MLOAD sp BASIC task No Enter Command When simply loading Operation example Load the executable program in the area of BASIC task No 1 of the memory cards executable program area into the area of BASIC task No 1 of the AD51H S3 and check that their contents match eee rer pane Bier Command PASIG task Matching Program area of y AD51H S3 Specify loading Before input U After input S gt MLOAD 1 V Memory card LOAD Y N Y LOAD OK S gt OS area Area of BASIC task No 1 Executable program area Be ee TE File area 1 Target memory card The target memory card of the MLOAD command should be the memory card mounted in MEMORY CARD 1 of the AD51H S3 4 ONLINE PROGRAMMING OPERATION Description MH LH OK AH DH sP 1 S gt MLOAD S gt MLOAD 1 iy H vH Enter 3 S gt MLOAD 1 V i MELSEC Q Enter the MLOAD command to load an executable program from a memory card EEP ROM flash ROM into the executable program area of the communication module Enter the BASIC ta
50. a and file area If all the remaining area excluding the OS area in the executable program area of the memory card is divided into eight BASIC task areas and each area has the same capacity the maximum capacity of one area is approximately 48 K bytes e Sizes can be specified in hexadecimal digits amp H fir if i 1 or binary digits amp BI_ if jtof 4 instead of decimal digits 3 About logical formatting of a memory card When the SET or MSAVE commands are executed for the first time the executable program area of the memory card is logically formatted e Use the FFORMAT command for logical formatting of the file area 4 Reference e Operation for displaying formatting information of a memory card CFORMAT command Section 4 2 3 va li ika 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 2 3 Displaying Formatting Information of a Memory Card CFORMAT Command For AD51H S3 Only This operation displays the formatting information of a memory card mounted in MEMORY CARD 1 or 2 on the AD51H S3 module Input format shortcut for the command CF CFORMAT SP Memory card interface No i Enter Command Operation example Display the formatting information of a memory card mounted in MEMORY CARD 1 of the module Before input S gt C F O R M A Command YV 0 After input Memory card S gt CFORMAT 0 interface No Card Name TASK DTM Card Size 512K bytes Program Size 384K bytes
51. afa MITSUBISHI ELECTRIC MELSEC Q Programmable Logic Controllers Programming Manual Debug and Compile QD51 R24 A1SD51S AD51H S3 Art no 142093 ta MITSUBISHI ELECTRIC INDUSTRIAL AUTOMATION 01 09 2000 SH 080091 B e SAFETY PRECAUTIONS e Always read these instructions before using this equipment Before using this product please read this manual and the relevant manuals introduced in this manual carefully and pay full attention to safety to handle the product correctly The instructions given in this manual are concerned with this product For the safety instructions of the programmable controller system please read the CPU module user s manual In this manual the safety instructions are ranked as DANGER and CAUTION 7 Nn 1 N l Indicates that incorrect handling may cause hazardous conditions l a DANGER resulting in death or severe injury i l l A CAUTION Indicates that incorrect handling may cause hazardous conditions K resulting in medium or slight personal injury or physical damage p Note that the CAUTION level may lead to a serious consequence according to the circumstances Always follow the instructions of both levels because they are important to personal safety Please save this manual to make it accessible when required and always forward it to the end user Design Precautions lt b DANGER e Make sure to configure the interlock line outside the PLC system
52. am 5 MULTITASK DEBUGGING OPERATIONS S gt TSTATUS 1 D gt TSTATUS 1 TASK NO STATUS PRIORITY STEP NO 1 WAIT 1 150 2 MELSEC Q Enter the task number task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area whose status is going to be displayed Simply press if all task areas are to be displayed In an example figure to the left task No 1 is specified The screen displays the result of the command execution in the next line If the command ends normally the status of the BASIC program in the specified task area is displayed in the center of the display If the command ends abnormally TSTATUS Error and an error code are displayed in the succeeding line The following information is displayed when the command ends normally In an example figure to the left the status of the area of task No 1 is displayed e TASK NO Task number of the task area whose status is displayed e STATUS Status of the BASIC program DORMANT The interpreter has not been started in the target area RUN The program is being executed WAIT In waiting status Waiting for a timeout etc STOP The program is not being executed The interpreter is waiting for command entry 1 e PRIORITY Current priority of the BASIC program The value 0 is displayed if STATUS above is DORMANT e STEP ON The current line number being executed The number of the last executed line
53. as P BASIC task area of the communication module O O O control EXIT Displays the main menu screen on the console Section 4 7 Others Displays the system command list function overview and HELP pay y O O o Section 4 8 command input format x1 These commands cannot be executed on tasks in which compiled BASIC programs are stored 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 2 Operating Procedure for Copying Deleting the Contents of Memory Cards For AD51H S3 Only This section explains how to use each of the system commands for controlling the memory cards and the operating procedure to copy and delete the contents of memory cards 4 2 1 Copying the Content of a Memory Card to Another Memory Card Without Change CCOPY Command For AD51H S3 Only This operation creates a backup memory card Input format shortcut for the command CC When checking that the contents of the copy source and destination match after copying ccory se J Copy source memory card interface vo ff H H cow destination memory card interface no H 3 H F H V Enter Command Matching When simply copying CCOPY Copy source memory card interface No ea ee Copy destination memory card interface No ie Command Operation example Copy the contents of the memory card mounted in MEMORY CARD 1 to the memory card mounted in MEMORY CARD 2 Jand check that they match Before input S gt Y
54. as they are It becomes possible to change the mode of the communication module from system mode to edit mode 1 in order to edit debug the BASIC programs in each task area 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q Input format shortcut for the command none When changing the mode of the communication GO Hse R H H D Enter module back to debug mode Command Execution mode Debugger start up When changing the mode of the communication module to execution mode 2 GO SP 2 Enter ommand Execution mode When changing the mode of the communication module to system mode GO SP P one of the programming modes Command Programming mode Operation example Returns the communication module to debug mode Before input D gt a HoH HsH rH HoH 1H enter Command Execution mode Debugger start up specification specification After input J D gt GO R D Rites pu a 1 Enter the GO command to change mode of the communication module R D H Enter 2 Enter a mode Enter R to change the mode of the communication module D gt GO R D to execution mode 2 or debug mode Enter P to change the mode of the communication module to system mode Enter R followed by D to change the mode of the communication module back to debug mode In an example figure to the left the mode of the communication module is changed back to debug mode 2 Precautions when changing mode It is recomm
55. be found The FOR and NEXT instructions do not match Modify the program so that the FOR and NEXT instructions match App 3 APPENDIX MELSEC Q GOSUB not found GOSUB GOTO not found GOTO not found Syntax error GOTO GOSUB cannot be found in the ON XX GOSUB GOTO instruction Corrective action Make the appropriate correction to the program illegal constant Syntax error A character not allowed as a numerical value is used in an octal or hexadecimal constant Make the appropriate correction to the program illegal parameter Illegal parameter e There is an illegal parameter A variable or array name is required but another data type is specified Make the appropriate correction to the program index must be 0 32766 Compiler restricted item In the DIM instruction the value for the array size specification is too large or a variable or expression is used for the size specification Reduce the size Change the size specification to a constant INPUT or not found Syntax error Characters other than or after INPUT lt character gt are placed Make the appropriate correction to the program LINE INPUT not found Syntax error Characters other than INPUT lt character gt are placed after Make the appropriate correction to the program LINE INPUT must be string variable Syntax error A value other than a string
56. column Count column Number of message ports defined by the user Shows the type of the corresponding message port PRI No FIFO specification in the port definition FIFO FIFO is specified in the port definition The byte length specified when defining the message port Number of messages transmitted to the corresponding message port but not received yet If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where the command ends normally is shown D gt is displayed in the line following the command execution result Enter the next command 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 4 3 Displaying the Reserved Released Status of Resource Numbers for Exclusive Access Control ZSTATUS Command This operation displays the reserved released status of resource numbers when access to shared resources such as memory and peripheral devices is limited to one BASIC program at a time by each resource number Input format shortcut of the command ZS zstarus se S Enter Command Resource number specification Operation example Display reserved released status of the current resource numbers Before input D gt zHsHTH aH tHuHsHseH sH Enter Command Resource number specification After input D gt ZSTATUS S Semaphore PESERVE Basic No RELEASE No Description
57. command The operating content when using the command is described here This is an image of the screen before the key input This is an image of the screen after the key input 4 ONLINE PROGRAMMING OPERATION ms NE S C 4 2 Operating Procedure for Copying Deleting the Contents of Memory Cards This section explains how to use each of the system commands for controlling the memory cards and the operating procedure to copy and delete the contents of memory cards 4 2 1 Copying the Content of a Memory Card to Another Memory Card Without Change CCOPY Command 4 This operation creates a backup memory card Input format shortcut for the command CC When checking that contents of the copy source and destination match after copying lt 4 oor seJ Copy source memory card interface No H H copy destination rmemoty card meraco no H il v Enter Command Matching When simply copying COOPY SP 4 Copy source memory card interface No P Copy destination memory card interface No Enter Command Operation example Copy the contents of a memory card mounted in MEMORY CARD T to a memory card mounted in MEMORY CARD 2 and check cH cho eh yHse oH Hs Command Copy source Copy destination memory card memory card Permou CHH CH Before input Description describes the S gt COOPY 0 1 V Matching Specifying copy C
58. command is automatically terminated if the address of device memory to which a value is written exceeds 3FFFu 2 Reference Operation for checking values of specified memory MWRITE command Section 5 3 1 e Operation for checking word information of extension registers ED e Operation for writing word information to extension registers ED W command Section 5 3 5 W command Section 5 3 6 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 3 Displaying Bit Information of General Purpose Inputs X General Purpose Outputs Y Extension Relays EM B Command This operation displays bit information of general purpose inputs X outputs Y used by the PLC CPU or extension relays EM used by BASIC programs for data communication Input format shortcut for the command none When displaying bit information of general purpose inputs X Number of eo Hee Command Device name When displaying bit information of general purpose outputs Y Number of e HH Hoes nn ea Command Device name When displaying bit information of extension relays EM Number of e OEC Bene Command Device name Operation example Display bit information of EM16 to EM47 Before input i G66 20 0 8 Command Device name Starting number CHE Numter of points displayed After input D gt B EM 16 32 EM0016 00000000 00000000 EM0032 00000000 00000000 D gt i 1 About general purpose
59. correction to the program so that the calculation expression can be evaluated syntax error at end of statement Syntax error There is a reserved word symbol or expression at the end of a sentence Make the appropriate correction to the program according to the format of the instruction or function syntax error in expression syntax error in function parameter list Syntax error There is a syntax error in an expression Syntax error There is a syntax error in the parameter list of the FN part of the DEF FN function Make the appropriate correction to the program in a correct format Make the appropriate correction to the program according to the format of the function syntax error in parameter App 7 Syntax error There is a syntax error in the sequence of statement function arguments Make the appropriate correction to the program according to the format of the instruction or function App 7 APPENDIX MELSEC Q syntax error in string Syntax error Corrective action Make corrections to the program so that an appropriate expression There is a syntax error in a string operator can be used expression An operator that cannot be used for a string expression is used THEN GOTO not found Syntax error Make the appropriate correction to the program to include There is no THEN GOTO after a conditional statement in the IF instruction THEN or GOTO TO str
60. cuted BASIC programs in each task area stop being executed EE 1 Status of each BASIC program due to execution of the GO command If execution mode 1 is specified each BASIC program starts executing in the same way as if the communication module was started up by setting mode switch 1 of the communication module from 0 to 3 e If programming mode is specified the BASIC programs in each task area stop being executed The memory status of each task area in the main memory has not changed so the BASIC programs in each task area remain as they are 4 ONLINE PROGRAMMING OPERATION MELSEC Q Input format shortcut of the command None When changing the mode of the communication module to the debug mode ao Hse n Hol ener Command Execution mode Start up the debugger When changing the mode of the communication module to the execution mode GO SP R Enter Command Execution mode Operation example Change the mode of the communication module to debug mode Before input s Ce HoH ene Command Specification to start up the debugger Execution mode specification After input S gt GO R D san eee a The content of the display is deleted Description 1 Enter the GO command to change the mode of the communication module R D Enter 2 Enter the mode Enter R to change to execution mode S gt GO R D Enter R D to change to debug mode In the example figure to th
61. d none Sequence of i expressions T SP Task No Enter Command Operation example Display the current values of variables A and B used in the BASIC program in the area of task No 1 whose execution has been stopped Before input D gt T 1 A B Command Task No Sequence of expressions U After input D gt T 1 A B 51H 123 D gt Description 1 Enter the T command in order to display the values of the variables along with the task number task No 1 to 8 can be D gt T 1 specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area where the target program resides In an example figure to the left the BASIC program in task No 1 area is specified A H H H B H H Enter 2 Enter the name of the variables you want the values to be displayed D gt T 1 A B The variables can be specified as numerical or string expressions in the same way as for the BASIC instruction PRINT Moreover several variables can be displayed by separating the expressions by comma or semicolon In an example figure to the left it is specified to display the values of A and B T SP 1 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 3 The screen displays the result of the command execution in D gt T 1 A B the succeeding line 51H 123 If the command ends normally T and the values of the D gt specified variables etc are displayed If th
62. ddress to the left is displayed as a 2 digit hexadecimal number The address is displayed In case of word units the display shows as follows enter the value to be written using a hexadecimal number with 4 digits or less only valid digits can be entered Enter the values to be written as a hexadecimal number for two addresses starting with the one shown to the left are displayed as 4 digit hexadecimal numbers Tt The values currently stored in the two addresses Ti ai he address is displayed Address nH 34 H n 1H Values to be displayed or written e nn aA The following keys are used in the write operation 0 to 9 A to F Used to enter the values to be written Used to write the entered values to device memory Used when backing up the target address Used when executing entries made using the keys above Used when the value currently stored in memory is not to be overwritten If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where values are written to memory addresses 3800H to 3805H EDO to ED2 in word units successfully is shown 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 4 When writing to device memory is completed D gt is displayed Enter the next command Cee 1 Operation when exceeding memory range of target device e The processing of the MWRITE
63. de setting switch 1 of the communication module is set communication module is set communication module is set to qa to Wong to 0 1 a Enter GO R Execution mode Enter System mode Debug mode Ba Enter Enter SYSTEM Enter SYSTEM or press or press START Ctrl D START Ctrl D Edit mode 1 System command Debug command Programming BASIC command mode MELSEC Q 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE MELSEC Q 1 Programming mode 1 The user can edit debug load save from to a memory card and specify multitask settings for each BASIC program 2 There are two modes in programming mode for performing the operations above system mode and edit mode 1 2 System mode 1 This is the mode that is changed to when the communication module is started up by setting mode setting switch 1 to 4 or when the GO command GO P is entered by the debugger in debug mode 2 Theconsole is controlled by the operating system OS of the communication module 3 Itis possible to perform the following operations for each BASIC program by entering system commands from the console described in Chapter 4 Display on the console S gt Load and save BASIC programs from to a memory card mounted on MEMORY CARD of the AD51H S3 and the EEP ROM s executable program area of the A1SD51S e Specify multitask setti
64. debug each BASIC program while executing multitasking by entering debug commands from the debugger described in Chapter 5 Debugger terminal D gt Control the execution of the specified BASIC programs Input output data to from memory and devices accessible from BASIC programs Change to other modes etc 6 Edit mode 2 1 This is the mode that is changed to when the START command is entered from the debugger in debug mode Tasks other than the task specified by the START command continue their multitask processing 2 The debugger is controlled by the interpreter 3 Itis possible to modify any BASIC program while executing other BASIC programs by entering instructions functions of AD51H BASIC from the debugger Display on the console OK Cursor position 3 COMMAND EXPLANATION FORMAT 3 COMMAND EXPLANATION FORMAT The following format is used to explain each command The title of each command classification is listed here The operating content when the command is used is described here Input format describes the sequence of commands and parameters This indicates a short cut key when entering the command from the keyboard In this case if the abbreviation key input CC is entered the same processing as if the CCOPY command were called will take place In the operation example an example of the key input procedure and the screens displayed is shown when using the
65. displayed in the line following the command execution result Enter the next command ESNS 2 Reference Operation for saving information from BASIC task areas in the communication module to a memory card EEP ROM flash ROM MSAVE command Section 4 3 2 Operation for specifying the multitask settings change the already set data SET command Section 4 4 1 Operation for changing the mode of the communication module to the edit mode 1 START command Section 4 5 1 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 5 Operating Procedure for Changing the Mode of the Communication Module This section explains how to use each of the system commands for controlling modes and the operating procedure to change the mode of the communication module 4 5 1 Changing the Mode of the Communication Module to the Edit Mode 1 START Command This operation allows the user to edit and debug each of the BASIC programs Input format shortcut for the command ST When setting changing the size of the target task area START Basic task No Task size Enter Command When the size of the target task area is not to be changed start H SP H Basic task No H Enter Command Operation example 1 Start editing a new BASIC program in the area of BASIC task No 1 The size of the area of task No 1 is set to 48 K bytes Before input S gt Task size After input S gt START 1 48 Eea e a a U OK lt _ __ lf t
66. dure for Loading Saving Executable Programs eccecceseeeeceeseeeeceeeesineeeeeeeeeeaes 4 10 4 3 1 Loading Executable Programs to the Communication Module from a Memory Card EEP ROM Flash ROM MLOAD Gomimand a a a teen eak in ee eal ta es 4 10 4 3 2 Saving Executable Programs to a Memory Card EEP ROM Flash ROM from the Communication Module MSAVE Command ceccesceeeeeeeeeeeeeeeecaececeeaecaecaeseeeeaecaeseeeeaeeaeeaesaeseaeeaesaeseeseaesaesaeeeeseas 4 13 4 4 Operating Procedure for Specifying Multitask Settings Changing Set Data and Displaying SEPDI i A a tus seMacsul evasthucavasawhsevas sv sevasew de caasvhsovassul devas bhcaginaadedaasebecdasceucevasevts 4 16 4 4 1 Specifying Multitask Settings and Changing Set Data SET Commannd ccceeseteeeseeteees 4 18 4 4 2 Displaying Set Data for Multitask Settings SET Command ecceeceeeeeeeeeteeeeeeeeeeeeeeeeaeeaes 4 21 4 5 Operating Procedure for Changing the Mode of the Communication MOdUule scsccsesseeseees 4 25 4 5 1 Changing the Mode of the Communication Module to the Edit Mode 1 START Command 4 25 4 5 2 Changing the Mode of the Communication Module to Execution Mode System Mode GO Command eee ite ids ontario ns A eh eae inetd tet a an ia tee es 4 29 4 6 Ending the Interpreter Operation in the Specified Task Areas TKILL Command eeseeeee 4 32 A 3 A 3 4 7 Operating Procedure for Displaying the Main Menu Scr
67. during online programming Reference section Section CCOPY card without change Creation of a memory card for Joi backup Si Section CFORMAT Formats physical format a memory card 4 2 2 Memory card T F ae O x x Section control CFORMAT Displays formatting information of a memory card 42 3 4 R file area in the unusable status to the usable CRECOVER N Section 4 9 status Section FFORMAT Formats logical format the file area of a memory card 410 Loads the contents of the specified BASIC task area in a Section MLOAD memory card EEP ROM to the target BASIC task area of Executable De 4 3 1 the communication module program iforna Saves the contents of the specified BASIC task area of the iitrol MSAVE communication module to the target BASIC task area of a Section memory card EEP ROM The multitask settings are 4 3 2 automatically specified Section SET Changes the multitask settings Multitask 9 9 4 5 4 4 1 setting control Section q SET Displays the specified data of the multitask settings 4 4 2 Changes the mode of the communication module from x1 A tae Section START system mode to edit mode 1 For editing and debugging O O O 454 Mode control each program i Go Changes the mode of the communication module from Section system mode to execution mode 2 or debug mode O O O 4 5 2 Interpreter 4 Nae TKILL 1 Ends the operation of the interpreter in the specified Section
68. e In this case the integer values can be explicitly converted to real numbers using the CSNG and CDBL functions 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 7 How to Run a Program in the Communication Module In order to run a compiled program in the communication module it is necessary to register the program to the executable program area of a memory card EEP ROM flash ROM The procedure for registration to a memory card EEP ROM flash ROM is shown in the following MSAVE lt task number gt V lt file name gt location or MSAVE lt task number gt V Task number Specify the BASIC task number in the executable program area AD51H S3 1 to 8 A1SD51S QD51 R24 1 or 2 V Specify whether or not to check if the contents match After the writing is completed it will be checked if the contents of the main memory and the memory card EEP ROM flash ROM match File name Specify the name of the compiled file EXE to be read to the main memory Location Specify a location to which the task is assigned 0 16 32 multiples of 16 to 368 If this option is omitted the assignment is performed automatically e An Error Location error may occur during the MSAVE operation making the location assignment impossible If this occurs specify an empty location and perform the MSAVE operation Alternatively set the start conditions of all tasks to OFF and perform the MSAVE operations one by one e A System
69. e brackets 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR MELSEC Q 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR This chapter explains how to create BASIC programs using a general purpose editor Please read this chapter and understand the restrictions etc before you start using a general purpose editor 6 1 Difference between the General Purpose Editor and Software Package It is possible to use BASIC programs created in a general purpose editor instead of using the type SW1IVD AD51HP SW1NX AD51HP software package in the communication module As described below BASIC programs are created differently in the general purpose editor and the software package General purpose editor BASIC programs can be edited online Their operations cannot be checked while the programs are being executed Software package BASIC programs can be created either online or offline In online programming it is possible to execute programs and then edit them while checking their operations 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR MELSEC Q 6 2 Flow of BASIC Program Creation Using a General Purpose Editor The flow chart below illustrates the procedure from creation to execution of a BASIC program using a general purpose editor i Select DOS from the basic utility menu 2 Start up the general purpose editor See the manual of the general purpose editor in question for start up method 3
70. e command ends abnormally T Error and an error code are displayed In an example figure to the left a display where the command ends normally is shown It indicates that A contains 51H and B contains 123 4 D gt is displayed in the line following the command execution result Enter the next command Cee 1 Precautions when entering the command e If you specify a BASIC program in the DORMANT status an error occurs The T command including the sequence of expressions must be entered in such a way that the entire command is contained in one line The expression order should furthermore be entered in such a way that the number of characters displayed is 1 024 characters or less It is recommended to place the target BASIC program in the STOP status using the TSTOP command before entering the T command 2 Reference e Operation for checking the status of the current BASIC program TSTATUS command Section 5 2 1 e Operation for stopping the execution of the specified BASIC program TSTOP command Section 5 2 3 e Operation for resuming continuing execution from a line at which execution was stopped TCONTINUE command Section 5 2 4 e Operation for assigning values to specified variables TLET command Section 5 2 6 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 2 6 Assigning Values to Specified Variables in the Specified BASIC Program TLET command This operation assigns values to the specifi
71. e gt ee eet re aa ae a nee Sooo ee ee t The starting The values stored in each of address is the 16 addresses starting from t displayed the one shown to the left in ahora Cote ponding to sequence from the left are the values stored in eac CAN s oa an GSS ai aaa A raa ee aari rail ee E ENST rail byt tat ot prt i far dress are displayed is displayed as 2 digit A headach numbers displayed for On to 1Fn In case of word units the values stored in 16 addresses are displayed in one line as shown below EET ia i T tofi fi kpaa eee eani a bedi tat S ereti aR ACO or EEEa t The starting The values stored in the 16 addresses address is starting from the one shown to the left in displayed sequence from the left are displayed pair wise as 4 digit hexadecimal numbers If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where the command ends normally is shown 4 D gt is displayed in the line following the command execution result Enter the next command 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q CEE 2 Operation when it is specified to display 17 or more lines e The screen can display a maximum of 16 lines of values stored in memory Press any key other than to display values from the subsequent address if it is specified to display 17 or more lines of values Press if you want to stop displaying values stored in memory 3 Ref
72. e in the compiler startup path or the current directory Check that these two files exist XXXX failed error level X The assembler and linker reported an execution error Look up the error message in the manual for the assembler and linker to find the error cause Note When compiling using Microsoft Macro Assembler Ver 4 0 this error occurs if the option 4 is not specified XXXX failed Exec format error The content of the executable file of the assembler and linker is damaged Reinstall the assembler and linker on the hard drive again XXXX failed No such file or directory The assembler and linker cannot be found Place the assembler and linker in the current directory or a directory specified in the environment variable path XXXX failed Not enough memory App 2 The assembler and linker cannot be started because there is not enough memory Increase the available memory by canceling the residence of a terminate and stay resident program for the PRINT command etc disabling unnecessary device drivers making the BUFFERS specifications for CONFIG and SYS smaller etc App 2 APPENDIX bad line number XXXXX 2 Errors Meaning Syntax error A line number is outside the range from 1 to 65529 MELSEC Q Corrective action Use line numbers in the range from 1 to 65529 DEF syntax error Syntax error There is a syntax error in the DEFINT DEFS
73. e left the mode of the communication module is changed to debug mode 4 ONLINE PROGRAMMING OPERATION MELSEC Q 3 The screen displays the result of the command execution If the command ends normally the display shows as follows depending on the specifications If the command ends abnormally an error message or similar is displayed in the succeeding line The example below illustrates the contents of the display when the command ends normally 1 When the mode is changed to the debug mode Debugger side The content of the display during the GO command execution g Console side U Enter debug commands from the debugger in order to debug BASIC D gt bet ee Eee CG Waits for debug command input 2 The content of the display during the GO command execution Bo 2 eee L v programs See Chapter 5 for an explanation of the debug commands The console can be used for BASIC programs The content of the display is deleted aide Becomes a console for BASIC programs When the mode is changed to the execution mode U The content of the display during the GO Becomes a general purpose port for BASIC programs e The debugger and console can both be used for BASIC programs The content of the display is deleted Becomes a console for BASIC programs 2 About changing the modes of the communication module e See Section 2 3 for the mode change d
74. e of required type 7 CREATING PROGRAMS USING A COMPILER MELSEC Q No Istuctontuncton Specifications different from the interpreter No Instruction function a Corrective action restrictions and precautions the Commands 62 WHILE WEND e There must be one to one correspondence Make sure that the instructions match between the WHILE instruction and the WEND instruction 63 WTSET The compiler does not check array subscripts e Check the range using the IF instruction ranges and bit ranges before the WTSET function and generate an error using the ERROR instruction if necessary 64 ZSTART If the multitask setting of a task specified by Make sure to specify an executable file lt numbers is IP this instruction starts the name EXE of a compiled program to program in the interpreter If itis CP it starts restart a compiled program If the task specified by the lt number gt argument to the ZSTART argument refers to compiler BASIC the file specified by the lt file gt argument must be a file EXE created by DBC BASIC compiler If a file that is not created by DBC is specified an error occurs or the communication module s system operates unpredictably Once a task is executed it cannot be restarted without being started by specifying the file name using the ZSTART instruction App APPENDIX APPENDIX MELSEC Q Appendix 1 Error Messages When Using the Line Numbering Tool App 1 E
75. e specified 0 The MEMORY CARD 1 drive on the AD51H S3 1 The MEMORY CARD 2 drive on the AD51H S3 In the example figure to the left the memory card mounted in MEMORY CARD 1 is specified Enter aname of maximum 16 alphanumeric characters and symbols that will be assigned to the memory card after formatting The first character must be an alphabetic character and the name area should be enclosed by double quotation marks In the example figure to the left the memory card is named TASK DTM Enter the total capacity of the memory card to be formatted This value must be 1 or greater unit 64 K bytes The total capacity must be the total value of each of the sizes specified in the following formula Overall size total capacity size of executable program area file area size In the example figure to the left the memory card is formatted to contain 512 K bytes 8 X 64 K bytes 512 K bytes Enter the capacity reserved for the executable program area in the memory card after the formatting This value must be from 0 to 6 unit 65 K bytes The maximum capacity of the executable program area is 384 K bytes It is used for the OS area 128 K bytes and all of the BASIC task areas where executable programs are stored In the example figure to the left 384 K bytes are reserved for the executable program area Enter 0 as a placeholder 4 ONLINE PROGRAMMING OPERATION MELSEC Q 2 7 Enter the ca
76. e to the left the START attribute is set as the startup condition Cee 1 See Section 4 4 for more information on the options for the startup condition 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 Enter IP as the type of program to be executed S gt SET 1 START IP 5 Enter one of the following values in order to set change the task size of the target BASIC task area S gt SET 1 START IP 48 16 32 8 64 Simply enter a comma if a task size is not to be specified In this case it is assumed that the current size of the target BASIC task area will not be changed In the example figure to the left the task size is set to 48 K bytes 6 Enter a number in the range from 1 to 8 in order to set change the execution order execution startup order of S gt SET 1 START IP 48 2 programs in multiple BASIC task areas for which the START attribute is set as the startup condition when the communication module is initiated 1 is the top priority If the same number is set for multiple task areas the program with the smaller task number is executed first Simply a comma if a startup order is not to be specified In this case it is assumed that the startup order that has already been set will not be changed In the example figure to the left a startup order of 2 is set 7 The screen displays the result of the command execution in S gt SET 1 START IP 48 2 the succeeding line SET OK If the command ends normall
77. each task area with the system command TKILL 5 Change the mode of the communication module to edit mode 1 with the system command START When the START command is entered the task size can be changed and the BASIC program can be edited See Section 2 3 for the mode change diagram for how to change the mode of the communication module 1 Reference e Operation for changing the mode of the communication module GO command Section 5 5 2 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 5 2 Changing the Mode of the Communication Module to System mode Execution Mode 2 Debug Mode GO Command Mode setting R Execution mode 1 This operation changes the mode of the communication module from debug mode to system mode execution mode 2 or returns it to debug mode again By changing to system mode it becomes possible to edit debug each BASIC program residing in each task area by entering the system commands to the console see Chapter 12 1 Debugging start up specification Yes No Yes To debug mode No To execution mode 2 When changed to execution mode 2 each BASIC program starts its execution according to the multitask settings By changing back to debug mode the debugger restarts and each BASIC program starts being executed according to the multitask settings The following table shows the relationship between the mode and debugging start specification when the GO command is entered and the status
78. ead of n Several n asm files may be created 4 Start Turbo Assembler and assemble the program TASM n asm If there are several n asm files repeat this step for each file 5 Check that the following file is created n obj A number is places instead of n Several n obj files may be created 6 TLINK c ad51h system dbb obj n obj COMP c ad51h system dbc lib Start the linker If there are several n obj files they should be listed separated by space 1 0bj 2 0bj 3 obj Warning No stack _ Ignore this warning C AD51HUSR gt 7 C AD51HUSR The compilation is complete 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 5 2 For PC 9800 Series The procedure below shows an example of the steps involved when compiling a program created by the interpreter file name INTER BAS to an executable program file name COMP EXE 1 C gt DBC v INTER BAS COMP EXE Start compilation The option v is specified C gt c C gt cd ad51h usr 2 C AD51H USR gt c ad51H system dbc Lc ad51h system v INTER BAS COMP EXE BASIC COMPILER Ver 1 0 _ Start the compiler masm 1 asm Microsoft R Macro Assembler Version 5 10 Copyright C Microsoft Corp 1981 1988 All right reserved Xxxxx Bytes symbol free 0 Warning Errors 0 Severe Errors 3 Link c ad51h system dbb obj 1 COMP map c ad51h system dbc lib Start the linker Microsoft R Segmented Executable Linker Version
79. ead this chapter and understand the restricted items before starting to use it 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 2 Flow of Program Creation Using a Compiler The following flow chart provides an overview of how to create and compile a BASIC program and run it on the communication module 1 Start the software package Start up the type SW1IVD AD51HP SW1NX C gt AD51HP AD51HP software package from MS DOS Create a BASIC program through online programming Run the program using the interpreter to Check whether it runs within the restrictions check the operation of the compiler Save the program to the hard disk using Save to drive C specify drive number 3 of the SAVE instruction the hard drive End the software package Select DOS from the basic utility menu O 4 2 eO lt 2 lt 4 F F L lt lt YL Run the compiler Enter DBC lt file name gt and compile Check the executable file EXE After running the compiler check that the C AD51H USR gt DIR W EXE file has been created Restart the software package Start the type SW1IVD AD51HP SW1NX C gt AD51HP AD51HP software package from MS DOS e D 1 rno l2 lt 5 a Select Online programming from the menu and change to system mode 11 Save the program to an executable MSAVE lt task number gt file name program area of a memory card with the MSAVE command 12 Change the start condition to START with
80. ecified D gt W ED 0 3 4 The result of the command execution is displayed ED0000 0000 0000 0000 If the command ends normally the bit information of the specified range is displayed 8 points of word information corresponding to device numbers from an integral multiple of 8 to the next integral multiple of 8 minus 1 are displayed as 4 digit numbers in one line using the format shown below Note that if the specified number is different from an integral multiple of 8 n the word information corresponding to the integral multiple of 8 up to the specified number minus 1 becomes blank EDIE PE ETE PRE to FETT t The number is 8 points of word information starting from displayed the starting number shown to the left in sequence from the left are displayed as 4 digit hexadecimal numbers If the command ends abnormally W Error message and an error code are displayed In an example figure to the left a display where the command ends normally is shown 5 D gt is displayed in the line following the command execution result Enter the next command Cee 1 Precautions when entering number of points displayed e Enter the number of points displayed in such a way that it satisfies the following conditions ED Starting number number of points displayed 1 lt 1023 If a number exceeding ED 1023 is specified only word information up to ED 1023 is displayed 2 Operation when it is specified to display
81. ed e Enter the number of bytes words to be displayed in such a way that it satisfies the following condition Address number of bytes words displayed 1 lt 3FFFH If addresses that exceed 3FFFu are specified only the values stored in memory up to 3FFFu are displayed 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 6 W Enter 2 Enter the number of bytes words in the memory range whose values are to be displayed along with the display D gt MREAD 3800 6 W type If B omissible is specified as display type enter the number of bytes in the memory If W is specified as display type enter the number of words in the memory range In either case the number of bytes words should be entered as a hexadecimal number When specifying in number of bytes 1H lt number of bytes lt 4000H When specifying in number of words 1H lt number of words lt 2000H In an example figure to the left 6 words are specified in word units 3 The screen displays the result of the command execution in D gt MREAD 3800 6 W the succeeding line 3800 0000 0000 0000 0000 0000 0000 If the command ends normally the values stored in the D gt specified memory range are displayed in the specified units In case of byte units the values stored in up to 16 addresses _ if Oto if i F are displayed in one line as shown below Note that if the least significant digit of the specified address is different from O n the values SO es se e
82. ed variables used in the BASIC program in the specified task area Input format shortcut for the command TL ner Jejen Jerr E Herse e Command Operation example Assign values to variables A and B used in the BASIC program area of task No 1 whose execution has been stopped Before input one AS 20000 0S DON Command Task No Variable name Soe cog cs aq Expression when entering constants After input D gt TLET 1 A 12AB T H L E B OK Command Variable name D gt Je He Expression when entering constants Description T L E THSPH 1 A 1 Enter the TLET command in order to assign values to variables along with the task number task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area where the target program resides In an example figure to the left the BASIC program in the area of task No 1 is specified 2 Enter the name of the variables to which the values are to be assigned SSTLET 1 A It is possible to specify names of array variables e g C 0 D 1 in the same way as for the BASIC instruction LET In an example figure to the left it is specified that a value is assigned to character variable A 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q H 1 H 2 H A H B H H Enter 3 Enter the value to be assigned The values to be assigned can be specified as numerical or D gt TLET 1 A 12AB stri
83. eeeeeeeeeaeeeaeeeaeeeaeesaeeeaeenas 6 6 7 CREATING PROGRAMS USING A COMPILER 7 1 to 7 23 7 1 Differences between Compiler BASIC and Interpreter BASIC ccccecceeceeeeeeeeeeeeeeeeeeaeeeseeeeeeeeaes 7 1 7 2 Flow of Program Creation Using a Compiler ccccecceseeseeseceeeeseeeeceeceeeeeeeaesaeeeesaesaeseeeeaseaeeaeseeeeateaees 7 2 7 3 Software Required for Compilation ccceecececeeseeeeceeceeeeeeeeeceeeeeeeaecaeceeseaeeaesaeseeseaesaesaeseeeeataeseeeeaeeaees 7 3 7 4 Installing Assembler and Linker ceeeeceeeeeeseeeeeeeeeeeeeeeseeeseeeseeeseeeseeeseeeseeeeeeseeeseeeseeeneeeeeeseeeneeeneeeaes 7 3 75 Starting up the Com plletics ntig thu ites hacienda nen ee 7 4 7 5 1 For IBM PG AT Compatible PCSi isccsseciectscsctsetizccieetacazecstanscieazaceccsgiacecasetsensceqaaascagetaracaeataseeaedantarass 7 5 7 5 2 For PC 9800 Series ccecceccesceseceeceeeeseeseceeeaeeaecaeeseeeaeeaecaeesaseaecaesaeseaeeaesaeseaeeaeeaesaeeeeseaesaeeeeeeateaees 7 6 7 6 Precautions when Compiling cccceccecceseeeeceeceeeeseeeecaeceeeeaecaecaeeseeeaeceeceeseaesaesaesaeseeesaesaeseesaesaeeneseaeeaees 7 7 7 7 How to Run a Program in the Communication Module ccceceseeeceeeeeeeeceeceeseaeeaesaeseeeeaeeaeseeeeeaees 7 9 Te INSHUCTION FUNCHON Lei 22222 ace baetecds bes ods duct cde pees tugs Sicvead buen ola dusting R R 7 11 7 8 1 List of Whether or not Instructions Functions can Be Compiled ccceceeeeee
84. eeeeeeeeeeteeeeeteeees 7 11 7 8 2 Instructions Functions with Different Specifications at Compilation cceeeeeeeeeeeeeteeeeees 7 16 APPENDIX App 1 to App 11 Appendix 1 Error Messages When Using the Line Numbering Tool ecceeeeeceeseeeeeeeeeeeeeeeeeeaeeeateees App 1 Appendix 2 Error Messages at Compilation cccccccecceseeseeseceeceeeeaeeaeceeseeeeaesaecaeseeeeaesaesaeseeeeaeeaeeaeeateaes App 2 About Manuals The following manuals are also related to this product If necessary order them by quoting the details in the tables below Related Manuals Manual Number Manual Name Model Code Type AD51H S3 Intelligent Communication Module User s Manual This manual contains information on the system configuration when using the module module IB 68350 specifications name and setting for each part description of each function and external dimensions of 13JAS9 the module Provided with the module Type A1SD51S Intelligent Communication Module User s Manual Hardware This manual contains information on the system configuration when using the module module IB 68487 specifications name and setting for each part and external dimensions of the module Provided with the 13JG56 module Type A1SD51S Intelligent Communication Module User s Manual Advanced This manual contains information on the system configuration when using the module module SH 3523 specifications name and setting for each part description o
85. een on the Console EXIT Command 4 34 4 8 Operating Procedure for Checking the Input Formats of the System Commands HELP Command iu ipn ra a saueccsasSusnactadees ote daapechudestide stated eveaside dite a a td 4 36 4 9 Recovering an Area in Unusable File Area in a Memory Card CRECOVER Command Por ADSTHSE ONIY sc ites casas idl anana na a enue a Aa a A 4 38 4 10 Formatting Logical Format the File Area of a Memory Card FFORMAT Command For AO Ore OMY edited cet a a a a a ela catn due 4 40 5 MULTITASK DEBUGGING OPERATIONS 5 1 to 5 48 5 1 Deb g Command Lists 0 va i ee a tn ee a A a 5 2 5 2 Operations for Controlling the Operation of BASIC Programs ceccecceseeeeeeeeeeeeeeeeeeeeaeeetaeeeeseaeeaees 5 3 5 2 1 Displaying the Status of the Specified BASIC Program TSTATUS Command ceeee 5 3 5 2 2 Starting the Execution of the Specified BASIC Program TRUN Command ececeeee 5 5 5 2 3 Stopping the Execution of the Specified BASIC Program TSTOP Command ceccceees 5 7 5 2 4 Resuming the Execution of the Specified BASIC Program Whose Execution Has Been Stopped FCONTINUE Command i a nvedl aieiieeSi wall ave deta aves yan avn nie ela a 5 10 5 2 5 Displaying Values of Specified Variables in the Specified BASIC Program T Command 5 12 5 2 6 Assigning Values to Specified Variables in the Specified BASIC Program TLET command 5 14 5 3 Internal Memo
86. efine other user defined functions before they are called Declare the variable before the line where it will be used Do not redefine the variable 7 CREATING PROGRAMS USING A COMPILER MELSEC Q F Specifications different from the interpreter Reference page in No Instruction function a Corrective action restrictions and precautions the Commands 14 DEFSNG e Define the variable before the line where it will e Declare the variable before the line be used where it will be used e Variables already declared once with the Do not redefine the variable DEFINT DEFSNG DEFDBL or DEFSTR instructions cannot be redefined as a different type in another instruction 15 DEFSTR Define the variable before the line where it will e Declare the variable before the line be used where it will be used e Variables already declared once with the Do not redefine the variable DEFINT DEFSNG DEFDBL or DEFSTR instructions cannot be redefined as a different type in another instruction 16 DELETE The DELETE instruction is not supported 11 53 DELETE can be used as a variable name 17 e Specify the size of an array using the DIM Specify the maximum size instruction Variables are not supported in lt numerical expression gt The array subscript ranges are not checked at execution It is possible to specify that they should be checked using the debugging option d at compilation 18 ERASE The ERASE instructi
87. ended to stop each BASIC program in advance see the TSTOP command so that it does not interfere with the system control when changing the mode of the communication module from debug mode 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 3 The result of the command execution is displayed If the command ends normally the display varies depending on the specification as shown below If the command ends abnormally an error message or similar is displayed The following examples illustrate what is displayed when the command ends normally 1 When the mode is changed back to debug mode On the debugger terminal side Console side D gt GO R D Display when the GO command is executed Enter debug commands on the D debugger terminal in order to debug a The display is deleted BASIC programs e The console can be used for BASIC programs Wait for debug command entry Becomes a console for BASIC programs 2 When the mode is changed to execution mode 2 C ee when the GO command is executed D gt GO R The console and debugger terminal 4 The display is deleted lt can both be used for BASIC programs Becomes a general purpose port for BASIC Becomes a console for BASIC programs programming 3 When changed to system mode The debugger terminal can be used D gt GO P Display when the GO command is executed for BASIC programs D gt GO P System commands can be entered directly on the conso
88. entered Enter the remaining string of the command entry Enter TSTATUS 1 and press 5 How to end the operation of the interpreter in the specified task area e If the user wants to end the operation of the interpreter in the specified task area the program should be created in such a way as to execute the BASIC instruction END 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 2 4 Resuming the Execution of the Specified BASIC Program Whose Execution Has Been Stopped TCONTINUE Command This operation resumes the execution of the BASIC program in the specified task area whose execution was stopped by the TSTOP command Input format shortcut for the command TC When resuming execution from the instruction after the last instruction executed when the execution was stopped Tcontinue H sP H Task No Enter Command When resuming execution from the specified line number TCONTINUE SP Task No i Line number Command Operation example Resume execution of the BASIC program in the area of task No 1 which is currently being stopped from line number 120 Before input Command Task No p Line number After input D gt TCONTINUE 1 120 REQUEST OK D gt Description T H C H Oo H N H T H l H N 1 Enter the TCONTINUE command in order to resume execution of a BASIC program whose execution was S H E HeH stopped by the TSTOP command and the task number task No 1 t
89. erence Operation for writing values to specified memory MWRITE command Section 5 3 2 e Operation for checking word information in extension registers ED Operation for writing word information to extension registers ED W command Section 5 3 5 W command Section 5 3 6 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 2 Writing Values to Buffer Memory Common Memory Extension Registers ED MWRITE Command This operation writes values to the specified memory which can be either buffer memory common memory or extension memory ED Input format shortcut for the command MW ae writing values to memory in byte units When writing values to memory in word units one value per one address one value per two addresses were sP Staring aasress H B He H Enter mwane sP starting address W Hw H Enter Command Byte units Command Word units omissible Operation example Write the values OAx 14n 1E to EDO to ED2 in word units Before input Command Starting address m o Ho HoH aM ener T Writing to addresses 3800 to 38014 EDO After input A F le D gt MWRITE 3800 W Writing to addresses 3802 to 3803 ED1 3800 0000 000A m 3801 0000 0014 0 H 0 Enter gt 3802 0000 001E Writing to addresses 3804s to 3805 ED2 ses Write end Description SP 1 Enter the MWRITE command in order to write values to device memory al
90. erminated if the device number to which bit information is written exceeds the maximum number of the target device type 2 Reference e Operation for checking bit information of extension relays EM B command Section 5 3 3 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 5 Displaying Word Information of Extension Registers ED W Command This operation displays word information values of extension registers ED used by BASIC programs for data communication Input format shortcut for the command none Command Device name Operation example Display word information values of EDO to ED2 Before input gt COOCOO E OOTI Command Device name Starting Number of number points displayed U After input D gt W ED 03 ED0000 0000 0000 0000 Description E al 1 Enter the W command to display word information of extension registers and the type of internal device ED 2 Enter the starting number of the ED range for which the word information is to be displayed using a decimal number D gt W ED 0 up to 4 digits 0 to 1023 In an example figure to the left EDO is specified 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 3 H H Enter 3 Enter the number of points displayed number of words of the range for which word information is to be displayed in decimal number ED 1 lt number of points displayed lt 1024 In an example figure to the left 3 points 8 words are sp
91. es of the console and the debugger terminal after the GO command has been executed Console status The contents of the display are deleted The console display changes to the one used for BASIC programs P System mode within programming mode Cannot be specified The contents of the display are deleted and S gt is displayed It becomes possible to enter system commands Status of debugger terminal The debugger initiates the contents of the display are deleted and D gt is displayed It becomes possible to enter debug commands The contents of the display are kept as is The terminal becomes a general purpose port for BASIC programs Remarks Each BASIC program is reloaded to the corresponding task area according to the multitask settings and is executed BASIC programs in each task area stop being executed Cee 1 Status of each BASIC program by execution of the GO command e If execution mode 1 is specified each BASIC program will start to be executed in the same way as if the communication module was started up by setting mode switch 1 of the communication module to 0 to 3 If system mode is specified the BASIC programs in each task area stop being executed BASIC programs other than the ones in the DORMANT status go into the STOP status The memory status of each task area on the main memory does not change so the BASIC programs in each task area remain
92. exec bat file Otherwise they will not run 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 5 Starting up the Compiler In order to compile a created program it is necessary to start up the compiler The compiler can be run by simply entering DBC lt file name gt in MS DOS The format for the compiler and specification of each option are described in the following DBC 4 6 v w d source file name BAS executable file name EXE Source file name Specify the name of the BASIC source file If no extension is specified it is assumed to be BAS Enter the system name followed by the file name if there is a system name involved Executable file name EXE Specify the name of the executable file to which the result of the compilation should be output If no name is specified the file name obtained by changing the extension of the source file name to EXE is used as the execution file name 4 Specify this option when using Ver 4 0 If it is not specified it is assumed that Ver 5 0 is used 6 Specify this option when using Ver 6 0 If it is not specified it is assumed that Ver 5 0 is used v Specify this option to display the status during compilation in detail w Specify this option in order to prevent warnings from being displayed d Specify this option in order to make the compiled program perform the following error checks at execution used for debugging e Check addition subtrac
93. f each function and external dimensions of 13JG57 the module Sold separately Type QD51 QD51 R24 Q Corresponding Intelligent Communication Module User s Manual Hardware IB 0800130 This manual contains information on the system configuration when using the module module 13JT05 specifications name and setting for each part and external dimensions of the module Provided with the module Type QD51 QD51 R24 Q Corresponding Intelligent Communication Module User s Manual Advanced This manual contains information on the system configuration when using the module module e specifications name and setting for each part description of each function and external dimensions of the module Sold separately AD51H BASIC Programming Manual Commands SSmi This manual contains information on programming methods commands and error codes of AD51H 13J519 BASIC Sold separately Type SW1IVD AD51HP SW1NX AD51HP AD51H BASIC Package Operating Manual Conforming to QD51 QD51 R24 A1SD51S AD51H S3 IB 68674 This manual contains information on how to operate the software packages for IBM PCs AT compatible 133484 PCs and PC 9800 series Provided with the software package 1 OVERVIEW MELSEC Q 1 OVERVIEW This programming manual explains system and debug commands as well as compilation methods used with the communication module 1 System and debug commands The following operations can be performed by entering com
94. f the Communication Module cccceceeseeeeeeeeeeteeeeeeeeeneeaees 5 39 5 5 1 Changing the Communication Mode to Edit Mode 2 START Command ceceeeeeeeeeees 5 39 5 5 2 Changing the Mode of the Communication Module to System mode Execution Mode 2 Debug Mode GO Command cecceccescececeeeeseeseceeceeeeaeeaecaeeseseaeeaecaeeaeeeaeeaecaeseaseaesaesaeeaseaeeaesaeeeaseaeeaeeaseaeas 5 42 5 6 Operation for Displaying the Main Menu Screen on the Debugger EXIT Command eeee 5 45 5 7 Operation for Checking the Input Formats of the Debug Commands HELP Command 0 0 5 47 6 1 Difference between the General Purpose Editor and Software Package cccceeeeeseeeeeeeeees 6 1 6 2 Flow of BASIC Program Creation Using a General Purpose Editor c cceceeceeseeeeeeeeeeeeeeeeeeeeeeeeaees 6 2 6 3 Software Required to Create Programs with a General Purpose Editor ccscccseeseeteeeteeeteeeeees 6 2 6 4 Precautions when Using a General Purpose Editor ccccecceceeceeeeceececeseeeeceeeeeesaesaeseeseaeeaesaeseeseaeeaaes 6 3 6 5 Addition of Line Numbers Using the Line Numbering Tool eeeeeeseeeeeeeeeeeeeeeeeeaeeeaeeeaeeeaeeeaeeeaeenas 6 4 A 4 A 4 6 5 1 Starting up the Line Numbering TOOI ccceceseeeceeeeeeeceeceeeeaeeaecaeeeeeeaesaeceeeeeesaesaeseeseaseeeneaeeaees 6 4 6 5 2 Precautions when Using the Line Numbering TOOl ceceeeeeeeeeneeeeeeeee
95. figure to the left a display where the command ends normally is shown 3 S gt is displayed in the line following the command execution result Enter the next command DE 1 Usage of the TKILL command The operation of the interpreter should be ended in the target task area before executing the GO command when performing the following operations 1 Change the mode of the communication module to system mode and change the task size of a task area using the system commands START SET Change the mode of the communication module to system mode and load executable programs from the specified BASIC task area in a memory card EPP ROM to the target task area of the communication module using the system command MLOAD 2 Reference Operation for changing the mode of the communication module to edit 1 mode Operation for changing the mode of the communication module 2 START command Section 4 5 1 GO command Section 4 5 2 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 7 Operating Procedure for Displaying the Main Menu Screen on the Console EXIT Command This section explains how to use the EXIT command to display the main menu screen on the console Input format shortcut for the command E EXIT H Enter Command Operation example Display the main menu screen on the A7PHP being used as a console Before input ERO G Command After input Menu Programming
96. g from the beginning of the expression to or from to the end of the line is regarded as data Define the variable before the line where it will be used Variables already declared once with the DEFINT DEFSNG DEFDBL or DEFSTR instructions cannot be redefined as a different type in another instruction There must be no space between FN and the name when defining and calling the function Variable type specifications must always be placed within the lt name gt parameter and function definition expression of the DEF FN instruction If other user defined functions are called within the definition expression of the function they must be defined before it is called It is not possible to redefine a user defined function once it is defined Define the variable before the line where it will be used Variables already declared once with the DEFINT DEFSNG DEFDBL or DEFSTR instructions cannot be redefined as a different type in another instruction 11 30 Use the CSNG function on the 11 31 lt numerical expression gt to make sure that it becomes single precision Check the range using the IF instruction 11 33 before the CSNI function and generate an error using the ERROR instruction if necessary Make sure to use the double quotation 11 41 marks properly Declare the variable before the line 11 44 where it will be used Do not redefine the variable Place the type specification correctly Make sure to d
97. generated when a statement ignored by the compiler is detected pp Example of error display 10 CLEAR A The compiler does not stop compiling when it displays a warning It continues to compile until the generation of an executable file EXE is complete Check the cause of the warning and then either ignore it as it is or modify the program and compile again The display of warnings can be suppressed using option w of the compiler App 2 APPENDIX Error can t create output file can t create work file 1 MELSEC Q Caution Upon detecting an error the compiler skips reading from the location of the error to the end of the sentence Because of this it may detect a false error at a location immediately after the error by mistake or conversely it may not be able to detect an error immediately after the previous error Consequently errors from the next and afterward may not necessarily be correct The program line and displayed together with an error indicate the position where the compiler was reading at the time the error was detected The displayed position indicates the vicinity of where the error occurred However if the compiler cannot determine an error until it reads further in the program the displayed position indicates the position further ahead If it is difficult to pinpoint the location where an error occurred in lines connected by complicated expressions and multi statement try to divide the e
98. ging size and startup order Startup SET SP P BASIC task No H H H PH H Task size jl order H Enter Command When changing startup order Startup BASIC task No order Enter Command When changing size ssc HK HEI ee er Command 4 ONLINE PROGRAMMING OPERATION Operation example Specify the multitask settings for BASIC task No 1 area Before input S gt y S gt SET 1 START IP 48 2 SET OK S gt After input MELSEC Q Startup condition Task size Description s H EHT fsp 1 S gt SET o 2 S gt SET 1 v ERE RAET S gt SET 1 START 2 Enter Startup order Enter the SET command for specifying the multitask settings or changing the set data Enter the BASIC task area task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 for which the settings should be specified changed In the example figure to the left the multitask settings set data of BASIC task No 1 area of the communication module will be specified changed Enter one of the following attributes in order to specify change the startup condition under which a BASIC program is executed in the target BASIC task area e START BOOT e IT e ON e OFF Simply enter a comma if a startup condition is not to be specified In this case it is assumed that the startup condition that has already been set will not be changed In the example figur
99. he ERROR instruction if necessary 25 INPUT e The INPUT instruction does not have a screen Separate the INPUT part to another edit function for entering values task and process it with the interpreter e Since overflow check is not performed when a numerical value is entered if a large value is entered it does not generate an error but is interpreted as a negative value instead lf the number of items separated by is different from the number of variables specified to be entered the instruction displays Redo from start and the INPUT instruction is executed again bl ey AE A warning is generated at compilation 27 KNJ If a lt string expression gt specifies a Kanji code 11 109 less than amp H2120 or amp H7E7F or more an Illegal function call error is generated e If a lt string expression gt specifies a Kanji code of amp H2121 or more and less than amp H7E7F an error is not generated Com o OE A A warning is generated at compilation e The LINE INPUT instruction does not havea Separate the LINE INPUT part to screen edit function for entering values another task and process it with the interpreter ee e LIST can be used as a variable name ot e LLSIT can be used as a variable name eee Epes A EA e LOAD can be used as a variable name 7 CREATING PROGRAMS USING A COMPILER MELSEC Q Specifications different from the interpreter Reference page in No Instruction f
100. he interpreter has not been started the following message is displayed ry immediately before OK Cursor Operation example 2 Start editing and debugging the BASIC program in the area of task No 1 The size of the area of task No 1 is changed to 64 K bytes Before input S gt TKILL 1 sH tH al alt Hse H HeH ah ener KILL OK Command Task No Task size BGs ee E After input pi S gt TKILL 1 KILL OK eT OK If the interpreter has not been started the following message is displayed immediately before OK 4 ONLINE PROGRAMMING OPERATION Description S T A R T SP 1 S gt START 2 S gt START 1 MELSEC Q Enter the START command to switch the mode of the communication module into edit mode 1 Enter the task number task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area in which a BASIC program is to be edited debugged The task number may be omitted If omitted it is assumed that the next task number is specified e When the START command is entered for the first time it is assumed that 1 is specified If the START command has already been used it is assumed that the task number specified by the last START command is specified In the example figure to the left the BASIC program in the area of task No 1 will be edited debugged 4 ONLINE PROGRAMMING OPERATION y 4 8 Enter S gt STAR
101. here the target program is being executed In an example figure to the left the BASIC program being executed in the area of task No 1 stops executing 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q H 1 H 2 H 0 H Enter 2 Enter the line number of the BASIC program whose execution is to be stopped using a decimal number Simply press if it is desired to stop the execution at the line currently being executed Note that if this command is entered again by specifying the values 65535 or 1 as the line number before executing the line specified by the line number entry the first execution stop specification is canceled In an example figure to the left it is specified to stop execution at line number 120 D gt TSTOP 1 120 D gt TSTOP 1 120 3 The screen displays the result of the command execution in REQUEST OK the next line If the command is received normally REQUEST OK is displayed In addition the following stop message is displayed when the BASIC program stops executing The line number at which the execution was stopped The task number of the task area for which the execution was stopped Note that if 65535 or 1 was specified as a line number and the command was received normally BREAK Cancel Task No 1 is displayed If there was an error in the command entry Error message and an error code are displayed In an example figure to the left a display where the command ends normally i
102. hibited 11 44 309 46 RESUMU Resumes execution line by line oo multi statements into several 11 310 e Exercise caution when multi statements are lines used RESUME Resumes execution from the line number where the instruction occurs RESUME NEXT Resumes execution from the beginning of the following line RESUME line number Resumes execution from the beginning of the specified line 47 ROT e The ROT function does not check overflow e Check the range using the IF instruction 11 310 before the ROT function and generate an error using the ERROR instruction if necessary RUN 1 The RUN 1 instruction is not supported 11 316 49 SAVE e The SAVE instruction is not supported 11 318 SAVE can be used as a variable name 7 CREATING PROGRAMS USING A COMPILER MELSEC Q No Istuctontuncton Specifications different from the interpreter No Instruction function vou Corrective action restrictions and precautions the Commands 50 SHA Does not check argument overflow Check the range using the IF instruction before the SHA function and generate an error using the ERROR instruction if necessary 51 SHT e Does not check argument overflow Check the range using the IF instruction before the SHA function and generate an error using the ERROR instruction if necessary 52 SIN If lt numerical expression gt contains a double e Use the CSNG function on the precision real number a double precision lt nu
103. hus the user should not use them DRENUM TMP Work file 1 D_NCHT TMP Work file 2 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 CREATING PROGRAMS USING A COMPILER This chapter explains how to create BASIC programs using a compiler 7 1 Differences between Compiler BASIC and Interpreter BASIC It is possible to use both compiler BASIC and interpreter BASIC in the communication module Programs created in compiler BASIC and interpreter BASIC run differently in the following way Compiler BASIC In this type of BASIC the program is compiled the instructions are translated into machine language once it is completed and the communication module executes the machine code directly Interpreter BASIC In this type of BASIC the communication module translates the program into machine language during the execution of the program It is difficult to determine which type is better The following table compares the advantages and disadvantages of Compiler BASIC and Interpreter BASIC P Avantage Disadvantage f Debugging is difficult Compiler BASIC e Execution speed is fast Aie There are many detailed restrictions eer e Execution is slower than Compiler Interpreter BASIC e Debugging is easy BASIC Select either Compiler BASIC or Interpreter BASIC according to the intended purpose It is not necessary to read this chapter if Interpreter BASIC is used If Compiler BASIC is used on the other hand please r
104. iagram of the communication module Reference Operation for displaying the main menu screen on the console 3 EXIT command Section 4 7 4 31 4 31 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 6 Ending the Interpreter Operation in the Specified Task Areas TKILL Command This section explains how to use the system command TKILL for controlling the interpreter operation and the operating procedure to end the operation of the interpreter in specified task areas Input format shortcut for the command Tk TILL Task No Enter Command Operation example End the operation of the interpreter in the area of BASIC task No 1 Before input S gt T K l Command Task No U After input S gt TKILL 1 KILL OK S gt Description T K L L H SP 1 Enter the TKILL command to end the operation of the interpreter in the specified task area or one of the tasks task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the target task area S gt TKILL 1 The example figure to the left shows how to end the operation of the interpreter in the area of task No 1 4 ONLINE PROGRAMMING OPERATION MELSEC Q 2 The screen displays the result of the command execution in S gt TKILL 1 the succeeding line KILL OK If the command ends normally TKILL OK is displayed S gt If the command ends abnormally an error message or similar is displayed In the example
105. ing expression not Syntax error The last value in a FOR loop indicated by TO is a string expression Specify a numerical expression or numerical variable Syntax error There is no TO corresponding to a FOR instruction Make the appropriate correction to the program type mismatch Illegal parameter Types do not match e In an argument in an instruction function a value is required but a string is passed or a string is required but a value is passed Make the appropriate correction to the program to make sure the types match WEND without WHILE Syntax error compile restricted item A WEND instruction without a corresponding WHILE instruction was detected Make modification so that the WHILE and WEND instructions match WHILE without WEND Syntax error There is no WEND corresponding to a WHILE instruction Make modification so that the WHILE and WEND instructions match XXXXX file number not found XXXXX name too long Syntax error There is no file number or a non value data type is specified at the position of the file number in statement XXXXX Syntax error A name XXXXxX of a variable or FN function is too long maximum 15 characters Specify a file number Change the name and make it shorter XXXXX ON OFF STOP not found App 8 Syntax error A statement XXXXX requires ON OFF or STOP Specify ON OFF STOP App 8 APPENDIX MELSEC
106. ing line S gt SET 1 L R Task No Type Size Start Condition Start No Location 1 IP 16 START 2 48 Location Size Task No 48 16 1 64 32 5 96 16 112 16 2 If the command ends abnormally an error message or similar is displayed in the succeeding line The following information is displayed when the command ends normally in the example figure to the left the settings for BASIC task No 1 area are displayed See the SET command explanation page for the meaning of each item of information displayed e Task No Task number of the task area displayed e Type This corresponds to the IP CP specification entered immediately after the startup condition is set with the SET command e Size Size of the target task area This corresponds to the task size specified by the SET command e Start The condition under which a BASIC program Condition starts running in the target area This corresponds to the startup condition specified by the SET command e Start No The execution startup order when START is set as the startup condition attribute 4 above This corresponds to the startup order specified by the SET command If the startup condition is different from the START attribute the setting in this item is meaningless and is displayed e Location This shows the memory location allocated for the task in case of type CP only 4 ONLINE PROGRAMMING OPERATION MELSEC Q 6 S gt is
107. instruction XXXXX ignored The compiler ignores statement function XXXXX App 10 App 10 APPENDIX MELSEC Q MEMO App 11 App 11 afa MITSUBISHI ELECTRIC HEADQUARTERS EUROPEAN REPRESENTATIVES EUROPEAN REPRESENTATIVES MITSUBISHI ELECTRIC EUROPE B V German Branch Gothaer Stra e 8 D 40880 Ratingen Phone 49 0 21 02 486 0 Fax 49 0 21 02 4 86 1 12 e mail megfamail meg mee com MITSUBISHI ELECTRIC FRANCE EUROPE B V French Branch 25 Boulevard des Bouvets F 92741 Nanterre Cedex Phone 33 1 55 68 55 68 Fax 33 1 49 01 07 25 e mail factory automation fra mee com MITSUBISHI ELECTRIC ITALY EUROPE B V Italian Branch Via Paracelso 12 l 20041 Agrate Brianza MI Phone 39 039 6053 1 Fax 39 039 6053 312 e mail factory automation it mee com MITSUBISHI ELECTRIC SPAIN EUROPE B V Spanish Branch Carretera de Rub 76 80 E 08190 Sant Cugat del Vall s Phone 34 9 3 565 3131 Fax 34 9 3 589 2948 e mail industrial sp mee com MITSUBISHI ELECTRIC UK EUROPE B V UK Branch Travellers Lane GB Hatfield Herts AL10 8 XB Phone 44 0 1707 27 61 00 Fax 44 0 1707 27 86 95 MITSUBISHI ELECTRIC CORPORATION Office Tower Z 14 F 8 12 1 chome Harumi Chuo Ku Tokyo 104 6212 Phone 81 3 622 160 60 Fax 81 3 622 160 75 MITSUBISHI ELECTRIC USA AUTOMATION 500 Corporate Woods Parkway Vernon Hills IL 60061 Phone 1
108. is displayed in the line following the command execution result Enter the next command Cee 1 Precautions when entering the number of points displayed e Enter the number of points displayed in such a way that it satisfies the following conditions X Y device number number of points displayed 1 lt 1F H EM device number number of points displayed 1 lt 1023 If a range exceeding the maximum number of the device type is specified the bit information up to the maximum number of the device is displayed 2 Operation when it is specified to display 17 or more lines The screen can display a maximum of 16 lines of bit information Press any key other than to display bit information of the following device numbers if it is specified to display 17 or more lines of values Press if you want to stop displaying bit information 3 Reference Operation for writing bit information to extension relays EM B command Section 5 3 4 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 4 Writing Bit Information to General Purpose Inputs X Extension Relays EM B Command This operation writes bit information to general purpose inputs X used by the PLC CPU or extension relays EM used by BASIC programs for data communication Input format shortcut for the command When writing bit information to general purpose inputs X se B Hi Hx C JH Starting number H 5 Enter Command Device name When writing
109. le See Section 4 1 for more Becomes a ose purpose port for BASIC Wait for system command entry information about system programming commands 2 About changing the mode of the communication module e See Section 2 3 for the mode change diagram of the communication module 3 Reference e Operation for displaying the main menu screen on the debugger terminal EXIT command Section 5 6 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 6 Operation for Displaying the Main Menu Screen on the Debugger EXIT Command This section explains how to use the EXIT command to display the main menu screen of the AD51H BASIC package on the debugger Input format shortcut for the command E EXIT H Enter Command Operation example Display the main menu screen on the A7PHP used as the debugger Before input D gt X l After input U D gt EXIT Command U Programming 1 Online programming 2 Offline programming Esc Close Description OHHH ee Enter the EXIT command to display the main menu screen 1 Status of each BASIC program by the EXIT command execution e The BASIC programs in each task area are continuously executed as they are even when the EXIT command is executed 2 Precautions when entering the command It is recommended to stop each BASIC program with the TSTOP command in advance before entering the EXIT command so that the execution does not interfe
110. m in the specified task area that Section 5 2 4 has been stopped ye ee Displays values of specified variables in the BASIC program residing in Section 5 2 5 the specified task area TLET 1 Assigns value to specified variables in the BASIC program residing in the specified task area 4 2 1 Displays values of specified address ranges in MREAD memory that can be shared by different BASIC programs Writes values to specified addresses in memory MWRITE that can be shared by different BASIC programs Displays bit information of an internal device that can be shared by input output signals to the Memory access PLC CPU as well as BASIC programs control Writes bit information to an internal device that can be shared by input output signals to the PLC CPU as well as BASIC programs Displays word information of an internal device that can be shared by different BASIC programs Writes word information to an internal device that can be shared by different BASIC programs check shared by different BASIC programs Buffer memory Main memory Extension relays EM Extension registers ED General purpose inputs X General purpose outputs Y Extension relays EM Extension registers ED Changes the mode of the communication module from debug mode to START 1 i i edit mode 2 For program editing during multitask execution Mode control u o Changes the mode of the communication module from debug mode to
111. mands from the console or debugger e Edit and debug a BASIC program e Load and save a BASIC program from to a memory card floppy disk or hard disk e Execute stop and display the status of a BASIC program Read and write from to general purpose input output and internal devices e Change and read multitask settings 2 Creation of BASIC programs using a general purpose editor It is possible to create BASIC programs in online using any general purpose editor that is available in the market Line numbers can furthermore be added to a program created with a general purpose editor by using a line numbering tool 3 Compiling BASIC programs It is possible to use a compiler to compile BASIC programs created by interpreter BASIC The execution speed of compiler BASIC is 3 to 4 times faster as compared with interpreter BASIC 4 Making ROM based BASIC programs for the AD51H S3 It is possible to store created BASIC programs for the AD51H S3 in ROM 1 OVERVIEW MEMO MELSEC Q 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE MELSEC Q 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE This chapter explains how to start up the communication module and how to change modes after the startup when performing the online programming operations described in Chapter 4 and multitask debugging operations described in Chapter 5 2 1 Outline of the Startup Procedure 2 2 1 1 Starting up the QD51 R24 The following flow chart show
112. me Check the relevant drive There may be no free space it may be write protected a floppy disk may not be mounted the drive may be ina poor condition etc Path and file name is too long Correct the file name The temporary file failed to delete File name Correct the file name Check the relevant drive There may be no free space it may be write protected a floppy disk may not be mounted the drive may be ina poor condition etc There is an error in the status after the line number change operation Line numbers changed are not in ascending order due to the way S e option is specified etc Correct the specified option The corresponding file cannot be found File name Correct the file name Sufficient memory space cannot be allocated Increase the free space in memory and run again The drive is not ready A write error occurred File name A read error occurred File name Correct the file name Check the relevant drive There may be no free space it may be write protected a floppy disk may not be mounted the drive may be ina poor condition etc Abort the processing Another error message must have been generated before this message Refer to that message to take corrective actions Warning The referenced line number cannot be changed Line number One of the line numbers referenced in the corresponding line did not exist in the source file
113. merical expression gt to make sure value is returned otherwise a single precision that it becomes single precision value is returned placed after the PRINT instruction function If lt numerical expression gt contains a double e Use the CSNG function on the precision real number a double precision lt numerical expression gt to make sure value is returned otherwise a single precision that it becomes single precision value is returned 55 STOP e The STOP instruction ends a program the 11 330 same as for the END instruction e A warning is generateg at compilation bo o E SYSTEM can be used as a variable name Pe e Place semicolon after the TAB 11 335 placed after the PRINT instruction function Be aa If lt numerical expression gt contains a double e Use the CSNG function on the 11 336 precision real number a double precision lt numerical expression gt to make sure value is returned otherwise a single precision that it becomes single precision value is returned 59 TROFF The TROFF instruction is not supported It 11 338 does not display errors at compilation the operation at execution cannot be guaranteed TRON The TRON instruction is not supported It 11 339 does not display errors at compilation the operation at execution cannot be guaranteed VAL e Always returns double precision values Convert the value in question using the 11 340 VAL function and then use it by assigning to a variabl
114. n INPUT X X IF X gt 0 AND X lt 10 GOTO OK ELSE ERROR OK PRINT Within the interval from 0 to 10 END x ERROR PRINT Outside the interval END Save the program 3 End the general purpose editor i Check that the program was created 5 Start up the line numbering tool C gt DRENUM TEST BAS C gt C C gt cd ad51h system drenum TEST BAS C AD51H USR gt C AD51H USR gt 6 The addition of line numbers is completed The line number addition is complete 7 Check the program The source file is saved with the extension OLD 10 Branching according to the condition 20 Input X X 30 IF X gt 0 AND X lt 10 GOTO OK ELSE ERROR 40 OK 50 PRINT Within the interval from 0 to 10 60 END 70 ERROR 80 PRINT Outside the interval 90 END 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR MELSEC Q 6 5 2 Precautions when Using the Line Numbering Tool Please take the following precautions when using the line numbering tool 1 About handling identical file names If the source file and output file have the same file names the line numbering tool changes the extension of the source file to OLD and then performs the processing If a file with the file name in question and the extension OLD already exists that file will be overwritten 2 About the number of characters in one line An error will occur if the number of characters in one line exceeds 2
115. n to be written Used when backing up the ED target device number Used to end the word information write operation to ED Used when executing entries made using the keys above If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where word information is successfully written to EDO to ED2 address 3800H to 3805H is shown 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q cae 4 D gt is displayed in the line following the command execution result Enter the next command D gt W ED 0 ED0000 0000 000A ED0001 0000 0014 ED0002 0000 001E ED0003 0000 D gt Cee 1 Processing when exceeding ED 1023 e The processing of the W command is automatically terminated if the ED internal device number to which word information is written exceeds 1023 2 Reference e Operation for checking values of specified memory address specification MREAD command Section 5 3 1 e Operation for writing values to specified memory address specification MWRITE command Section 5 3 2 e Operation for checking word information of extension registers ED W command Section 5 3 5 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 4 Operations for Checking the Usage of Events Message Ports Resource Numbers This section explains how to use the debug command ZSTATUS and the operating procedure when checking the current usage of event
116. n between the QD51 R24 and target device module with a cable e User s Manual Details See Section 5 5 gt e Operation mode setting Set various switches e Setting of the console and debugger e User s Manual Details See Section 5 6 Start up the software package Create the program e Instructions and functions Ro See the Programming Manual Commands Debug the program gt Operation mode setting Set the operation mode with the i setting Sick e User s Manual Details See Section 5 6 End 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE 2 2 About Changing Between the Modes of the Communication Module After starting up the communication module it is possible to change into various modes by entering system commands from the console described in Chapter 4 and debug commands from the debugger described in Chapter 5 This chapter explains how to change between the modes of the communication module by entering system commands and debug commands and provides a brief description of each mode Start up the communication module If the A7PHP A7HGP A7LMS is used 1 Start up the A7PHP A7HGP A7LMS with the AD51H BASIC function 2 Select Programming in the displayed main menu screen 3 Select Online programming in the Programming Menu screen displayed If mode setting switch 1 of the If mode setting switch 1 of the If mo
117. n the ON lt expression gt GOSUB GOTO instruction Specify a numerical expression for lt expression gt OPEN file name not found Syntax error There is no text string containing the file name for the OPEN instruction Specify the file name correctly OPEN INPUT OUTPUT APPEND not found Syntax error Text other than INPUT OUTPUT and APPEND are placed after OPEN XXX FOR Specify either INPUT OUTPUT or APPEND parameter must be numerical expression parameter must be string expression Illegal parameter A numerical expression is required but another data type is specified Illegal parameter A string expression is required but another data type is specified Specify a numerical expression Specify a string expression parameter must be variable App 5 Illegal parameter A variable is required but another data type is specified Specify a variable App 5 APPENDIX MELSEC Q port number must be constant Illegal parameter A port number X must be an integer constant Corrective action Specify an integer constant PRINT USING not found Syntax error There is a character other than in a format string in the LPRINT PRINT USING instruction mon Change to PRINT USING format string not found Syntax error There is a character other than a format character after USING in the LPRINT PRINT USING instruction
118. n the example figure to the left the contents are checked after copying Y 4 The screen displays COPY Y N Enter Y to copy S gt CCOPY 0 1 V Enter N to stop copying The console returns to waiting for COPY Y N Y a system command entry In the example figure to the left copying is specified 5 The screen displays the result of the command execution in SsCCOPY 0 1 V the succeeding line COPY Y N Y If the command ends normally COPY OK is displayed COPY OK If the command ends abnormally an error message or a similar is displayed In the example figure to the left a display where the command ends normally is shown 6 S gt is displayed in the line following the command execution result Enter the next command Cee 2 Reference e Operation for formatting a memory card CFORMAT command Section 4 2 2 e Operation for displaying formatting information of a memory card CFORMAT command Section 4 2 3 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 2 2 Formatting a Memory Card CFORMAT Command For AD51H S3 Only This operation formats a memory card physically mounted in MEMORY CARD 1 or on the AD51H S3 Input format shortcut for the command CF CFORMAT SP Pp Memory card interface No Card name i Command B Size of executable program area E o eel File area size Enter Operation example Format the memory card with a capacity of 512 K bytes mounted in MEMORY
119. ng expressions in the same way as for the BASIC instruction LET In an example figure to the left it is specified to assign character constant 12AB to character variable A D gt TLET 1 A 12AB 4 The screen displays the result of the command execution in OK the succeeding line D gt If the command ends normally OK is displayed If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where the command ends normally is shown 5 D gt is displayed in the line following the command execution result Enter the next command E 1 Precautions when entering the command An error will occur if a BASIC program in the DORMANT status is specified It is recommended to place the target BASIC program in the STOP status using the TSTOP command before entering the TLET command 2 Reference e Operation for checking the status of the current BASIC program TSTATUS command Section 5 2 1 e Operation for stopping the execution of the specified BASIC program TSTOP command Section 5 2 3 e Operation for resuming continuing execution from a line at which execution was stopped TCONTINUE command Section 5 2 4 e Operation for checking values of specified variables T command Section 5 2 5 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 Internal Memory Read Write Operations This section explains how to use each of the debug commands fo
120. ng the DBC compiler The DBC compiler displays the warning LINK warning L4021 no stack segment during the linking This does not cause problems in the operation of a compiled program please ignore it 6 About the size of variables 7 The interpreter uses only the string area for the length of a string while the compiler always uses 256 bytes per variable About the execution order of expressions The compiler optimizes the expressions in order to improve the execution speed Therefore the priority order and combinatory rules do not change but the order in which items in an expression are executed may not be the same For example in case of the expression ASC INKEY ASC INKEY 2 it is not given beforehand whether the ASC INKEY 2 part or the ASC INKEY part is executed first If the result of the compiled expression comes out differently from the interpreter the expression should be divided and the intermediate result temporarily stored in a variable etc after which the program can be executed 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 8 About conversion of integers to real numbers in calculations In addition subtraction multiplication and division between integers if an intermediate result of an expression is outside the integer range the interpreter automatically converts it to a real number and performs the calculation However the compiler still performs the calculation within the integer rang
121. nged so that the size of the target task area exceeds the current size 1 Save all the executable programs in the communication module with the SAVE instruction 2 Change the set data in the multitask setting accordingly Specify each task size in such a way that all the executable programs can be saved within the executable program area size specified when the target memory card was formatted 3 Reset the communication module 4 Load the executable programs with the LOAD instruction and execute the MSAVE command 2 See Section 4 3 2 for more information about the MSAVE command 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 4 1 Specifying Multitask Settings and Changing Set Data SET Command This operation allows the user to specify multitask settings for task areas for which multitask settings have not been specified and change the multitask settings of task areas that have already been set Input format shortcut for the command S When setting changing startup conditions size and startup order Startup Startup BASIC task No A Task size order Enter Command When changing startup condition and startup order Startup Startup f Enter mcn A Ener Command When changing startup condition and size Startup gt J condition Task size Enter SET SP P BASIC task No Command When changing startup condition Startup SET Hse BASIC task No H A Soa H H P H Enter Command When chan
122. nging Set Data and Displaying Set Data This chapter explains how to use each of the system commands for controlling multitask settings and the operating procedure to specify multitask settings modify set data and display set data Multitask settings refer to the startup condition settings used when starting up the communication module in execution mode and executing multiple BASIC programs in multitasking The multitask settings include the following items They are specified with the MSAVE command or the SET command Startup conditions Specifies the startup conditions under which the BASIC program in the target BASIC task area is executed a b 1 START e After powering on or resetting the communication module executable programs in the specified target BASIC task areas of a memory card EEP ROM flash ROM are loaded into the corresponding executable program areas of the communication module after which the programs are executed BOOT e Executable programs in the specified target BASIC task areas of a memory card EEP ROM flash ROM are loaded into the corresponding executable program areas of the communication module when the communication module is started up e They are executed when a currently running BASIC program directs an order to execute by the ZSTART instruction IT e Executable programs in the target BASIC task areas of a memory card EEP ROM flash ROM are loaded into the executable program area of the commu
123. ngs etc 3 Edit mode 1 1 This is the mode that is changed to when the START command is entered on the console in system mode 2 Theconsole input is used by the interpreter an OS that analyzes and executes BASIC commands 3 Itis possible to perform the following operations for each BASIC program by entering instructions functions of AD51H BASIC from the console Display on the console Editing and debugging l lt Cursor position Load and save BASIC programs from to the memory card file area 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE MELSEC Q 4 Execution mode 1 This is the mode that is changed to when the communication module is started up by setting mode setting switch 1 to 0 or 1 or when the GO command is entered from the console debugger If the RUN key switch RUN switch is in the RUN position it changes to the execution mode 2 Itis possible to fundamentally control the system by running multiple BASIC programs in the multitask settings 5 Debug mode 1 This is the mode that is changed to when the communication module is started up by setting mode setting switch 1 to 2 or 3 or when the GO command is entered from the console in system mode If the RUN key switch RUN switch is in RUN position it changes to the debug mode 2 The debugger input is used by the debugger function an OS that analyzes and executes debug commands of the communication module 3 Itis possible to
124. nication module when the communication module is started up e They are executed when the PLC CPU turns on the specific output the startup task number specification flag and task startup signal of the communication module ON The specified programs are loaded from the file area of a memory area etc and executed when a currently running BASIC program directs an order by the ZSTART instruction after the communication module has been started up OFF e The multitask settings of the target task area are canceled BASIC programs cannot be run in the target task areas Task size Set the size 16 K bytes 32 K bytes 48 K bytes 64 K bytes of the target BASIC task area 4 ONLINE PROGRAMMING OPERATION MELSEC Q c Startup order Specify which program should be executed first when multiple BASIC programs are loaded into the corresponding task areas and executed when the communication module is started up If executable programs are saved into the executable program area used as multiple BASIC task areas of a memory card EEP ROM flash ROM using the MSAVE command the multitask settings are specified automatically for the target BASIC task areas This section explains the available operations for the aforementioned multitask settings and for changing and verifying set data Cee 1 About changing the task size of the multitask setting The following tasks should be performed again if the size of the multitask setting is cha
125. o 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area where the BASIC program to be edited resides The entry of the task number may be omitted If the task number is omitted it is assumed that the following task number is specified e It is assumed that 1 is specified when the START command is entered for the first time e It is assumed that the same number as specified by the last START command is specified if the START command is already used In an example figure to the left the BASIC program is specified to be edited in the area of task No 1 The result of the command execution is displayed If the command ends normally the display in the figure shows and then the user can edit the BASIC program from this point The editing operations of BASIC programs are explained in the programming manual If the command ends abnormally an error message or similar is displayed The upper figure to the left shows the display when the interpreter has not been started up The lower figure to the left shows the display when the interpreter has already been started up Perform one of the following operations when the editing of the BASIC program is finished in edit mode 2 and the mode of the communication module should be returned to debug mode Execute the BASIC instruction SYSTEM e The BASIC program stops executing All open files and communication lines are closed Press D e The
126. o 8 can be specified for AD51H S3 1 or 2 for D gt TCONTINUE 1 A1SD51S QD51 R24 of the task area where target program resides In an example figure to the left the BASIC program in the area of task No 1 which is currently being stopped is being resumed 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q H 1 H 2 H 0 H Enter 2 Enter a line number from which execution is to be resumed using a decimal number D gt TCONTINUE 1 120 Simply press if the execution should be resumed from the instruction after the last instruction executed when the execution was stopped In an example figure to the left line number 120 is specified 3 The screen displays the result of the command execution in D gt TCONTINUE 1 120 the succeeding line REQUEST OK If the command ends normally TCONTINUE REQUEST D gt Ok is displayed If the command ends abnormally TCONTINUE Error and an error code are displayed In an example figure to the left a display where the command ends normally is shown If the command ends normally the BASIC program in the specified task area is placed in the RUN status 4 D gt is displayed in the line following the command execution result Enter the next command e555 55555 1 Precautions when entering the command The TCONTINUE command can be executed on a BASIC program in the STOP status whose execution was stopped by the TSTOP command An error occurs if the command is entered for a BASIC
127. on 5 2 6 3 Operation of the TSTOP command If a line number is specified at the TSTOP command entry the program execution is stopped before executing the line with the specified number Therefore none of the instructions in the specified line have been executed when the execution of the BASIC program is stopped by the command If a line number was not specified the execution is stopped after the interpreter processes the instruction that is being executed at the time of pressing the key Therefore if multiple instructions were entered in one line multi statement the instructions after the instruction being executed at the time the key was pressed would not have been executed 4 Precautions when stopping the execution of a BASIC program by entering the TSTOP command When a BASIC program stops being executed with the TSTOP command the debugger OS displays a stop message at the current cursor position If the user enters the command while the debugger displays the stop message the message and command are mixed and both are displayed In this case the command being entered is valid continue entering the remaining text string of the command entry Example If a stop message is displayed while entering the TSTATUS command D gt TSTOP 1 190 REQUEST OK D gt TSTABreak Task No 1 Line No 00180 Stop message Command being entered U D gt TSTOP 1 190 REQUEST OK D gt TSTABreak Task No 1 Line No 00180 Command being
128. on 8 8 2 1 AUTO x Not supported by the compiler Section 8 8 2 2 BEEP Q Commands 11 8 BIN A With restriction Section 8 8 2 3 BSWAP O Commands 11 11 CDBI O Commands 11 13 CDBL O Commands 11 15 CHAIN x Not supported by the compiler Section 8 8 2 4 CHR O Commands 11 18 CIDB O Commands 11 19 CINT O Commands 11 21 CISN O Commands 11 22 CLEAR x Not supported by the compiler Section 8 8 2 5 CLOSE O Commands 11 25 CLS Commands 11 26 COM ON OFF STOP Q Commands 11 27 COMMON x Not supported by the compiler Section 8 8 2 6 CONSOLE O Commands 11 29 CONT x Not supported by the compiler Section 8 8 2 7 COS A With restriction Section 8 8 2 8 CSNG O Commands 11 32 CSNI A With restriction Section 8 8 2 9 CVD O Commands 11 35 CVDMBF O Commands 11 36 CVI O Commands 11 37 CVS Q Commands 11 38 CVSMBF Q Commands 11 39 DATA A With restriction Section 8 8 2 10 DATE O Commands 11 42 DEFDBL A With restriction Section 8 8 2 11 DEFFN A With restriction Section 8 8 2 12 Continued on the following page 7 CREATING PROGRAMS USING A COMPILER MELSEC Q Table 7 1 List of whether or not instructions functions can be compiled continued a Reference page Instruction function Compilation Remarks reference section DEFINT A With restriction Section 8 8 2 13 DEFSNG A With restriction Section 8 8 2 14 DEFSTR A With rest
129. on is ignored If this instruction is used to define a new 11 58 A warning is generated at compilation array a maximum size array should be defined in advance and reused instead If the ERASE instruction is used to delete an array simply delete it 19 EXP If lt numerical expression gt contains a double Use the CSNG function on the precision real number a double precision lt numerical expression gt to make sure value is returned otherwise a single precision that it becomes single precision value is returned 20 FILES The FILES instruction is ignored 11 64 A warning is generated at compilation 21 FOR NEXT There must be one to one correspondence e Make sure that the instructions match between the FOR instruction and the NEXT instruction BE 2 N e e A warning is generated at compilation 7 CREATING PROGRAMS USING A COMPILER MELSEC Q Specifications different from the interpreter Reference page in No Instruction function ie Corrective action restrictions and precautions the Commands 23 GOSUB RETURN The compiler does not check for RETURN Count and check the GOSUB and 11 76 without GOSUB errors RETURN instructions using counters 24 HEX If a value outside the range from 32678 to e Check the range using the IF instruction 65535 is specified in lt numerical expression gt before the HEX function and generate the result is the same as if 32767 is specified an error using t
130. ong with the memory address where the 1 H H H i H writing should start using a hexadecimal number up to 4 digits 0 to 3FFF D gt MWRITE 3800 The relationship between device memory and addresses is shown in Section 5 3 In an example figure to the left address 3800H of EDO is specified Ww 2 Enter type of values to be written Enter B omissible to write the values in byte units D gt MWRITE 3800 W Enter W to write the values in word units In an example figure to the left it is specified to write in word units 5 MULTITASK DEBUGGING OPERATIONS D gt MWRITE 3800 W 3800 0000 0000C D gt MWRITE 3800 W 3800 0000 000A Lo Ho Hi HeH err D gt MWRITE 3800 W 3800 0000 000A 3801 0000 0014 o HoH HEH Err D gt MWRITE 3800 W 3800 0000 000A 3801 0000 0014 3802 0000 001E He D gt MWRITE 3800 W 3800 0000 000A 3801 0000 0014 3802 0000 001E 3803 0000 D gt MELSEC Q 3 The screen displays the result of the command execution in the succeeding line If the command ends normally the specified address and currently stored value are displayed with the specified units in hexadecimal numbers In case of byte units the display shows as follows enter the value to be written using a hexadecimal number with 2 digits or less only valid digits can be entered E Enter the value to be written as a hexadecimal number for one address The value currently stored in the a
131. pacity reserved for the file area in the memory card after the formatting This value must be 0 or greater S gt CFORMAT 0 TASK DTM 8 6 0 2 unit 64 K bytes This area is used to store BASIC programs and data files that are not stored in the BASIC task areas In the example figure to the left 128 K bytes are reserved for the file area 2 X 64 K bytes gt 128 K bytes y 8 The screen displays FORMAT Y N Enter Y to format S gt CFORMAT 0 TASK DTM 8 6 0 2 Enter N to stop formatting The console returns to waiting FORMAT Y N Y for a system command entry In the example figure to the left formatting is specified 9 The screen displays the result of the command execution in the succeeding line If the command ends normally FORAMT Ok is displayed If the command ends abnormally an error message or similar is displayed In the example figure to the left a display where the command ends normally is shown S gt CFORMAT 0 TASK DTM 8 6 0 2 FORMAT Y N Y FORMAT OK S gt 10 S gt is displayed in the line following the command execution result Enter the next command E 5Qa7 2 Precautions on specifying each of the sizes in the CFORMAT command The overall size total capacity should be specified so that it matches with the capacity of the memory card to be formatted Moreover it must be equal to the total value of the sizes of the executable program are
132. ppy disks and hard disks using the console connected to the communication module Only one BASIC program in one task can be debugged at a time in online programming This chapter explains how to use system commands for editing and debugging BASIC programs as well as loading and saving BASIC programs from to memory cards user made floppy disks and hard disks using the console in system mode EEE 1 This chapter mainly explains the key inputs and displays on the console side It is therefore generally omitted to state this fact explicitly for most key inputs and displays When necessary it is pointed out explicitly that key inputs and displays are on the debugger side 2 Itis necessary to perform the following tasks in advance in order to perform the online programming described in this chapter Perform each operation beforehand according to the explanation in the reference chapters below In order to establish communication for performing online programming the user should Set the switches of the module See Chapter 2 e Connect the console See Chapter 2 4 ONLINE PROGRAMMING OPERATION 4 1 System Command List Classification System command Table 4 1 System Command List Function overview Copies the contents of a memory card to another memory MELSEC Q Availability for module AD51H S3 A1SD51S QD51 R24 Table 4 1 lists system commands entered on the console from the keyboard
133. put format of the debug commands Input format shortcut for the command H Command Operation example Display input format etc of each debug command Before input gt HAEE Command Q After input D gt HELP Description H H E H L H P H Enter 1 Enter the HELP command to display input format etc of each debug command D gt HELP 2 The screen displays the result of the command execution If the command ends normally functions input formats of each debug command are displayed from the succeeding line Example 1 Task Status Info TS task No Command Function of command Description of input format shortcut for command Number for description If the command ends abnormally an error massage or similar is displayed in the succeeding line 3 D gt is displayed in the line following the command execution result Enter the next command 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q E 1 About description of the command input format A one column space immediately after a command indicates that the key space should be entered Parentheses and indicate that symbols should be entered as they are Brackets and are symbols that indicate separation of command arguments it is not necessary to enter brackets Square brackets and are symbols that indicate that the arguments inside them are omissible it is not necessary to enter squar
134. r AD51H S3 Only This operation formats logically the file area of a memory card mounted in MEMORY CARD 1 or 2 on the AD51H S3 Input format shortcut of the command FFM FFORMAT SP H Memory card interface No Enter Command Operation example Format the memory card mounted in MEMORY CARD 1 Before input S gt F F O R i Command Memory card interface No U S gt FFORMAT 0 Format specification FORMAT YIN Y FORMAT OK S gt Description E H F H Oo H R H M H A H T 1 Enter the FFORMAT command to format a memory card S gt FFORMAT SP H 0 Enter 2 Enter the memory card interface number in which the memory card to be formatted is mounted followed by a S gt FFORMAT 0 colon Only 0 or 1 can be specified 0 The MEMORY CARD 1 drive of the AD51H S3 1 The MEMORY CARD 2 drive of the AD51H S3 In the example figure to the left the memory card mounted in MEMORY CARD 1 is specified 1 Precautions when using the FFORMAT command e Ifa memory card is formatted all data that was saved on it will be deleted e When formatting a memory card that is write protected the write protect should be canceled first e When formatting a memory card mounted in MEMORY CARD E the memory protection key switch of the AD51H S3 module should be turned off first 4 ONLINE PROGRAMMING OPERATION S gt FFORMAT 0 FORMAT Y N 2Y S gt FFORMAT 0 FORMAT YIN
135. r controlling memory access and the operating procedure for reading writing from to the module s internal memory m Buffer memory ores 6 K bytes H COMMON memory verre etree terete 8 K bytes Internal memory Communication module Extension registers EDO to ED1023 1024 points 1024 words Extension relays EMO to EM1023 1024 points 1024 bits General purpose I O E ONT Se Ponte 32 Pils YO to Y1F 32 points 32 bits The addresses are specified when accessing internal memory via the commands MREAD and MWRITE explained in this section The figure below illustrates the relationship between addresses specified by these commands and internal memory Access should be made within the address range of each memory area 00004 Ou io Buffer memory io 6K bytes 17FFH L 18001 BLF 7 l Address specified when accessing memory from Common memory the PLC CPU using the FOM TO commands to 8K bytes Memory is accessed assuming 1 address 2 bytes ga TAES i EDO0 ED1023 2900h HEL EDD o 1024 words 38014 H SFFFuH N 38021 L ED1 3803n H to IF to pe N 3FFEn L N 3FFFH Address specified by debug commands Memory is accessed assuming 1 address 1 byte 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 3 1 Displaying Values of Buffer Memory Common Memory Extension Registers ED MREAD Command This operation displays the val
136. ration for changing the mode of the communication module GO command Section 4 5 2 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 8 Operating Procedure for Checking the Input Formats of the System Commands HELP Command This section explains how to use the system command HELP to display the input format etc of each of the system commands on the console Input format shortcut for the command H HELP H Enter Command Operation example Display input format etc of each system command Before input s D Command U After input S gt H 1 CCOPY Memory Card Copy CC Source Drive No Destination Drive No LV 2 CFORMAT Memory Card Format CF Drive No Description H H E H H P H Enter 1 Enter the HELP command to display input format etc of each system command S gt HELP 4 ONLINE PROGRAMMING OPERATION MELSEC Q 2 The screen displays the result of the command execution If the command ends normally functions input formats of nine types of the system commands are displayed from the succeeding line S gt H 1 CCOPY Memory Card Copy CC Source Drive No Destination Drive No LV 2 CFORMAT Memory Card Format CF Drive No Press any key other than to display functions input formats of system commands in the suceeding page 3 types Press the key to end the HELP command Example 1 COPY Memory Card Copy CC Source Drive No Command Func
137. re to the left a display where the command ends normally is shown 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 3 D gt is displayed in the line following the command execution result Enter the next command Cee 1 Precautions when entering the command e If a task area is specified in which a BASIC program is already being executed an error occurs If there is no BASIC program in the specified task area an error occurs 2 Reference e Operation for stopping the execution of the specified BASIC program TSTOP command Section 5 2 3 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 2 3 Stopping the Execution of the Specified BASIC Program TSTOP Command This operation stops the execution of the BASIC program in the specified task area Input format shortcut for the command TP When stopping at the line currently being executed TSTOP H sp H Task No H Enter Command When stopping at the specified line TSTOP SP Task No S Line number Enter Command Operation example Stop the execution at line 120 of the BASIC program being executed in the area of task No 1 Before input D gt Command Task No 2 0 Jit Line number After input D gt TSTOP 1 120 REQUEST OK Description ES P 1 Enter the TSTOP command to stop the execution of a BASIC program along with the task number task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the task area w
138. re with the system control when displaying the main menu in order to edit the BASIC programs in each BASIC task area etc 5 45 5 45 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 2 The result of the command execution is displayed the user can perform the corresponding operations from this point If the command ends normally the main menu screen is displayed on the debugger select a displayed item to perform the corresponding operation In an example figure to the left a display where the command ends normally is shown See the Type SW1IVD AD51 HP SW1NX AD51HP AD51H BASIC Operating Manual for operations from the main menu screen Menu Programming 1 Online programming 2 Offline programming Esc Close If the command ends abnormally an error message or similar is displayed E 2 About changing the mode of the communication module See Section 2 3 for the mode change diagram of the communication module 3 Reference e Operation for stopping the execution of the specified BASIC program TSTOP command Section 5 2 3 Operation for changing the mode of the communication module GO command Section 5 5 2 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 7 Operation for Checking the Input Formats of the Debug Commands HELP Command This section explains how to use the command HELP to display the input format etc of each of the commands on the debugger in order to check the in
139. rea by this operation Input format shortcut for the command MS When checking that the contents of the save source and destination match after saving MSAVE SP Task No V Enter Command Matching When simply saving MSAVE SP Task No Enter Command Operation example Save an executable program in the area of BASIC task No 1 of the AD51H S3 to the area of BASIC task No 1 of the memory cards executable program area and check that the contents match Before input Command Task No Matching Main memory Y After input S gt MSAVE 1 V ae Memory card loadin A OS area SAVE Y N Y Area of SAVE OK BASIC task No 1 S gt Executable program area e a a ee E File area E 1 Target memory card The target memory card of the MSAVE command should be the memory card mounted in MEMORY CARD 1 of the AD51H S3 2 Precautions when using the MSAVE command e Start up the interpreter with the START command then execute the MSAVE command immediately after executing the SYSTEM command to the interpreter or pressing D The following tasks should be performed again if the save capacity the size specified by the START command exceeds the capacity of the BASIC task area when saving again to a BASIC task area of a memory card to which executable programs have already been saved 1 Save all the executable programs to the executable program area of a memory card EEP ROM flash ROM 2 Modif
140. riction Section 8 8 2 15 DEF ZEVENT O Commands 11 50 DELETE x Not supported by the compiler Section 8 8 2 16 DIM A With restriction Section 8 8 2 17 END Q Commands 11 56 EOF O Commands 11 57 ERASE x Not supported by the compiler Section 8 8 2 18 ERL Q Commands 11 59 ERR O Commands 11 60 ERROR O Commands 11 61 EXP A With restriction Section 8 8 2 19 FIELD O Commands 11 63 FILES x Not supported by the compiler Section 8 8 2 20 FIX O Commands 11 65 FOR NEXT A With restriction Section 8 8 2 21 O Commands 11 68 A With restriction Section 8 8 2 22 O Commands 11 71 GETMEM O Commands 11 72 GOSUB RETURN A With restriction Section 8 8 2 23 GOTO O Commands 11 78 HEX A With restriction Section 8 8 2 24 IF GOTO ELSE O Commands 11 80 IF THEN ELSE O Commands 11 82 INKEY O Commands 11 84 INPUT A With restriction Section 8 8 2 25 INPUT O Commands 11 87 INPUT Commands 11 90 INSTR O Commands 11 91 INT Q Commands 11 93 JIS Commands 11 95 KACNV Q Commands 11 96 KEXT O Commands 11 97 KEY O Commands 11 98 KEYLIST x Not supported by the compiler Section 8 8 2 26 KILL Commands 11 100 KINSTR O Commands 11 102 KLEN O Commands 11 103 KMID O Commands 11 105 Continued on the following page 7 CREATING PROGRAMS USING A COMPILER MELSEC Q Table 7 1 List of whether or not instructions functions can be compiled continued Instruction function Compilation Remarks Reference page reference section
141. rmat of the instruction App 6 APPENDIX MELSEC Q Corrective action string expression not allowed Illegal parameter An illegal string variable expression is used This error occurs when a string variable expression is specified where a numerical value expression is required Modify the program according to the format of the instruction string expression too complex Compiler restricted item A string expression is too complicated Make the expression less complicated by assigning an intermediate value of the expression to a variable etc subscript out of range Illegal parameter e The subscript of an array is beyond the range specified by the DIM instruction e The array dimensions do not match e Modify the program so that the subscript remains within the range specified by the DIM instruction e Make the appropriate correction to the program so that the array dimensions match swap type mismatch Illegal parameter The types of two variables swapped by the SWAP instruction do not match Make the appropriate correction to the program so that the types of the two variables swapped match syntax error Syntax error There is a syntax error Make the appropriate correction to the program according to the format of the instruction or function syntax error binary operator Syntax error There is only one argument specified for a binary operator Make the appropriate
142. rror message Corrective action There is an error in the description of an option Correct the specified option Extension old cannot be specified for an output file name output file name Since extension old cannot be specified for the output file name change to other extension There are more than 254 characters in one line Line number Change the number of characters of the corresponding line to 254 or less The number of characters in one line exceeded 254 Line number Change the number of characters of the corresponding line to 254 or less by considering the increased number of characters when the line number is changed The file cannot be opened File name Correct the file name Check the relevant drive There may be no free space it may be write protected a floppy disk may not be mounted the drive may be ina poor condition etc The file cannot be closed File name Correct the file name Check the relevant drive There may be no free space it may be write protected a floppy disk may not be mounted the drive may be ina poor condition etc The backup file name of the source file file name failed Correct the file name Check the relevant drive There may be no free space it may be write protected a floppy disk may not be mounted the drive may be ina poor condition etc The output file output file name cannot be created Correct the file na
143. ry Read Write Operations cceccesecceeceeeeeeeeeceeeeeeeaecaeeeeseaeeaesaesaeeeaesaesaeseeseaesaseeseaeeaees 5 16 5 3 1 Displaying Values of Buffer Memory Common Memory Extension Registers ED MREAD Command s seeecthsia cede aleteteths edie decd ag a aap ae aaa ieri aiaia 5 17 5 3 2 Writing Values to Buffer Memory Common Memory Extension Registers ED MWRITE Command ai ernst deny a Sali aire naval mapa ied feeders 5 20 5 3 3 Displaying Bit Information of General Purpose Inputs X General Purpose Outputs Y Extension Relays EM B Command cecceccesccecceceeseeeeceeeeeeeaecaeceeseeeeaecaeceeseaeeaesaeseeseaesaesaeseeseaesaeeaeseesnes 5 23 5 3 4 Writing Bit Information to General Purpose Inputs X Extension Relays EM B Command 5 26 5 3 5 Displaying Word Information of Extension Registers ED W Command c csceeeeeeee 5 28 5 3 6 Writing Word Information to Extension Registers ED W Command s s s 5 30 5 4 Operations for Checking the Usage of Events Message Ports Resource Numbe s eeeeee 5 33 5 4 1 Displaying the Event Enable Disable Declaration Status ZSTATUS Comman d eseeee 5 33 5 4 2 Displaying the Status of Transmission to Message Ports STATUS Command ceeeee 5 35 5 4 3 Displaying the Reserved Released Status of Resource Numbers for Exclusive Access Control ZSTATUS Command esnin atenian Gee Si eA Date A vee i eels 5 37 5 5 Operations for Changing the Mode o
144. s message ports or resource numbers shared among BASIC programs ZSTATUS is generally used for checking OS information 5 4 1 Displaying the Event Enable Disable Declaration Status ZSTATUS Command This operation displays the BASIC program s current even enable disable declaration status for events shared among BASIC programs for each event number Input format shortcut for the command ZS ZSTATUS SP E Command Event specification Operation example Display the current even enable disable declaration status by each event number Before input D gt SP E Enter Me aS ee ee Command Event specification After input g D gt ZSTATUS E No EN DI ON OFF No EN DI ON OFF 0 DISABLE OFF 1 DISABLE OFF 3 DISABLE OFF 4 DISABLE OFF 6 DISABLE OFF 7 DISABLE OFF 9 DISABLE OFF 10 DISABLE OFF 12 DISABLE OFF 13 DISABLE OFF 15 DISABLE OFF Description Z S T A T U s 1 Enter the ZSTATUS to display information managed by the k OS and E to specify events as the information type to be SP E Enter displayed D gt ZSTATUS E 1 About events Events are used in BASIC programs according to the following instructions See the AD51H BASIC Programming Manual Commands for more information Event definition DEF ZEVENT instruction Event enable disable declaration ZEVENT instruction e Event occurrence ZSIGNAL instruction e Wait for event occurrence ZWAIT EVENT instruction 5 MULTITASK DEBUGGING O
145. s PH 1 H HL H H R H Enter Command BASIC Memory location DRAM task No display After input S gt SET 1 L R Task No Type Size Start Condition Start No Location 1 IP 16 START 2 48 Location Size Task No 48 16 1 64 32 5 96 16 Description S EH T 1 Enter the SET command to display the contents of the multitask settings S gt SET ea Enter the target BASIC task area task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 S gt SET 1 whose the set data is to be displayed Simply press if all the BASIC task areas are to be specified In the example figure to the left BASIC task No 1 is specified 4 ONLINE PROGRAMMING OPERATION L ahel S gt SET 1 L BOCA 7 S gt SET 1 L R MELSEC Q Enter L if the location allocation of each task is to be displayed when booted to RAM Simply enter if the location allocation is not to be displayed The following information is displayed e Head location e Size e BASIC task No Enter the device U R whose multitask settings are to be displayed U Display the multitask settings of a user ROM R Display the multitask settings booted on the current RAM 4 ONLINE PROGRAMMING OPERATION MELSEC Q 5 The screen displays the result of the command execution If the command ends normally the multitask settings of the specified task area as well as the location allocation of each task number are displayed from the succeed
146. s an outline of the QD51 R24 startup procedure Check which functions are going to be used and their specifications Connect the console and module with a cable Connection between the console and debugger User s Manual Details See Section 5 4 Connect the target device and module with a cable Connection between the QD51 R24 and target device User s Manual Details See Section 5 5 Connect the GPPW and QCPU with a cable I O assignment setting of the QD51 R24 Mode setting programming mode and operation setting of the QD51 R24 User s Manual Details See Section 5 6 Perform various settings via GPPW Instructions and functions See the Programming Manual Commands Create the program Debug the program Mode setting execution mode debug mode and operation setting Set the operation mode via GPPW of the QD51 R24 e User s Manual Details See Section 5 6 End 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE MELSEC Q 2 1 2 Starting up the A1SD51S AD51H S3 The following flow chart shows the outline of the A1SD51S AD51H S3 startup procedure Check which functions are going to be used and their specifications Connect the console and module Connection between the console and debugger with a cable e User s Manual Details See Section 5 4 y Connect the target device and Connectio
147. s normally is shown 3 D gt is displayed in the line following the command execution result Enter the next command 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 5 5 Operations for Changing the Mode of the Communication Module This section explains how to use each of the debug commands for controlling modes and the operating procedure when changing the mode of the communication module 5 5 1 Changing the Communication Mode to Edit Mode 2 START Command This operation changes the mode of the communication module to edit mode 2 during the execution of multiple BASIC programs so that the program in the specified task area or other programs can be edited for instance to add or modify a code Input format shortcut for the command ST START H sP Task No i Enter Command Operation example Change the mode of the communication module to edit mode 2 in order to modify the BASIC program in the area of task No 1 whose execution has been stopped Before input D gt S THA Command Task No After input y D gt START 1 eee a U If the interpreter has not been started up the following message is displayed immediately before OK Be eee CS 5 MULTITASK DEBUGGING OPERATIONS Description AD51H BASIC ON LINE PROGRAMING Ver 7 OK MELSEC Q Enter the START command to change the mode of the communication module to edit mode 2 and the task number task N
148. s shown If the command ends normally the target BASIC program goes into the STOP status and the execution can be resumed with the TCONTINUE command 4 D gt is displayed in the line following the command execution result Enter the next command Cee 1 Precautions when entering the command e When specifying the line number a line number that exists in a program should be entered using the same decimal format as the description format in the program If a line number that does not exist in the program is entered the program will not be stopped In this case specify 65535 or 1 as a line number and enter this command again e It is only possible to specify one line number at which the execution should be stopped for any one BASIC program in any one task area The execution of a BASIC program should be stopped in such a way that it does not interfere with the system control 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q eee S eeS 2 Reference e Operation for checking the status of the current BASIC program TSTATUS command Section 5 2 1 e Operation for starting the execution from the start line again TRUN command Section 5 2 2 Operation for resuming continuing execution from a line at which execution was stopped TCONTINUE command Section 5 2 4 Operation for checking values of specified variables T command Section 5 2 5 Operation for assigning values to specified variable TLET command Secti
149. series PLC you have purchased so as to ensure correct use Please forward a copy of this manual to the end user CONTENTS 1 OVERVIEW 1 1to1 2 2 COMMUNICATION MODULE STARTUP AND MODE CHANGE 2 1to2 5 2 1 Outline of the Startup Procedure ccccecceseeeceeceeeeseeeeceeeeeeeaecaecseeeaesaecaeseeesaesaeseeseaeaeseeseaesaaeeaeseseeeeateas 2 1 2 44 Starting p the QD5T R24 staves ies ais bali navies aliens avis ea aves di avi ev 2 1 2 1 2 Starting up the A1SD51S AD51H S8 o oo cece eee cee cee eeeeeeeceeeeeeaecaeceeeeeesaesaeseeseaesaesaeseeesaeeansaeeeneaes 2 2 2 2 About Changing Between the Modes of the Communication Module cecceseeeeeeetteeeeeeeeeeeaes 2 3 3 COMMAND EXPLANATION FORMAT 3 1to3 2 4 ONLINE PROGRAMMING OPERATION 4 1to 4 41 4 1 System Command Lists seccsec y cgestharvveedey dede ba vecthate anaa baa aana aaea aiaa aaraa Aaaa saana Seau aa 4 2 4 2 Operating Procedure for Copying Deleting the Contents of Memory Cards For ADS IH SI COM Ys cect cect ew e e e aa ne aoe ra aa teda iie nated sera 4 3 4 2 1 Copying the Content of a Memory Card to Another Memory Card Without Change CCOPY Command For AD51H S S3 Only s 2228 2020 eahenawaw ated eel enn awe ae 4 3 4 2 2 Formatting a Memory Card CFORMAT Command For AD51H S3 Only J 4 5 4 2 3 Displaying Formatting Information of a Memory Card CFORMAT Command For AD51H S3 ONIY ami an a a a a a a a a 4 8 4 3 Operating Proce
150. sk number task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the executable program area of the memory card EEP ROM flash ROM from which the executable program should be loaded In the example figure to the left the executable program is loaded from the area of BASIC task No 1 Specify V if it should be checked that the contents of the load source and destination match after loading Simply press if it is not required to check that the contents match In the example figure to the left the contents are checked after loading 2 Precautions when using the MLOAD command e The size of the specified BASIC task area of the memory card EEP ROM flash ROM specified by the MSAVE or SET command and the size of the corresponding BASIC task area of the communication module specified by the START command must be the same e Specify the interpreter in such a way that it does not run in the BASIC task area of the communication module to which the executable program of the memory EEP ROM flash ROM is going to be saved The operation of the interpreter should be terminated using the TKILL command if it is running 4 ONLINE PROGRAMMING OPERATION s S gt MLOAD 1 V LOAD Y N Y 5 S gt MLOAD 1 V LOAD Y N Y LOAD OK S gt 6 MELSEC Q The screen displays LOAD Y N Enter Y to load Enter N to stop loading The console returns to waiting for a system command entry In the example
151. t messages to message ports shared among BASIC programs for each message board Input format shortcut for the command ZS ZSTATUS SP M Command Message port specification Operation example Display transmission status of the current messages Before input SP M Enter Command Message port specification U After input D gt ZSTATUS M Message Port No PRI FIFO Length Count Description Z H S H T H A H T H U H s 1 Enter the ZSTATUS command to display information managed by the OS and M to specify messages SEPM transmitted to message ports as the information type to be displayed D gt ZSTATUS M E 1 About message transmission via message ports Message transmission reception between BASIC programs becomes possible by defining message ports within BASIC programs See the AD51H BASIC Programming Manual Commands for more information All instructions related to this subject begin with ZMESSAGE 5 MULTITASK DEBUGGING OPERATIONS D gt ZSTATUS M Message Port No PRI FIFO Length Count 2 3 MELSEC Q The result of the command execution is displayed If the command ends normally the transmission status of messages to each message port is displayed from the next line information on transmission messages that have not been received yet The descriptions of the displayed information are as follows Message Port No column PRI FLSO column Length
152. tion and multiplication operations on integer values at execution and generate an Overflow error in case an overflow occurs e Check array subscript ranges during execution and generate a Subscript out of range error if a reference to an array entry outside the subscript range occurs Note however that if this option is specified the size of the executable program becomes bigger and the execution speed becomes slower Make sure to use lowercase characters to specify the options DBC v w TEST BAS A A T Lowercase 7 CREATING PROGRAMS USING A COMPILER MELSEC Q 7 5 1 For IBM PC AT Compatible PCs The procedure below shows an example of the steps involved when compiling a program created by the interpreter file name INTER BAS to an executable program file name COMP EXE 1 C gt DBC 6 v INTER BAS COMP EXE Compilation start C gt c The options 6 and v are specified C gt cd ad51h usr 2 C AD51H USR gt c ad51H system dbc Lc ad51h system v INTER BAS COMP EXE BASIC COMPILER Ver 1 0 Start the compiler masm 1 asm Microsoft R Macro Assembler Version 5 10 Copyright C Microsoft Corp 1981 1988 All right reserved Xxxxx Bytes symbol free 0 Warning Errors 0 Severe Errors 2 FATAL masm failed No such file or directory Ends with an error compiler aborted 3 Check that the following file is created basic inc n asm A number is placed in st
153. tion of command Destination Drive No net LV Number for description Description of input format shortcut for command If the command ends abnormally an error massage or similar is displayed in the succeeding line See Section 3 9 for error handling 3 S gt is displayed in the line following the command execution result Enter the next command Ell 1 About displaying the command input format A one column space entered immediately after a command indicates the entry of the key space Brackets and are symbols that indicate separation of command arguments it is not necessary to enter brackets Square brackets and are symbols that indicate that the arguments inside them are optional it is not necessary to enter square brackets 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 9 Recovering an Area in Unusable File Area in a Memory Card CRECOVER Command For AD51H S3 Only This operation locates a data area that is in the unusable status in the file area of a memory card mounted in the specified drive and recovers it to the usable status again Input format shortcut of the command CR CRECOVER Memory card interface No M enter Command Operation example Recover an unusable file area in the memory card mounted in the modules MEMORY CARD 1 Before input S gt C R EH cCHOoO Command Memory card interface No y After input S gt CRECOVER 0 RECOVER Y
154. ues currently stored in specified memory which can be either buffer memory common memory or extension register ED Input format shortcut for the command MR When displaying the values stored in memory in byte units MREAD H SP Pp Starting address Number or H B Enter bytes displayed Command Byte units When displaying the values stored in memory in word units omissible MREAD Starting address ee aih aN B Command Word units Operation example Display the values stored in EDO to ED5 in word units Before input D gt mH RHE HAH Hse 3 He Ho Ho Command Starting address 6 Ww Enter Number of Word units words displayed After input D gt MREAD 3800 6 W 3800 0000 0000 0000 0000 0000 0000 D gt Description M R E A DH SPH 3 1 Enter the MREAD command in order to display values r stored in device memory along with the starting address of 8 0 0 the memory range for which values are to be displayed using a hexadecimal number up to 4 digits 0 to 3FFF D gt MREAD 3800 The relationship between device memory and addresses is shown in Section 13 3 In an example figure to the left address 3800H of EDO is shown An even number should be specified for the least significant digit when displaying in word units The specified address will not be displayed if the least significant digit is an odd number 1 Precautions when entering the number of bytes words to be display
155. unction ae Corrective action restrictions and precautions the Commands 33 LOG e If lt numerical expression gt contains a double e Use the CSNG function on the precision real number a double precision lt numerical expression gt to make sure value is returned otherwise a single precision that it becomes single precision value is returned 34 MERGE e The MERGE instruction is not supported A not supported error is generated at compilation MKDMBF e Converts double precision internal representation data of IEEE format only If data of other types is entered it is converted assuming it is data of IEEE format 36 MKSMBF e Converts double precision internal representation data of IEEE format only If data of other types is entered it is converted assuming it is data of LEEE format 37 NEW The NEW instruction is not supported NEW can be used as a variable name e If a value outside the range from 32768 to e Check the range using the IF instruction 11 144 65535 is specified in lt numerical expression gt before the OCT function and generate the result is the same as if 32767 is specified an error using the ERROR instruction if necessary ON COM GOSUB e The interpreter performs an interrupt at the Do not write any multi statements at the 11 145 beginning of each instruction while the first line of an interrupt processing compiler performs an interrupt at the beginning of each line PRINT USING USI
156. xample figure to the left 32 points 32 bits are specified 5 MULTITASK DEBUGGING OPERATIONS MELSEC Q 4 The result of the command execution is displayed in the D gt B EM 16 32 following line EM0016 00000000 00000000 If the command ends normally the bit information of the EM0032 00000000 00000000 specified device range is displayed For X Y 16 points of bit information corresponding to device numbers from if if 10 to _ jf F are displayed as 0 off or 1 on in one line using the format shown below For EM 16 points of bit information corresponding to device numbers from an integral multiple of 16 to the next integral multiple of 16 minus 1 are displayed as 0 off or 1 on in one line using the format shown below Note that if the least significant digit of the specified number for X Y is different from 0 n or the specified number for EM is different from an integral multiple of 16 n the bit information corresponding to 0 or an integral multiple of 16 Pe An ole an 1 l ie PAA Ea i TE lt e f F baad bannen poig tO pI T LILI to piid Number Bit information for the 8 bits Bit information for the next A starting from the device 8 bits following the value to Device type number to the left 0 1 the left 0 1 If the command ends abnormally Error message and an error code are displayed In an example figure to the left a display where the command ends normally is shown 5 D gt
157. xpressions and lines into separate pieces 1 Fatal Errors Meaning Corrective action An intermediate x ASM file a number is This may happen because directories cannot be created placed instead of x cannot be created in the Jete directory full Delete unnecessary files and compile current directory again An intermediate BASIC INC file cannot be This may happen because directories cannot be created created in the current directory etc directory full Delete unnecessary files and compile again can t create work file 2 An intermediate BC TMP file cannot be This may happen because directories cannot be created created in the current directory etc directory full Delete unnecessary files and compile again compiler stack overflow There is not enough stack memory area Avoid complicated expressions and use simple ones allocated inside the compiler Reduce the number of nested expressions such as FOR NEXT This error typically occurs when there are 20 to 35 nested expressions data area overflow 65000 bytes The data area necessary for variables and In many cases the cause is declaration of huge arrays constants is too big to allocate Reduce the size of the arrays evaluation stack overflow An expression in one statement is too Make the expression less complicated by assigning an complicated intermediate value of the expression to a variable etc file I O error An error occurred when
158. y SET OK is displayed If the command ends abnormally an error message or similar is displayed In the example figure to the left a display where the command ends normally is shown S gt 8 S gt is displayed in the line following the command execution result Enter the next command CLL 2 About the size specification e Sizes can be specified in hexadecimal digits amp H f__ instead of decimal digits 3 Reference e Operation for saving BASIC task area information of the communication module to a memory card EEP ROM flash ROM MSAVE command Section 4 3 2 ee wee tt Operation for displaying the multitask settings SET Command Section 4 4 2 Operation for changing the mode of the communication module to the edit mode 1 START command Section 4 5 1 4 20 4 20 4 ONLINE PROGRAMMING OPERATION MELSEC Q 4 4 2 Displaying Set Data for Multitask Settings SET Command This operation displays the specified contents of the multitask settings for each BASIC task area of the communication module Input format shortcut for the command S When specifying one of the BASIC task areas Specifying memory Device to be SP j BASIC task No location display displayed Command When specifying all the BASIC task areas Command Operation example Display the specified contents of the multitask settings for BASIC task No 1 area of the communication module Before input sH eE Ht H H
159. y a new start line number at XXX If this is omitted 10 is used Specify the previous start line number at XXX If this is omitted the line at the beginning of the program is used Specify an increment value at XXX If this is omitted 10 is used Specify the line number where the line number change operation should end at XXX If this is omitted the last line of the program is used Specify the source file name of the BASIC program If no extension is specified it is assumed to be BAS Specify the name of the output file to which the result of the line number change operation should be output If no name is specified the file name obtained by changing the extension of the source file name to BAS is used as output file name If only the extension is not specified the extension of an output file name is assumed to be BAS The extension of the source file is changed to OLD Make sure to use lowercase characters to specify the options DRENUM s 10 t 100 TEST BAS Lowercase 6 CREATING BASIC PROGRAMS WITH A GENERAL PURPOSE EDITOR MELSEC Q The procedure below shows an example of the steps involved when using the line numbering tool to add line numbers to a program created in a general purpose editor 1 Create the program using the general purpose editor the program is created without line numbers Source file name C AD51H USR TEST BAS Branching according to the conditio
160. y the setting contents of the multitask settings accordingly 4 ONLINE PROGRAMMING OPERATION MELSEC Q Description M S A V E H SP 1 Enter the MSAVE command to save an executable program v to a memory card EEP ROM flash ROM from the S gt MSAVE communication module Enter the BASIC task area task No 1 to 8 can be specified for AD51H S3 1 or 2 for A1SD51S QD51 R24 of the S gt MSAVE 1 communication module from which the executable program is going to be saved In the example figure to the left the executable program in the area of BASIC task No 1 of the AD51H is specified to be saved H vH Enter 3 Specify V if it should be checked that the contents of the save source and destination match after saving S gt MSAVE 1 V Simply press if it is not required to check that the i contents match In the example figure to the left the contents are checked after saving 3 Processing of the MSAVE command The contents of the memory corresponding to the size of the BASIC task area of the communication module specified by the START command are saved in the target BASIC task area of a memory card EEP ROM flash ROM as an executable program e After saving the executable program the multitask settings are automatically specified for the relevant BASIC task area The following settings are specified See the reference section in the SET command for details Startup condition The BOOT attribute is set Size
Download Pdf Manuals
Related Search
Related Contents
PTR BALER AND COMPACTOR COMPANY IRSS2010 Steam Iron User Manual IRSS2010 Steam Iron User Logic & Logic16 User's Guide Contents Samsung LE15S51B User's Manual MPX-4PA MISCHPULT FÜR 3 ZONEN Page 1 Page 2 ワイぜードリングには醜は輿っていません〝 LEロの軌が USER MANUAL - Fiorentini SpA Copyright © All rights reserved.
Failed to retrieve file