background image

(Command)

AD51H-BASIC Programming Manual(Command)

P

Programming Manual

Mitsubishi Programmable 
Logic Controller

When exported from Japan, this manual does not require application to the
Ministry of International Trade and Industry for service transaction permission.

Specifications subject to change without notice.

HEAD OFFICE : MITSUBISHI DENKI BLDG MARUNOUCHI TOKYO 100-8310 TELEX : J24532 CABLE MELCO TOKYO

NAGOYA WORKS : 1-14 , YADA-MINAMI 5 , HIGASHI-KU, NAGOYA , JAPAN

MODEL

MODEL

CODE

BASIC-P-COM2-E

13JF63

SH(NA)-080090-B(0009)MEE

QD51
QD51-R24
A1SD51S
AD51H-S3

AD51H-BASIC

Programming Manual(Command)

AD51H-BASIC

Содержание A1SD51S

Страница 1: ...Command Programming Manual Mitsubishi Programmable Logic Controller QD51 QD51 R24 A1SD51S AD51H S3 AD51H BASIC...

Страница 2: ...ad 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 whe...

Страница 3: ...e 516 PCWT instruction processing code 516 Japanese Manual Version SH 080094 B This manual confers no industrial property rights or any rights of any other kind nor does it confer any patent licenses...

Страница 4: ...ode 2 4 2 3 Line Format 2 4 2 4 Spaces and Keywords 2 5 2 5 Characters Used in BASIC 2 6 2 6 What are Instructions and Functions 2 9 2 7 Constants 2 10 2 7 1 Character string constants 2 10 2 7 2 Nume...

Страница 5: ...3 3 6 2 Jump depending on a value 3 23 3 6 3 Loop for the number of times specified 3 24 3 6 4 Loop while a certain condition is met 3 25 3 7 Letting BASIC Make Decisions 3 26 3 7 1 Condition specific...

Страница 6: ...ta files during multitask processing 6 12 6 4 2 Number of data files that can be handled by each program 6 13 7 COMMUNICATION WITH EXTERNAL DEVICES 7 1 to 7 14 7 1 Correspondence between the Interface...

Страница 7: ...cter code 11 20 CIDB Converts a 32 bit integer into a double precision real number 11 21 CINT Converts a single precision real number or a double precision real number into an integer 11 23 CISN Conve...

Страница 8: ...e name 11 68 FIX Returns only the integer part after truncating the fractional part of the numeric value 11 69 FOR to NEXT Executes a series of instructions for the specified number of times 11 70 FOR...

Страница 9: ...ecord units 11 135 LOG Returns a natural logarithm value 11 136 LPRINT Outputs data to the printer 11 137 LPRINT USING Outputs data in the specified format to the printer 11 138 LSET Moves data from m...

Страница 10: ...of device memory of the Q QnA series PLC 11 235 PCRD Processing Code 533 Reading the buffer memory of the intelligent functional module of the Q QnA series PLC CPU 11 246 PCWT 11 256 PCRD Processing...

Страница 11: ...utes after loading a program 11 370 SAVE Saves a program 11 371 SEARCH Searches for the specified value among the elements of the selected array variable and returns the position of the element 11 372...

Страница 12: ...ft in out codes 11 427 ZCNTL Processing Code 128 Reading the printer status 11 430 ZCNTL Processing Code 136 Outputting the initialization signal to the printer 11 432 ZEVENT Enables or disables event...

Страница 13: ...ed Words App 24 Appendix 7 Details of Communication Control App 26 Appendix 7 1 DC1 DC3 Control App 26 Appendix 7 1 1 DC1 DC3 transmission control enabled App 26 Appendix 7 1 2 DC1 DC3 reception contr...

Страница 14: ...package and must be purchased separately Recommended Products IBM AT Compatible Personal Computer Turbo Assembler Ver 5 0 Inprise Corporation 1 64 8 Sasazuka South Building Sasazuka Shibuya ku Tokyo...

Страница 15: ...used with the communication module Please refer to the following manuals as necessary when using AD51H BASIC AD51H S3 User s Manual IB Name 68350 A1SD51S User s Manual Details SH Name 3523 QD51 R24 U...

Страница 16: ...unication module internal devices When multiple programs are executed simultaneously using the multitask processing function data can be communicated using the following means 1 Message ports 2 Commun...

Страница 17: ...r descriptions Square brackets indicates that the arguments inside them are optional brackets indicates that the arguments inside them are optional or can be repeated indicates that the single item in...

Страница 18: ...odule and connecting the console Perform settings and connections for each communication module 2 Console preparation Carry out the online programming items according to the Type SW IVD AD51HP SW NX A...

Страница 19: ...programming mode This mode allows creation of a BASIC program and execution of a single task program 5 Execute the SYSTEM instruction or press the Ctrl D keys to change the mode of the communication m...

Страница 20: ...gramming and execution in edit mode with the exception of multitask instructions Execution mode This mode allows multitask execution of BASIC programs that use multitask instructions It is not possibl...

Страница 21: ...at specify a series of operations that the computer performs Designing and testing a program is referred to as programming Programs stored in memory can be executed by entering the RUN instruction of...

Страница 22: ...wing the BASIC syntax and form the smallest element of a sentence 4 Colons Colons are symbols used to separate statements when one sentence contains multiple statements Sentences comprised of one stat...

Страница 23: ...expressed in JIS kanji code as an internal BASIC code In this manual characters that are represented by 1 byte of code are referred to as half byte characters and characters that are represented by 2...

Страница 24: ...tion symbol character string addition symbol Comma Delimiter Example INPUT A B PRINT X Y Z DATA 10 13 91 4 Negative sign minus hyphen Negative sign subtraction symbol Used to specify a range of lines...

Страница 25: ...mark Substitution for the PRINT instruction Example A B FRE 0 TIME Commercial at Left bracket Yen sign Integer division symbol Right bracket Accent circonflexe upward arrow head Power symbol _ Unders...

Страница 26: ...Functions Functions in BASIC return a single value in response to 1 or multiple arbitrary input values Functions can only return values Therefore in order to use the results they are used in conjuncti...

Страница 27: ...ers Numeric constants cannot contain any commas There are the following 5 types of numeric constants 1 Integer constants All integers between 32768 to 32767 with or without a symbol Decimal points can...

Страница 28: ...ts Double precision constants are stored in a memory with an accuracy of 16 significant digits 1 Single precision constants are numeric constants that can be categorized into one of the following a Co...

Страница 29: ...nd operator names If a variable name begins with FN it is considered to be a call to a user defined function Variables represent either numeric values or character strings The last character of a char...

Страница 30: ...ions in the array Subscripts indicate the location of each element within an array The range of values that subscripts can have is from 0 to 32767 For example each element of arrays A and B above can...

Страница 31: ...o read and write to from the special EM and special ED extension devices 1 Reading from and writing to bit devices B EM expression Specify a value between 0 and 1023 for the expression B X expression...

Страница 32: ...tween 0 and 1023 for the expression Specify a device number in the expression If the data is not an integer constant or an integer variable when the write operation is performed the value is changed t...

Страница 33: ...and the lower 16 bits of data are stored in A 0 and the upper 16 bits of data are stored in A 1 120 W ED 102 A 0 130 W ED 103 A 1 The lower 16 bits of data stored in A 0 is written to ED102 and the up...

Страница 34: ...ger Single precision real number Single precision real number Integer Double precision real number Double precision real number Single precision real number Single precision real number Single precisi...

Страница 35: ...nd Operators Expressions are simply constants or variables combined in order to obtain a character string constant numeric constant variable function or a certain value Numeric expressions deal with n...

Страница 36: ...C expression X 2Y X Y 2 X Y Z X Y Z XY Z X Y Z X Y Z X Y Z X2 y X 2 Y XYZ X Y Z X Y X Y Note that the multiplication division and power symbols are different from their mathematical symbols n n Intege...

Страница 37: ...f the result of the logical operation is False Example A B A C A AND MASK 2 2 10 2 Relational operators Relational operators are used to compare two values The results of comparisons are expressed as...

Страница 38: ...1 NOT Negation 2 AND Conjunction X NOT X X Y X AND Y 1 0 1 1 1 0 1 1 0 0 0 1 0 0 0 0 3 OR Disjunction 4 XOR Inequivalence exclusive OR X Y X OR Y X Y X XOR Y 1 1 1 1 1 0 1 0 1 1 0 1 0 1 1 0 1 1 0 0 0...

Страница 39: ...using logic operators Example 63 AND 16 16 63 is 111111 in binary code 16 is 10000 in binary code Therefore 63 AND 16 16 63 0000 0000 0011 1111 AND 16 0000 0000 0001 0000 0000 0000 0001 0000 16 15 AN...

Страница 40: ...identical the character strings are considered equal However if there is even one different byte the character string with the lesser character code is considered to be the lesser of the two Also if...

Страница 41: ...ty Order of Operations Operations are performed in the following order Operators on the same level take priority from left to right Expressions enclosed in parentheses Functions Exponent power Negativ...

Страница 42: ...VD AD51HP Please make the following settings on the IBM AT compatible personal computer and the communication module Communication module Set the module so that it is in edit mode and the IBM AT compa...

Страница 43: ...al should be substituted with the appropriate keys as follows Enter Carriage Return Key Typically corresponds to the CR key Ctrl Control Key Typically corresponds to the CTRL and CNTL keys Insert Inse...

Страница 44: ...d with one another Therefore it is always necessary to execute the NEW instruction Now the console is ready for program creation Enter the following program 10 REM Calculation of compound interest 20...

Страница 45: ...screen again Now let s verify that you have entered the program properly Use the LIST instruction to display the program you have entered Please enter the following LIST Enter If the program looks jus...

Страница 46: ...and Period Enter 5 Enter and 3 Enter in the same way This means the interest rate is 5 and the period is 3 years After the entry to Period is finished the screen will display the following message and...

Страница 47: ...mple 130 PRINT BYE Enter In order to insert a line enter a line number that lies between line numbers of the current program enter the instruction and press Enter to 10 INPUT Production Target A 20 IF...

Страница 48: ...ay Press the Ctrl C keys to stop the list display of the program in the middle 2 Next move the cursor to the area you want to edit by using the following keys Moves the cursor one line up Moves the cu...

Страница 49: ...rsor to A on line 30 2 Press the Insert key four times to make enough space to add 100 3 Press 1 0 0 and then the Enter key This completes the editing LIST 10 A 2 20 B 7 30 C 100 A B 0 PRINT C 50 END...

Страница 50: ...A OK 10 LIST 15 A 10 5 20 PRINT A OK Pressing will erase line 10 This completes the editing See 1 in Section 3 2 3 Enter 1 0 When the LIST instruction is used again to confirm the change it is seen t...

Страница 51: ...hat are saved by the SAVE instruction in BASIC This area is used to store programs that are automatically started upon startup of the AD51H S3 and programs that are started from the PLC CPU or a BASIC...

Страница 52: ...e program will be saved Memory card mounted in MEMORY CARD 1 0 Memory card mounted in MEMORY CARD 2 1 AD51H S3 only Drive A of the console 2 Drive C of the console 3 Drive D of the console 4 REMARK FD...

Страница 53: ...t BAS MonthlyReport BAS Line Monitor Line1 BAS Composition BAS Assembly BAS System Name is used to specify the group name If a specified System Name does not exist a new System Name is registered and...

Страница 54: ...follow the rules described below Permitted characters are alphabet characters numeric characters kana full byte characters Kanji and the following symbols _ A file name is comprised of a file name and...

Страница 55: ...memory card mounted in MEMORY CARD 1 SAVE 2 KEISAN BAS Save a program with no system name and file name KEISAN No1 in the A drive of the console MITSUBISHI MEMORY CARD A6MEM 512KA W Store necessary pr...

Страница 56: ...in the same manner as for the SAVE instruction See 1 through 3 of Section 3 3 1 2 If a non existent System Name or File Name is specified an error File not found will occur Usage examples LOAD 1 Naga...

Страница 57: ...S 1 See Section 3 3 1 1 through 3 for how to specify Drive Name System Name and File Name 2 System Name and File Name can be omitted Wildcards fuzzy specification can also be used for the File Name Se...

Страница 58: ...file JR DAT stored under system name HIJ in the file area of the memory card 3 Since there is no file by the name JR DAT under system name HIJ on the memory card a File not found error is generated F...

Страница 59: ...Drive Number System Name New File Name 1 See Section 3 3 1 1 and 2 for the contents and specification method of Drive Name and System Name 2 File name to be Changed and New File Name are specified ex...

Страница 60: ...m Name File Name 1 See Section 3 3 2 1 and 2 for the contents and specification method of Drive Name and System Name 2 File Name is specified exactly in the same manner as File Name described in Secti...

Страница 61: ...A 30 A A 2 40 PRINT A 50 END RUN 1 3 OK Line 30 states that A A 2 If this were an equation the expression 0 2 would be obtained by subtracting A from the both sides which would be invalid However the...

Страница 62: ...d no matter how scattered they are In addition any character strings can be used 51H A MEE B TD C PC D MTC BM CM However the following program has a problem 10 DATA 51H 20 READ A B C 30 DATA MEE 70 DA...

Страница 63: ...umbers can be specified when using the RESTORE instruction The following illustrates what happens when a line number is specified The value of the DATA instruction in line 20 is used again by the REST...

Страница 64: ...nstruction Press the Break key or the Ctrl C keys to force an execution to stop After a Break in message is displayed it will return to OK Will it ever stop 3 6 2 Jump depending on a value The ON GOTO...

Страница 65: ...30 NEXT N RUN 2 2 5 3 3 5 4 OK 10 FOR N 5 TO 1 STEP 2 20 PRINT N 30 NEXT N RUN 5 3 1 OK 0 5 2 0 5 0 5 0 5 2 Do not use the GOTO instruction or IF GOTO instruction to exit from instructions in the loo...

Страница 66: ...dition stated immediately after WHILE is met For details on how to specify conditional expressions see Section 3 7 The WHILE WEND instructions are loop instructions very similar to the FOR NEXT instru...

Страница 67: ...t equal to B More conditions can be created by combining these symbols with the logical operators AND and OR When a condition is combined with another condition they are referred to as logical express...

Страница 68: ...tatements Section 2 3 3 Enter the instruction to be executed when Condition or logical expression is not met after the ELSE instruction As with 2 any instructions can be entered and multi statements S...

Страница 69: ...splayed The value of A is not 0 1 The reason for this is that single precision or double precision values are stored in the memory in floating point format thus it is sometimes not possible to hold th...

Страница 70: ...r within the parentheses is 99 array entries 0 through 99 are allocated DIM A 99 This allocates locations to place data as shown below A 0 A 1 A 2 A 3 A 98 A 99 If 70 is to be assigned to A 50 enter t...

Страница 71: ...0 2 1 C 1 2 1 C 2 2 1 C 0 2 2 C 1 2 2 C 2 2 2 A 0 A 1 A 2 B 0 0 B 0 1 B 0 2 B 1 0 B 1 1 B 1 2 B 2 0 B 2 1 B 2 2 C 0 0 0 C 0 1 0 C 0 2 0 C 1 0 0 C 1 1 0 C 1 2 0 C 2 0 0 C 2 1 0 C 2 2 0 One dimensional...

Страница 72: ...amely the GOSUB instruction and RETURN instruction are used Modify the program above so that it looks like as shown below RUN OK 10 READ A 20 GOSUB 70 30 READ A 40 GOSUB 70 110 RETURN 50 DATA 5 9 60 E...

Страница 73: ...usly by separating them by comma and semicolon with the PRINT instruction Examples of using semicolon are shown below Example OK A 100 OK B 50 OK PRINT A B A B 00 50 50 Contents of A Contents of B Con...

Страница 74: ...characters 14 characters 14 characters 14 characters When commas are used as separators the location where the next data will be displayed in the beginning of the next area The BASIC operation automat...

Страница 75: ...h when or is used 2 SPC Function When the SPC function is used a number of blank spaces can be displayed from the last displayed character position Use semicolon as a separator for the SPC function Wh...

Страница 76: ...AT compatible personal computers The number of lines that can be displayed on the screen will vary depending on the console The LOCATE instruction directly specifies the display position using coordi...

Страница 77: ...position in vertical direction This allows the specification of the screen display position and then the PRINT instruction can be used to display characters Example 10 CLS This instruction clears the...

Страница 78: ...to place data Example BASIC is asking for the value of A For example if 6 is the value for A input 6 and press the Enter key Similarly BASIC is asking for the value of B For example input 10 and pres...

Страница 79: ...eyboard status and the program is not be paused The INKEY function uses an empty as the value and uses the text as the value when a key is pressed However since this value is a character string the su...

Страница 80: ...ter connected to CH4 PARALLEL interface ZLDV 4 Data to be sent to the printer is specified using the LPRINT instruction The contents that are written after the LPRINT instruction are exactly the same...

Страница 81: ...Half byte character unit processing 1 To extract a portion of a character string There are three functions that can be used to extract a certain portion of a character string and create a new characte...

Страница 82: ...s Character Code A 65 B 66 The ASC function and CHR function are used for conversion between ASCII codes and characters Example OK PRINT ASC A 65 OK PRINT CHR 65 A OK A ASC CHR 65 Character Value Only...

Страница 83: ...ion converts character strings to numeric values Example Continued from Example above A VAL A OK PRINT A B 13501 OK Conversely when handling numeric values as character strings the STR function is use...

Страница 84: ...in the example above full byte characters are counted as two characters When full byte characters as contained in the character string in which LEFT MID or RIGHT is to be used full byte characters mus...

Страница 85: ...rs from the nth character counting from the left within the character string A When this is performed full byte characters are considered one character and the result is as follows Example 10 A A B C...

Страница 86: ...acters There are characters among full byte characters that are the same type of characters as half byte characters alphabets numbers English symbols and Katakana These characters can be converted bet...

Страница 87: ...se only radian angular measurements when obtaining trigonometric values Radians Angle x 180 2 Exponential functions and logarithmic functions ex EXP X logeX LOG X This is a natural log There is no fun...

Страница 88: ...ontents have to be transferred The CHAIN instruction is used 3 When a portion of the program is shared The CHAIN instruction is used 1 When the variable contents do not have to be transferred When the...

Страница 89: ...ferred 10 PRINT Program B executed 20 PRINT A A 30 END SAVE PRO B OK NEW OK 10 PRINT Program A executed 20 A 100 30 PRINT A A 40 CHAIN 0 PRO B 10 ALL SAVE PRO A OK RUN Program A executed A 100 Program...

Страница 90: ...PRINT B B 1020 RETURN SAVE PRO A OK RUN Program A executed A 7 B 3 Program B executed A 4 B 3 OK LIST 70 PRINT Program B executed 80 A 4 GOSUB 1000 90 END 1000 PRINT A A 1010 PRINT B B 1020 RETURN OK...

Страница 91: ...32768 through 32767 not including decimals As shown above data is handled differently between the PLC and BASIC Therefore it is necessary to perform data conversion between real numbers and integers t...

Страница 92: ...hand over parameters that are used to notify the process contents to the system when the above processes are performed by the BASIC program The BASIC program stores the necessary parameters in one arr...

Страница 93: ...special function module can be accessed for remote I O stations Local Station 1 self station Master Station Communication module Local Station 1 Local Station 2 Remote Station 2 Local Station 3 Maste...

Страница 94: ...LC communication is to be made is performed by specifying the station number within the same loop of self station However when performing access to the self station the station number is specified as...

Страница 95: ...E PLC AND BUFFER MEMORY 2 MELSECNET 10 Network parameter settings using the GPP function will be required for access to PLCs of other stations For details on network parameter settings refer to the ME...

Страница 96: ...tween PCs Network No 2 Net between PCs Network No 3 Remote I O Net Standard Station 1Ns2 Standard Station 2Ns2 Control Station 1Mp1 Self station 2 When the CPU self station with the communication modu...

Страница 97: ...rol stations Mp and standard stations Ns N from other networks can be accessed Standard Station 2N3 Remote Station 3R2 Standard Station 1Ns4 Control Station 2Mp1 Standard Station 2Ns4 Master Station 3...

Страница 98: ...ata from the self station and all MELSECNET 10 stations can be accessed Local Station L3 Standard Station 1Ns4 Master Station M Remote Station 2R1 Standard Station 1N2 Communication Module Control Sta...

Страница 99: ...ontrol stations Mp of the same network can be accessed Local Station L3 Standard Station 1Ns4 Master Station M Remote Station 2R1 Communication Module Control Station 1Mp1 Standard Station 1N2 Remote...

Страница 100: ...control stations Mp and standard stations Ns N of other networks can be accessed Local Station L3 Standard Station 1Ns4 Master Station M Control Station 1Mp1 Standard Station 1N2 Remote Station R2 ME...

Страница 101: ...L data from the self station and MELSECNET II master stations M can be accessed Local Station L3 Standard Station 1Ns4 Master Station M Control Station 1Mp1 Standard Station 1N2 Remote Station R2 Rem...

Страница 102: ...designation 16 points are accessed as a group Word designation M0 to M0 to M15 M8 M7 When word unit process is specified 16 bits of process points will be specified Also when word unit is specified th...

Страница 103: ...18 H12 D Data register 0 to 1023 0 to 8191 D Special register 9000 to 9255 19 H13 W Link register 0H to 3FF H 0 H to 1FFF H 20 H14 R File register 0 to 8191 The numbers within parentheses for the usab...

Страница 104: ...0 HC8 SN Accumulated timer current value 0 to 2047 196 HC4 CS Counter contact 0 to 1023 195 HC3 CC Counter coil 0 to 1023 197 HC5 CN Counter current value 0 to 1023 161 HA1 SB Link special relay 0 to...

Страница 105: ...20 bits of data from X10 using integer array A to X23 X18 X10 to X17 1 1 0 1 1 1 0 1 1 1 1 1 0 0 0 0 toX20X1F 0 0 1 1 A 0 Corresponds to X10 to b0 to b15 b8 b7 X11 A 1 Corresponds to X12 X13 Ignores b...

Страница 106: ...The data for the number of devices designated is stored using characters compatible with the JIS8 code Therefore the amount of data required for storing and setting the amount of data designated in t...

Страница 107: ...to 4H 2H 0 1 0 0 0 0 0 1 b7 M47 b0 M40 to 4H 1H 0 1 1 0 0 0 0 0 b7 M39 b0 M32 to 0H DH 0 0 1 0 0 1 1 0 b7 M63 b0 M56 to 4H 3H 0 1 1 0 0 0 0 1 b7 M55 b0 M48 41H A 42H B 43H C 0DH CR code The first 8 po...

Страница 108: ...ly as character codes 2 words of data from D10 are accessed using character variable MOJI to b7 b0 to b7 b0 b15 b8 b7 b0 to to 19788 D10 Upper 8 bits Lower 8 bits to b7 b0 to b7 b0 b15 b8 b7 b0 to to...

Страница 109: ...X1F X18 X17 to EM0 to 1 1 1 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 1 1 EM15 EM8 EM7 EM19toEM16 Word Units When bit devices are designated using word units the 16 points of ON OFF data for each ED will be pair...

Страница 110: ...PLC PLC CPU side BASIC AD51H BAISC side The addresses from the PLC CPU side are in lead units but the BASIC side addresses are in byte unites Therefore BASIC uses 2 addresses when 1 word data are bei...

Страница 111: ...er Array Variables RD The PUTMEM and GETMEM instructions are used in common memory and while sharing access of internal devices ED Note that when addresses 1800h through 7FFFh viewed from BASIC are us...

Страница 112: ...apter 5 1 Communications Module PLC CPU About Input Device X Turns ON OFF the input X in the sequence program by Special variable B When the input device X is turned ON OFF using special variable B th...

Страница 113: ...ommunications Module System Down H0D X1E to X1F Cannot be used since it is used by the system X20 to X2F Can be used as a general purpose input H10 to H1F X1B X1C and X1D should not be turned ON or OF...

Страница 114: ...ultitask Execution Start X1B will be turned OFF when Multitask Execution Stop X1C or Communications Module System Down X1D are turned ON X1C Multitask Execution Stop Turns ON when an error is generate...

Страница 115: ...sequence program the next corresponding output device is turned ON OFF in the communication module Example For AD51H S3 Open Y 50 to 6F 0 to 1F Communications module When the starting input number of...

Страница 116: ...No 1 through BASIC Task No 8 H11 to H18 Y29 Program Startup H19 Y2A to Y2F Cannot be used since it is used by the system H1A to H1F Y2A through Y2F cannot be used by the user since it is used by the s...

Страница 117: ...1 through BASIC Task No 8 Sets the programs that correspond to output Y that has been turned ON between Y21 through Y28 for startup The programs that correspond to output Y are as follows Y21 Y28 Sets...

Страница 118: ...neral purpose output Starts up the program that has been designated as startup programs by output Y in Y21 through Y28 Example Starts up the programs BASIC Task No 1 and BASIC Task No 7 Y21 X50 PLC CP...

Страница 119: ...blocks This allows a required portion of the data to be read and written However wasted space will be created if data that is smaller than a block is saved Random file Random files are like data stor...

Страница 120: ...T AS 2 For random files When data is being input and output from a random file 1 R 2 DAT 2 will be used as the file number 1 OPEN 0 A 1 DAT FOR OUTPUT AS 1 For sequential files When data is being outp...

Страница 121: ...see Appendix 1 Do not forget to use the CLOSE instruction when data write is complete If the CLOSE instruction is not used the data may not be written When appending writing data to a sequential file...

Страница 122: ...dle these as three separate data commas must be used as separators PRINT n A B C CR LF 3 2 1 C B A Contents of data file BASIC treats the commas as separators so these are treated as three separate da...

Страница 123: ...s case there is no separator between 80 5 and 13 15 so the contents of the data file will be treated as one data Also spaces are ignored when using numeric data in BASIC but since data such as 80 513...

Страница 124: ...W Data entered in line 50 is written into the file 100 INPUT Continue Y N Y 110 IF Y Y OR Y y GOTO 20 Repeats data input 120 CLOSE 1 Closes the file 130 END 1 Read data from the sequential file writte...

Страница 125: ...d numbers File buffer acts as a window when performing I O with random files The character variables defined by the FIELD instruction are used during I O for the file buffer Therefore data written int...

Страница 126: ...tion to read the data and convert them into numeric data However character data converted using MKI MKS or MKD function must be converted into numeric data using the CVI CVS or CVD functions Character...

Страница 127: ...res on specifying filename see Appendix 1 1 Open the file OPEN filename AS n 2 Define a file buffer FIELD n 8 AS A 32 AS B 3 Place the data in the file buffer if data is to be written LSET RSET The da...

Страница 128: ...no longer be performed in the file Furthermore input output operation cannot be performed in the file buffer 3 Read the data into the file buffer using the GET instruction if data is to be read File...

Страница 129: ...data entered in line 70 into file buffer 120 LSET W MKS W1 Writes data entered in line 80 into file buffer 130 PUT 1 R 140 INPUT Continue Y N Y 150 IF Y Y OR Y y GOTO 40 Repeats data input 160 CLOSE 1...

Страница 130: ...instruction so the user does not have to perform any exclusive control Example When two programs are concurrently running and sequential file ABC DAT in drive 0 is to be read A A Program A MELSEC AD5...

Страница 131: ...opened simultaneously has a different number for each program 4 A 1 B 3 C Drive 0 ABC DAT 6 4 2 Number of data files that can be handled by each program A maximum of eight data files can be opened sim...

Страница 132: ...mber is assigned to each interface In order to communicate with an external device or terminal specify which of the communication module interfaces is to be used using the channel number in question A...

Страница 133: ...user s manual of each communication module Baud rate Specify this parameter when using the ZOPEN instruction Specify the speed of the data communication The following values can be set in BASIC 300 b...

Страница 134: ...3 code is received and it is resumed when a DC1 code is received The settings of the DC1 DC3 control on the communication module side and on the external device side have to be the same Signal control...

Страница 135: ...printer that uses JIS Kanji code This conversion between Shift JIS and JIS Kanji codes is automatically performed by specifying to convert the Kanji codes using the ZCNTL and KMODE instructions Pleas...

Страница 136: ...h parity and stop bit parameters If too many parameters are listed after the instruction however the program will be hard to read If a control table is used here the actual instruction becomes concise...

Страница 137: ...of the communication module See the user s manual of each communication module for the details 1 To display data on the console screen Always 0 when the console is specified 1 Switch the output destin...

Страница 138: ...owever that some instructions functions cannot handle certain character codes INPUT Character codes 0 through 1FH control codes 2CH comma 7FH Delete 80H and FDH through FFH cannot be handled as data L...

Страница 139: ...een of the specified terminal Format can be specified LOCATE Specifies the data display location at the specified terminal screen CLS Clears the screen of the specified terminal Note that the TAB and...

Страница 140: ...le ZCNTL channel number 0 control table INPUT Character codes 0 through 1Fh control codes 2Ch comma and 7Fh Delete cannot be handled as data LINE INPUT Character codes 0 through 1Fh control codes and...

Страница 141: ...uction ZLDV 0 2 Use the following instructions to print on the printer IBM AT compatible personal computer ZLDV 0 Use ZLDV 0 in order to print to the printer connected to the console LPRINT Prints dat...

Страница 142: ...specified printer LPRINT USING Prints data on the specified printer Format can be specified LLIST Prints a program list on the specified printer AD51H Note that the TAB and SPC functions can also be...

Страница 143: ...SEND instruction ZSEND channel number control table output element When the execution of the ZSEND instruction is completed the number of bytes of transmitted data is stored in the control table used...

Страница 144: ...eceived data as follows To store the received data in a character variabl SPACE 255 To store the received data in an integer 0 To store the received data in an array DIM n c Execute the ZRECEIVE instr...

Страница 145: ...struction in advance in order to execute the communication interrupt routine Receive data ON COM GOSUB COM ON RETURN Communication interrupt routine Normal processing routine Any processing can be exe...

Страница 146: ...The switching of the execution of each program by the OS scheduling by the OS during the parallel processing occurs according to the priority of each program refer to Section 8 4 Execution Priority an...

Страница 147: ...while an input output instruction is being executed to the screen keyboard disk peripheral device or external device or an execution interrupt instruction is being executed 4 Sleep status __________ A...

Страница 148: ...less the program execution switching instruction shown in Appendix 3 is executed Priority A 1 2 3 STOP STOP C Only the program with the highest priority is executed Programs with low priorities are no...

Страница 149: ...tion of each program Then it lets the program execute until the next execution switching occurs By repeating this operation the communication module allows multiple programs to run in parallel Priorit...

Страница 150: ...kept waiting for a signal WAIT status and is allowed to continue its execution when the appropriate signal event is given B B B A A A Task A Task B Signal You may start In addition to the BASIC progra...

Страница 151: ...rol the BASIC program which is made to wait for the event generation has to be placed in the status where it waits for the event generation before the event occurs If an event occurs but no BASIC prog...

Страница 152: ...to occur 4 ZSIGNAL The event occurs Synchronization BASIC program A BASIC program B As shown above execute steps 1 and 2 in one program and then generate the event while one of the programs is waiting...

Страница 153: ...e means limiting access to that certain resource While one program is using a certain resource other programs are prevented from using the resource when multiple programs are executed simultaneously T...

Страница 154: ...t must execute the ZRELEASE instruction immediately so that another program can use the resource If the resource with the assigned resource number is already being used by another program when the ZRE...

Страница 155: ...n drive 0 assign 2 as the file s resource number then execute the ZRESERVE instruction Programmer A 2 2 Programmer B MITSUBISHI MEMORY CARD A6MEM 512KA W ABC NEW file An example of the steps for assig...

Страница 156: ...The use of the resource is finished and the resource is released The privilege to use the resource is transferred to program A Device to which access is limited Resource number n ZRESERVE n Request U...

Страница 157: ...eferable to release the execution interrupted status by generating an error it is recommended to modify the program appropriately 5 Types of resources which are managed by the OS program of the commun...

Страница 158: ...sk area using the ZSTART instruction if the task area is set to OFF There are two ways to start a program using the ZSTART instruction 1 Read a program from a memory card to the specified task area an...

Страница 159: ...tasks by using this area Program 1 Variables and arrays in program 1 Variables and arrays in program 2 Common memory Internal devices Program 2 The PUTMEM and GETMEM instructions are used in order to...

Страница 160: ...UTMEM The data is accessed using addresses 2000H to 2005H The values in common memory are stored assuming that they are character codes Character variable character array variable RD Common memory If...

Страница 161: ...programs in advance A message port can be opened in any program Moreover the program that opened the message port does not have to reside in memory The maximum length of a message is 256 bytes Up to...

Страница 162: ...m on the reading side even if it is written as follows MELSECAD51H Message port ZMESSAGE PUT 1 A B Write ZMESSAGE GET 1 C Read MELSEC A AD51H B MELSECAD51H C This is because message ports do not suppo...

Страница 163: ...e message port in the main memory is also deleted Therefore it is necessary to define the message port in order to use the message port specified by message port number again The deletion of a message...

Страница 164: ...n to the message port When a message is written to the message port program B reads the message B An error occurs if a message cannot be received within the specified timeout period Unlike the event c...

Страница 165: ...occurs It is defined using the ON ERROR GOTO instruction By specifying a line number or label after the ON ERROR GOTO instruction the routine begins executing from the line specified by this line num...

Страница 166: ...the type of error as an error code See the error code table in Appendix 5 4 for the correspondence between the error type and error code The generated error can be determined in detail by combining th...

Страница 167: ...ot be properly handled in the error handling routine and an error may occur in system operation It is recommend to interrupt the error handling using ON ERROR GOTO 0 and stop the program operation if...

Страница 168: ...roup at a time according to the specifications and check to see if each program runs properly 3 Overall debugging Execute all the programs according to the specifications and check to see if each prog...

Страница 169: ...rrupts in the same way as in the case of the STOP instruction Execute the CONT instruction to resume the execution of a program that has been paused from the next instruction 10 C 1 RUN 20 FOR I 0 TO...

Страница 170: ...PUT IN I MELSEC 40 NEXT I AD51H 50 STOP Break in 50 60 FOR I 0 TO 2 OK 70 PRINT IN I PRINT IN 0 80 NEXT I MITUBISHI 90 END OK IN 0 Mitsubishi OK PRINT IN 2 AD51H OK IN 2 BASIC OK CONT Mitsubishi MELSE...

Страница 171: ...ation and notes Indicates important items for using instructions and functions Indicates instruction function or variable related to supplementary explanation instructions functions and variables Indi...

Страница 172: ...14 Assigns 3 14 absolute value of 3 14 to C Description The ABS function returns the absolute value of arithmetic expression Returned values are always positive or 0 Returns a double precision number...

Страница 173: ...s A B ABC A B C Description The AKCNV function converts half byte characters in character string expression to full byte characters The full byte characters in character string expression are unchange...

Страница 174: ...haracter code that corresponds to the starting character of character string expression If an empty character string is specified in character string expression an Illegal function call error occurs P...

Страница 175: ...ption The ATN function returns the arc tangent tan 1 of the value from the arithmetic expression While arithmetic expression can be any value type the ATN function always calculates in single precisio...

Страница 176: ...ly specified by the AUTO instruction Description The AUTO instruction automatically displays the line number as specified The value specified by line number becomes the first line number For the succe...

Страница 177: ...X000A Description The B variable reads and writes the bit information of the device Specify one of the following devices for device Expansion relay EM General purpose input X General purpose output Y...

Страница 178: ...cuting PRINT CHR 7 The BEEP instruction can be executed only by the port specified as a console by the DIP switch of the communication module s main system It is not for the output destination switchi...

Страница 179: ...nary expression of an integer If the value of arithmetic expression contains a fractional part the fractional part is rounded down to an integer then converted Decimal Hexadecimal Binary Same result 6...

Страница 180: ...AND FUNCTIONS Program Example 10 Converts a decimal number to a binary number 20 A 1234 Defines the numeric value 30 A BIN A Converts to a binary number 40 PRINT Decimal A 50 PRINT Binary A 60 END RU...

Страница 181: ...the number of items to swap in byte units BSWAP A 0 A 1 1 Swaps the upper one byte and lower one byte of A 0 0 1 C8H 00H A Before swap Lower one byte Higher one byte Lower one byte Higher one byte 64...

Страница 182: ...ror occurs if the swap starting address in the variable is larger than the array size specified by the DIM instruction The same variable can be specified to variable1 and variable2 Specify the number...

Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...

Страница 184: ...can handle a double precision real number of 2147483648 through 2147483647 An Over flow error occurs if the value exceeds this range If the converting double precision real number contains a fractiona...

Страница 185: ...CDBI A B 0 Converts to a 32 bit integer 50 TBL 0 255 Sets the communication station number to the local station 60 TBL 1 1 Specifies writing to the device memory 70 TBL 2 2 Specifies word as the unit...

Страница 186: ...D and assigns it to C Description The CDBL function converts the value of arithmetic expression into a double precision real value Although the type is converted the number of effective digits is unch...

Страница 187: ...er 50 B CDBL B Converts a single precision real number to a double precision real number 60 PRINT A A B B Value before conversion 70 PRINT A A B B Value after conversion 80 END RUN A 256 B 5 78 A 256...

Страница 188: ...ted by the DELETE option CHAIN 0 PRGM A Erases the current program and reads the program stored in the PRGM A BAS file from the memory card inserted in the M CARD0 Then executes the program after hand...

Страница 189: ...ALL option in the CHAIN instruction 2 To hand over only a part of variables from the current program to the subsequent program omit the ALL option in the CHAIN instruction and specify the variables to...

Страница 190: ...a character whose character code is the numeric value specified by arithmetic expression Specify the arithmetic expression by 0 through 255 H00 through HFF Normally the CHR function is used in order...

Страница 191: ...rray variable uses a one dimensional integer array An Illegal function call error occurs if anything other than one dimensional integer array is specified Be sure to define the variable to be used for...

Страница 192: ...Specifies readout of the device memory 50 TBL 2 2 Specifies word as the unit 60 TBL 3 18 Specifies the data register 70 TBL 4 0 Specifies the starting device number to be read 80 TBL 5 2 Specifies the...

Страница 193: ...not exceed the value of arithmetic expression The fraction part is rounded down if a positive value is specified and the fraction part is rounded up if a negative number is specified Example 5 689 1 0...

Страница 194: ...S REMARK When assigning a value to an integer variable the value type is automatically converted into an integer if the instruction or function requires an integer type as its parameter argument A 304...

Страница 195: ...mensional integer array variable An Illegal function call error occurs if anything other than one dimensional integer array is specified Be sure to define the variable to be used for array variable by...

Страница 196: ...local station 40 TBL 1 1 Specifies readout of the device memory 50 TBL 2 2 Specifies word as the unit 60 TBL 3 18 Specifies the data register 70 TBL 4 0 Specifies the device number 80 TBL 5 2 Specifie...

Страница 197: ...er the CLEAR instruction is executed contents of variables declarations and definitions become as follows Numeric variable Character variable Array definition DIM statement Type declaration of variabl...

Страница 198: ...or the file of file number 1 Description The CLOSE instruction closes terminates processing a file that is completed for data I O processing Specify the file number opened by the OPEN instruction for...

Страница 199: ...LS function Syntax function Specify 1 CLS Examples CLS 1 Clears the text screen Description The CLS instruction clears the console screen specified by the ZODV instruction and moves the cursor to the...

Страница 200: ...s assumed both RS 232C and 422 ports are specified An interrupt is enabled immediately after the COM ON instruction is executed After this instruction is executed the interrupt is executed every time...

Страница 201: ...ction In data to be passed specify variables and others to be passed to the program that is read by the CHAIN instruction To specify an array write only parentheses after the array name A B C If there...

Страница 202: ...es Description The CONSOLE instruction sets the number of display lines of the console according to the console screen The initial condition of the CONSOLE instruction is set according to the console...

Страница 203: ...y CONT is used with the STOP instruction for debugging When the program execution stops the intermediate results can be checked and modified in the direct mode The program execution can resume by the...

Страница 204: ...sine value and stores in A Description The COS function returns a cosine when the arithmetic expression value is given in radian 180 x angle arithmetic expression can be any numeric value type but the...

Страница 205: ...e figures An Over flow error occurs if the converted value is out of range of 1 70141E 38 to 1 7014E 38 Program Example 10 Converts an integer or double precision real number into a single precision r...

Страница 206: ...the PLC CPU BASIC can handle a single precision real number 2 14748E 09 through 2 14748E 09 An Over flow error occurs if the value exceeds this range If the converting single precision real number con...

Страница 207: ...B 0 Converts to a 32 bit integer 70 TBL 0 255 Sets the communication station number to the local station 80 TBL 1 1 Specifies writing to the device memory 90 TBL 2 2 Specifies word as the unit 100 TBL...

Страница 208: ...is converted into an 8 byte character string by the MKD function before written into a file Conversely the 8 byte character string has to be converted back to the original double precision real numbe...

Страница 209: ...MKD function into the IEEE format double precision internal expression The internal representation of the AD51H BASIC real number and that of the IEEE format floating point real number are different T...

Страница 210: ...file has to be a character string an integer is converted into a 2 byte character string by the MKI function before written into a file Conversely the 2 byte character string has to be converted back...

Страница 211: ...gle precision real number is converted into a 4 byte character string by the MKS function before written into a file Conversely the 4 byte character string has to be converted back to the original sin...

Страница 212: ...xpression that is used by AnA AnU AnUSCPU The internal representation of the AD51H BASIC real number and that of the floating point real number IEEE format are different The CVSMBF function is used fo...

Страница 213: ...o the IEEE AnACPU format 90 ZMOVE TO A 0 FROM B 0 4 Stores in array A 100 TBL 0 255 Sets the communication station number to the local station 110 TBL 1 1 Specifies writing to the device memory 120 TB...

Страница 214: ...haracters separated by comma If the character string constant contains comma colon semicolon or a space before or after the constant needs to be enclosed with the double quotation marks Otherwise no q...

Страница 215: ...cified in the DATA instruction by the READ instruction and displays it 20 DATA 1 2 ABC 30 READ A B C D E Reads data 40 DATA AD51H 90 50 PRINT A A B B C C Displays data 60 PRINT D D E E 70 END RUN A 1...

Страница 216: ...setting the year month and day The year month and day may not be set correctly depending on the time Set the date using the following format DATE year month date the day of the week 1 Use slash to se...

Страница 217: ...and reads out 30 A 1991 04 01 MON Sets the year month and day 40 DATE A Writes the year month and day 60 B SPACE 14 Stores dummy 70 B DATE Reads year month and day 80 PRINT Contents of the calendar B...

Страница 218: ...r type Specification by the type declaration statement has priority for specifying the variable type and the result will be as follows Example RUN 3 333333333333333 3 3 3333 OK Double precision Intege...

Страница 219: ...is not attached a single precision value is returned Example DEF FNA X Y X Y DEF FNB X Y X Y DEF FNC X OK X FNA X Y returns an integer FNB X Y returns a double precision value FNC X returns a charact...

Страница 220: ...te the area of a triangle as function name FNA 20 DEF FNA A B A B 2 base height 2 30 INPUT Base C Input of the base 40 INPUT Height D Input of the height 50 E FNA C D Calculation 60 PRINT Area of the...

Страница 221: ...nteger type Specification by the type declaration statement has priority for specifying the variable type and the result will be as follows Example RUN 3 3 333333333333333 3 3333 OK Integer Double pre...

Страница 222: ...pecified by alphabetical character alphabetical character as the single precision real number type Specification by the type declaration statement has priority for specifying the variable type and the...

Страница 223: ...the character type Specification by the type declaration statement has priority for specifying the variable type and the result will be as follows Example RUN 10 3 3 3 3333 OK Character Integer Singl...

Страница 224: ...01 is turned ON as event number 3 Description Defines various events that are used for multitask operations An event is a signal for controlling another BASIC program from a BASIC program Definition o...

Страница 225: ...bit device OFF ON This event is used for resuming execution of a program is waiting for the event to occur by the ZSIGNAL instruction or by a change of the target bit device after enabling the event...

Страница 226: ...ystem Execute one of the following 1 Power on again or operate the RESET switch of the communication module when starting up BASIC 2 Redefine the event to be handled by the program that is executed fi...

Страница 227: ...nd line number 2 When both line number 1 and line number 2 are specified all the lines included in this range are deleted When line number 1 and a hyphen are specified lines starting from the specifie...

Страница 228: ...y for the array The following arrays can be defined A n Numeric value array A n Integer array A n Single precision array A n Double precision array A n Character array Description numeric expression m...

Страница 229: ...array to an empty character string A Redimensioned array error occurs if the DIM instruction defines an array variable specified by the DIM instruction again In order to redefine delete the definition...

Страница 230: ...ings to the idling mode after closing all open files Execution mode Description After terminating the program execution the following occurs In edit mode Closes all open files and brings to the input...

Страница 231: ...e number specified by the OPEN instruction Examples IF EOF 1 THEN CLOSE 1 Closes the file when the end of a sequential file which has file number 1 is detected Description The EOF function detects the...

Страница 232: ...eted by the ERASE instruction can be declared again by the DIM instruction All data which was stored in the array deleted by the ERASE instruction is lost A Redimensioned array error occurs if the arr...

Страница 233: ...error occurred If the instruction that caused the error was being executed in the direct mode the ERL function returns 65535 The ERL function has a limited purpose and it cannot be specified on the l...

Страница 234: ...essing branches depending on the error content The ERR function has a limited purpose and it cannot be specified on the left side of the equal sign in the LET instruction and some other places For the...

Страница 235: ...s an error of the specified error code If the value of integer expression is the value registered as an error code in BASIC see Appendix 4 4 the ERROR instruction generates an error of the correspondi...

Страница 236: ...EXP 10 Calculates EXP 10 and stores it in E Description The EXP function returns the exponential function value of base e Specify 87 33655 or smaller to numeric expression An Overflow error occurs if...

Страница 237: ...andom file A B 128 bytes 128 bytes Description The FIELD instruction assigns an area of the specified variable in the random file buffer that is specified by file number The program writes and reads d...

Страница 238: ...instruction displays only the file name if file name is specified In drive number specify the memory card FD or HD to display the file name using the following numbers In edit mode and execution mode...

Страница 239: ...nt from the INT function and the fractional part is truncated by the FIX function even if the argument X is negative FIX X is equivalent to SGN X X INT ABS X Description Example X 3 54 SGN 3 54 INT AB...

Страница 240: ...are executed an increment specified by STEP is added to the variable and compared to the final value If the value of the variable is equal to or less than the final value the same processing is repeat...

Страница 241: ...tion without the corresponding FOR instruction is detected Program Example 10 Makes a multiplication table 30 FOR I 1 TO 9 Repeats with I 1 to 9 40 FOR J 1 TO 9 Repeats with I 1 to 9 50 PRINT USING I...

Страница 242: ...e FORMAT instruction of the BASIC To make the memory card in the usable condition initialize physical format the entire memory card in the file maintenance mode or system mode After the initialization...

Страница 243: ...rograms and data in the memory card are lost There is no way to recover the lost data Be sure to check the contents of the memory card thoroughly before using the FORMAT instruction REMARK See the SW...

Страница 244: ...at is not used as the program area for processing the character string or as the variable area The value of numeric expression is a dummy and has no meaning The size of the unused character string pro...

Страница 245: ...ion The GET instruction reads one record of data from the random file to the random file buffer file number is the number specified when the random file to read the file from was opened by the OPEN in...

Страница 246: ...value in bytes from the start of the read data store area offset 2 Specify the offset value in bytes from the start of the read source Syntax number of bytes Specify the length of read data in bytes...

Страница 247: ...d source The addresses of the buffer memory and common memory are as follows Specify the starting address of readout in read source 0 1 2 3 Address specified by GETMEM Buffer memory address 0 Buffer m...

Страница 248: ...ble is used n SPACE 255 In offset 1 specify in bytes which part of data of variables specified by read data store area will be stored at the beginning In offset 2 specify in bytes which part of data o...

Страница 249: ...cters number of bytes n since one to half byte character consists of one byte The user should manage the placement position size and data type of each data in the buffer memory etc Data is not convert...

Страница 250: ...pecified line number or label by the RETURN instruction line number can also be specified by a label The same subroutine can be called many times in a program Subroutines can be nested as long as the...

Страница 251: ...e main routine 30 GOSUB 100 Branches to a subroutine 40 PRINT 50 PRINT At line 50 of the main routine 60 END End of execution 100 PRINT 110 PRINT Entered the subroutine 120 RETURN Returns to the main...

Страница 252: ...onally The execution moves to the line specified by line number line number can also be specified by a label An Undefined line number error occurs if a line that does not exist is specified for line n...

Страница 253: ...into an integer The hexadecimal numbers and decimal numbers correspond as follows Hexadecimal number 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 Decimal number 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Program...

Страница 254: ...xecution Examples IF X 0 GOTO 100 ELSE 200 Branches to line 100 if X is 0 If X is not 0 branches to line 200 Description The IF to GOTO to ELSE instruction selects the execution according to the resul...

Страница 255: ...e 50 if X is 0 to 10 50 PRINT Within range from 0 to 10 END otherwise branch to line 60 60 PRINT Out of range END RUN X 1 Within range from 0 to 10 OK RUN X 20 Out of range OK REMARK See Section 3 7 T...

Страница 256: ...ription The IF to THEN to ELSE instruction selects an instruction to execute or a line number to branch according to on the result of the expression If the condition of conditional expression is true...

Страница 257: ...30 INPUT Y Y Y input 40 IF X Y THEN PRINT Same ELSE PRINT Different Displays Same if X Y 50 END Different if X Y RUN RUN X 5 Y 5 Same OK RUN X 3 Y 9 Different OK REMARK The correct result may not be o...

Страница 258: ...ys can be entered from the keyboard that is specified as a console Ctrl C Ctrl S Break key Processes exactly as key operation Keys that correspond to 00H 80H and FDH to FFH All the keys can be entered...

Страница 259: ...NS Program Example 10 Pressing any key terminates the program 20 PRINT 30 A INKEY Checks the key status 40 IF A GOTO 20 Returns to line 20 if no key is pressed 50 END RUN OK REMARK See the INPUT funct...

Страница 260: ...specified by variable name is a numeric variable or a character string variable including an array variable The type of each data item to be entered must match the type of variable name Entry of a cha...

Страница 261: ...11 91 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS Program Example 10 Data input 20 INPUT X X Input 30 PRINT X 2 X 2 40 END RUN X 2 X 2 4 OK REMARK See the INPUT function LINE INPUT instruction and Section...

Страница 262: ...ential file opened by the file number 1 then assigns them to B Examples C INPUT 7 1 20 Reads seven characters from CH1 RS 232C of the communication module and assigns them to C Time out error occurs i...

Страница 263: ...Input past end error occurs if there is no data to read when trying to read from a file Reading from a communication port of the communication module If port number is specified after numeric express...

Страница 264: ...s for the input from the keyboard 20 PRINT Yes or No 30 A INPUT 1 Enters one character from the keyboard 40 IF A Y OR A y THEN PRINT PRINT OK GOTO 60 50 PRINT PRINT 60 END RUN Yes or No OK OK RUN Yes...

Страница 265: ...eginning of the numeric value and the end of the numeric value is indicated by a space enter line feed or comma When reading a data item of a character string the first character other than space ente...

Страница 266: ...4 C D E F A A 5 0 F Search area Description The INSTR function searches character string expression 2 in character string expression 1 then returns the position of the first match if found or returns...

Страница 267: ...A AD51HMitsubishiPLC 30 A INSTR 2 A PLC Searches for PLC from a character string 40 PRINT A A Displays the character string 50 PRINT PLC is the A th character Displays the position where PLC was dete...

Страница 268: ...s the maximum integer value that does not exceed the value of numeric expression The INT function calculates the maximum integer which does not exceed numeric expression when truncating the fractional...

Страница 269: ...PRINT A I A I Displays the original value 90 PRINT INT INT A I Displays the result of conversion by the INT function 100 PRINT FIX FIX A I Displays the result of conversion by the FIX function 110 PR...

Страница 270: ...cter of character string expression While the JIS function returns the Kanji code of a full byte character it returns a character string of 4 digit hexadecimal number for the first two characters if t...

Страница 271: ...pression do not change Only the full byte characters that correspond to the half byte characters listed in Appendix 4 1 can be converted An Illegal function call error occurs if full byte characters o...

Страница 272: ...s only full byte characters from A and assigns them to B B A AB C D F E C KEXT A 0 Extracts only half byte characters from A and assigns them to C Examples C ABCD A AB C D F E EF Description The KEXT...

Страница 273: ...ing 20 A AD51H 30 B KEXT A 0 Extracts only half byte characters 40 C KEXT A 1 Extracts only full byte characters 50 PRINT Original character string A 60 PRINT Half byte characters B 70 PRINT Full byte...

Страница 274: ...ey number on the keyboard The range of the function key number is from 1 to 10 In character string specify a character string of up to 15 characters to assign to the specified function key A control c...

Страница 275: ...key of the console Description The KEY LIST instruction displays the character string defined to the function keys F1 to F10 of the console The following character string is assigned to each function...

Страница 276: ...H S3 MEMORY CARD 1 The KILL instruction deletes a file in the FD or HD of the console or in the memory card inserted in the AD51H S3 memory card interface For drive number specify the memory card FD o...

Страница 277: ...of the file to be deleted in file name The identifier cannot be omitted in the KILL instruction The KILL instruction cannot be executed when at least one data file is open A File already open error o...

Страница 278: ...string NAGOYA from the third character of A and assigns the location if found or assigns 0 if not found to J Examples A A 460 5 14 100 2 2 3 1 23 4 5 6 7 8 Search range J 5 J 0 The KINSTR function sea...

Страница 279: ...rogram Example 10 Searches full byte characters from the character string 20 A Defines character string 30 A KINSTR 2 A Searches from the character string 40 PRINT Character string A 50 PRINT A 60 END...

Страница 280: ...7 8 9 10 A B KLEN A 1 Counts the number of half byte characters in character string A and assigns the value to B A B C 6 1 2 3 4 5 6 D E F A C KLEN A 2 Counts the number of full byte characters in ch...

Страница 281: ...Number of half byte characters 50 C KLEN A 2 Number of full byte characters 60 PRINT Character string A 70 PRINT Number of overall characters A 80 PRINT Number of half byte characters B 90 PRINT Numb...

Страница 282: ...he third character from the left of B and assigns it in A B 1 1 2 3 4 5 6 A Description The KMID function returns the character string of the number of characters specified in numeric expression 2 sta...

Страница 283: ...ter 20 A AD51H Defines the character string 30 B KMID A 6 2 Extracts two characters from the 6th character in the character string 40 PRINT Original character string A 50 PRINT Extracted character str...

Страница 284: ...tion module is JIS Kanji code instead of Shift JIS Kanji Code the correct Kanji codes cannot be obtained The communication channel is used to perform Shift JIS JIS code conversions to obtain the Kanji...

Страница 285: ...truction ZCNTL instruction process code 96 Perform the above operation on all communication ports where Kanji code conversions are to be performed Kanji code conversion of communication ports are perf...

Страница 286: ...t codes are predetermined data can be identified whether or not it expresses Kanji characters or not It s Kanji because it uses KI and KO codes KI 30H 26H KO Shift JIS Kanji Code In Shift JIS Kanji co...

Страница 287: ...as a Kanji code and returns one corresponding full byte character An Illegal function call error will be generated when the content of character string expression does not correspond to an existing Ka...

Страница 288: ...character type of the character corresponding to the number of characters specified by numeric expression in character string expression counting from the left as follows Full byte characters are cou...

Страница 289: ...eft B A M I T S U B I S H I M I T S U Description The LEFT function extracts and returns the character string of the number of characters specified from the left of the character string When the value...

Страница 290: ...f the character string 20 A AD51H BASIC Defines the character string 30 B LEFT A 5 Extracts 5 characters from the left 50 PRINT 5 characters counting from the left B Displays extracted character strin...

Страница 291: ...haracters of the character string specified by the character string expression The control characters 00h through 1Fh in the character code and spaces are counted The LEN function counts full byte cha...

Страница 292: ...expression to a variable The LET command may be entirely omitted LET A 10 A 10 Example LET A NAGOYA A NAGOYA If the expression is a numeric expression variable name must be a numeric variable If the...

Страница 293: ...INSTRUCTIONS AND FUNCTIONS Program Example 10 Assigns 1 to Variable A and assigns A 1 to Variable B 20 A 1 Stores 1 in A 30 B A 1 Stores A 1 in B 40 PRINT A A B B Displays A and B 50 END RUN A 1 B 2 O...

Страница 294: ...name in the specified drive number in a memory card FD or HD to a printer specified by the ZLDV instruction drive number is used to specify the memory card FD or HD from which the filename is displaye...

Страница 295: ...FUNCTIONS While printing is in progress all keys are not be accepted including the Break and Ctrl C keys To stop printing turn off the printer or set it to the offline status The printer output proce...

Страница 296: ...ter string variable when the LINE INPUT instruction is used The following keyboards can be used for key input The console keyboard Keyboard from the terminal connected to the communications port When...

Страница 297: ...string until the Enter key is pressed 20 LINE INPUT Address A 30 LINE INPUT Name B Enters the character string 40 PRINT 50 PRINT A B Displays entered character string 60 END RUN Address NAGOYA Name M...

Страница 298: ...BCD Description The LINE INPUT instruction reads an entire line from the sequential file specified in file number and stores it in a character string variable The sequential file must be open with the...

Страница 299: ...s displayed If line number 1 and a hyphen are specified the program starting with that line to the end is displayed If a hyphen and line number 2 are specified the program starting from the beginning...

Страница 300: ...to the end of the program to the printer LLIST 150 Prints from the beginning to line 150 to the printer Examples LLIST 300 1000 Prints from line 300 to line 1000 to the printer Description The LLIST i...

Страница 301: ...y card FD or HD that contains the program to be read During online programming To specify the memory card inserted in AD51H S3 MEMORY CARD 1 0 To specify the memory card inserted in AD51H S3 MEMORY CA...

Страница 302: ...f records that have been read written one record 256 bytes since the file was opened will be returned as the function value For random files The record number accessed last by the GET or PUT instructi...

Страница 303: ...nsole screen specified by the ZODV instruction horizontal position and vertical position specify the position to move the cursor vertical position is specified within the range of 0 through 31 However...

Страница 304: ...screen 12 Y 1 20 A AD51H BASIC Defines the character string 30 FOR X 1 TO 10 40 Y Y 1 50 LOCATE X Y Specifies display location 60 PRINT A Displays the character string 80 NEXT X 90 END AD51H BASIC AD...

Страница 305: ...will differ depending on the file type specified by the file number For sequential files When data is written in byte units the file size will be returned in record number number of sectors Example Re...

Страница 306: ...es the natural logarithm of 10 to A Description The LOG function obtains the natural logarithm of the value specified by a numeric expression The computation is performed in single precision To determ...

Страница 307: ...the printer This instruction is the same as the PRINT instruction except for the fact that it outputs data to the printer See PRINT Instruction The output printer is specified with the ZLDV instructio...

Страница 308: ...INT USING instruction outputs data in the specified format to the printer This instruction is the same as the PRINT USING instruction except for the fact that it outputs data to the printer The output...

Страница 309: ...to execute this instruction The character string variable must be defined with the FIELD instruction prior to executing the LSET instruction If the character string length is shorter than the field le...

Страница 310: ...treated as a new program and stored in the memory drive number is used to specify the program to be merged placed on a memory card FD or HD using the following numbers During online programming To spe...

Страница 311: ...and the program to be merged the line in the program to be merged will take priority After the MERGE instruction is complete BASIC will wait for the next instruction To use the MERGE instruction in a...

Страница 312: ...be replaced Syntax integer expression 2 Specify the number of characters that will do the replacing MID A 2 AB Characters in A starting with the second character are replaced with AB Examples C D E F...

Страница 313: ...character string 30 B XYZ Defines character string to replace with 40 PRINT Original Character String A 50 MID A 3 3 B Replaces 60 PRINT Character string after replacement A 70 END RUN Original charac...

Страница 314: ...N A G O Y A G O Description The MID part 2 function extracts a character string from the specified position in a character string If integer expression 2 is omitted or if the remaining number of char...

Страница 315: ...rted to a character string with the MKD function The data converted into a character string by the MKD function can be restored to the original numeric value only by the CVD function It is recommended...

Страница 316: ...trings using the MKD function may be used for data communication as well as for writing to the random file buffer When the S option is specified the double precision real number will be converted to a...

Страница 317: ...nction converts data of IEEE format double precision internal expression to a character string that can be converted to a numeric value using the CVD function in AD51H BASIC The IEEE format double pre...

Страница 318: ...n writing data that was converted to a character string using the MKI function to the random file buffer If the field length number of bytes of each variable specified by the FIELD instruction is grea...

Страница 319: ...ta that was converted to a character string using the MKS function to the random file buffer If the field length number of bytes of each variable specified by the FIELD instruction is greater than the...

Страница 320: ...VS function in AD51H BASIC The AnA AnU AnUSCPU internal expression IEEE format single precision internal expression and the AD51H BASIC internal expression for real numbers are different The MKSMBF fu...

Страница 321: ...1 Specifies to read the device memory data 60 TBL 2 2 Specifies the word unit 70 TBL 3 18 Specifies the data register 80 TBL 4 0 Specifies the starting device number to be read 90 TBL 5 2 Specifies th...

Страница 322: ...AD51H S3 MEMORY CARD 1 to No2 BAS The NAME instruction changes file names of files stored in a memory card FD or HD drive number and system name must be the same for old file name and new file name S...

Страница 323: ...hen specifying a file name without extension Specify the new name and extension given to the file for new file name If the extension is omitted the file name will not contain an extension The NAME ins...

Страница 324: ...n The NEW instruction erases all programs currently resident in memory and initializes memory before entering a new program The size of the memory area defined by the CLEAR instruction does not change...

Страница 325: ...number 10 into octal and displays the result Description The OCT function converts a numeric value to a character string variable in octal notation Digits after the decimal point are truncated if a de...

Страница 326: ...tions Octal numbers are expressed by placing 0 in front of the numeric value Example Decimal number Octal number 200 O310 Use the VAL function to convert a character string variable in octal notation...

Страница 327: ...ines the starting line of the processing routine to be branched to when an interrupt is generated from a communication line The following values can be specified as channel number 1 CH1 RS 232C 2 CH2...

Страница 328: ...1 H8 Sets character length parity bit 110 TBL1 2 H1 and stop bit 120 ZOPEN CH TBL1 Opens the communication channel 130 140 PORT CNTL 150 CNT 0 32 Specifies control by the RS and ER signals 160 CNT 1...

Страница 329: ...CATE 0 16 I 450 PRINT RECEIVE DATA H HEX CTBL I Displays the data received 460 NEXT I 470 RETURN 310 480 490 ERROR ROUTINE 500 ERTYPE ERR ERLINE ERL Stores the error occurred and the line 510 IF ERTYP...

Страница 330: ...S and ER signals 200 CNTL 1 H1 Turns the RS control signal on 210 ZCNTL CH 0 CNTL Executes control by the signals 220 230 DATA SEND 240 DIM TBL 2 Defines the array 250 TBL 0 12 Specifies the request c...

Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...

Страница 332: ...ters or switch ports via the ZIDV or ZODV instruction in the error handling routine Character display and input output processing may not be performed correctly upon returning to the main program depe...

Страница 333: ...displays ERROR if an error occurs 20 ON ERROR GOTO 50 Defines the branch destination at error generation 30 ERROR 10 An error occurs 40 END 50 PRINT ERROR 60 RESUME 40 Ends error processing RUN ERROR...

Страница 334: ...alue of the specified expression Digits after the decimal points are truncated if the value of expression is not an integer The execution moves to the next instruction if the value of expression is 0...

Страница 335: ...a subroutine depending on the value 40 END 100 PRINT This is the subroutine when 1 is entered RETURN 200 PRINT This is the subroutine when 2 is entered RETURN 300 PRINT This is the subroutine when 3...

Страница 336: ...line 200 if the value of A is 1 to line 300 if A is 2 and to line 400 if A is 3 Description The ON to GOTO instruction branches the program execution to one of several specified line numbers depending...

Страница 337: ...ding on the value 40 END 100 PRINT This is the processing when 1 is entered END 200 PRINT This is the processing when 2 is entered END 300 PRINT This is the processing when 3 is entered END RUN 1 This...

Страница 338: ...file number and input output buffer to the file specified by system name and file name and defines the mode of the file Afterward data input output operations to this file are performed by referring...

Страница 339: ...ndom file In INPUT and APPEND modes if the specified file does not exist a File not found error occurs Open files are automatically closed by executing the following instructions or modifying the prog...

Страница 340: ...ered to be monitored by the PCWT instruction 4 H4 Reading extension file register data 5 H5 Monitoring extension file registers registered to be monitored by the PCWT instruction 7 H7 Reading extensio...

Страница 341: ...W ED n B EM n Indicates using the special variables Store dummy data in the variable used as storage area for data read before executing the PCRD instruction If the PCRD instruction is executed withou...

Страница 342: ...e memory other than extension file registers of the PLC CPU using this code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which d...

Страница 343: ...n reading from bit devices in word units 8 Specify the number of points of device memory to be read including the device specified in 3 and 4 The allowable specification range is as follows When bit u...

Страница 344: ...0 Reads the status of M 220 IF A 1 THEN PRINT M J ON ELSE PRINT M J OFF 230 J J 1 Adds 1 to J 240 NEXT I 250 END 2 Program example for format 2 control table 100 A program example that reads device me...

Страница 345: ...ing monitor registration Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which data is to be read See Section 4 2 2 for the allowab...

Страница 346: ...ng the file registers of type SW GHP UTLPC FN1 utility software package or type SW SRX FNUP software package 2 When the block number has been changed using the RSET instruction The processing cannot b...

Страница 347: ...70 TBL1 0 255 Specifies the station number to communicate with to the local station 180 TBL1 1 2 Specifies to monitor registered device memory 190 TBL1 2 2 Specifies word units 200 TBL1 3 5 Specifies...

Страница 348: ...1 1 1 Specifies network number 1 190 TBL1 2 1 Specifies station number 1 200 TBL1 4 2 Specifies to monitor registered device memory 210 TBL1 5 2 Specifies word units 220 TBL1 6 5 Specifies the number...

Страница 349: ...wing data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which data is to be read See Section 4 2 2 for the allowable specification range 1 Processing code S...

Страница 350: ...or the block No the data in the file registers of the PLC CPU is read The same processing as reading R using the processing code for reading device memory data will be performed If a block number grea...

Страница 351: ...e read 170 PCRD TBL A Executes the read operation 180 FOR I 0 TO 9 Displays the data read 190 PRINT A I 1 A I 200 NEXT I 210 END 2 Program example for a format 2 control table 100 A program example th...

Страница 352: ...used for monitor registration by the PCWT instruction using this code An error occurs if extension file registers are read without performing monitor registration Specify the following data for contr...

Страница 353: ...register extension file registers to be monitored 140 TBL1 2 2 Specifies the number of points to be monitored 150 A 0 1 A 1 0 Specifies block number 1 and device number 0 160 A 2 1 A 3 1 Specifies blo...

Страница 354: ...extension file registers to be monitore 160 TBL1 5 2 Specifies the number of points to be monitored 170 A 0 1 A 1 0 Specifies block number 1 and device number 0 180 A 2 1 A 3 1 Specifies block number...

Страница 355: ...Specify the number of points to be read It is possible to read data from extension file registers by specifying their sequential addresses rather than dividing them by block numbers using this code S...

Страница 356: ...d here See Appendix 4 4 2 for the details of the error codes 4 Processing code Specify 7 5 6 Specify the device number of the extension file registers expressed in sequential addresses The allowable s...

Страница 357: ...to block numbers that do not exist in the memory cassette When the device numbers are assigned block numbers not found in the memory cassette are skipped 8191 0 to Area of block No 1 Area of block No...

Страница 358: ...registers by specifying sequential addresses 110 DIM TBL 4 A 9 Defines arrays 120 TBL 0 255 Specifies the station number to communicate with to the local station 130 TBL 1 7 Specifies to read extensi...

Страница 359: ...1 130 TBL 4 7 Specifies to read extension file register data by specifying sequential addresses 140 D 0 150 H INT D 65536 160 L D H 65536 170 H RIGHT 0000 HEX H 4 The upper byte of the sequential add...

Страница 360: ...7 Number of steps Specify the number of steps to be read It is possible to read the sequence program in the PLC CPU using this code Specify the following data for control table Format 1 control table...

Страница 361: ...ored here See Appendix 4 4 2 for the details about the error codes 4 Processing code Specify 8 5 Specify the program to be read To read the main program Specify 1 To read subprogram subprogram 1 Speci...

Страница 362: ...al 3 Starting step count when the sequence program itself is specified 0000H sequence program step count expressed in hexadecimal The maximum number of sequence program steps that can be read at one t...

Страница 363: ...I 0 TO 63 220 PRINT 1 A I Writes to the sequential file 230 NEXT I 240 NEXT J 250 CLOSE 1 Closes the file 260 END 2 Program example for a format 2 control table 100 A program example that reads the se...

Страница 364: ...ode 9 4 7 Number of bytes Specify the number of bytes to be read It is possible to load the microcomputer program to the PLC CPU using this code Specify the following data for control table Format 1 c...

Страница 365: ...ppendix 4 4 2 for the details about the error codes 4 Processing code Specify 9 5 Specify the microcomputer program to be loaded To load the main microcomputer program Specify 1 To load a sub microcom...

Страница 366: ...mum 10 k bytes H0000 to H27FE A2CPU S1 A2ACPU S1 A2NCPU S1 A2SCPU A2UCPS S1 A2USCPU S1 Maximum 26 k bytes H0000 to H67FE A3CPU A3ACPU A3HCPU A3MCPU A3NCPU A3UCPU A4UCPU A73CPU A7LMS F Maximum 58 k byt...

Страница 367: ...A 127 Defines arrays 140 TBL 0 255 Specifies the station number to communicate with to the local station 150 TBL 1 9 Specifies to load the microcomputer program 160 TBL 2 1 Specifies to load the main...

Страница 368: ...L 0 256 Specifies a format 2 control table 150 TBL 1 1 Specify network number 1 160 TBL 2 1 Specify station number 1 170 TBL 4 9 Specifies to load the microcomputer program 180 TBL 5 1 Specifies to lo...

Страница 369: ...s code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which data is to be read See Section 4 2 2 for the allowable specification r...

Страница 370: ...in comment data is determined by the capacity set by the parameter The allowable specification range for the starting step count is as follows 0 to 1024 x comment capacity specified by the parameter T...

Страница 371: ...0 TO 127 210 PRINT 1 A I Writes to the sequential file 220 NEXT I 230 NEXT J 240 CLOSE 1 Closes the file 250 END 2 Program example for a format 2 control table 100 A program example that reads the com...

Страница 372: ...s code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which data is to be read See Section 4 2 2 for the allowable specification r...

Страница 373: ...ange for the starting step count is as follows 0 to 1024 extension comment capacity specified by the parameter The maximum number of bytes of extension comment data that can be read at one time is 128...

Страница 374: ...200 FOR I 0 TO 127 210 PRINT 1 A I Writes to the file 220 NEXT I 230 NEXT J 240 CLOSE 1 Closes the file 250 END 2 Program example for a format 2 control table 100 A program example that reads the ext...

Страница 375: ...d the data of the special function module s buffer memory using this code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which dat...

Страница 376: ...ng code Specify 12 5 Specify the module number of the special function module whose buffer memory data is to be read 6 Specify the address of buffer memory whose data is to be read 7 8 Specify how man...

Страница 377: ...ce the last address is 01FH the special function module number is 01H b In case of a module where the first half slot is allocated as a vacant slot e g AD72 A68AD PLC CPU Vacant slot 16 points 010 02F...

Страница 378: ...of the link parameters set at the MELSECNET master station M L M R M R M L R M L R L R No B W W W Y X Y X Y X R1 R2 R3 29C 309 215 24F 1B6 214 0F9 15E 080 0A3 15F 1B5 400 48F 510 67F 270 32F 000 08F...

Страница 379: ...dresses seen from a remote I O station I O addresses set by the common parameters AJ72LP25 to to to to to to to to to to The special function module s buffer memory contains 16 bits one word per one a...

Страница 380: ...data read in the following manner Example When reading data in buffer memory addresses 1 to 3 from an AD61 module whose I O addresses are from X Y40 to X Y5F 1 If an input element is specified as a p...

Страница 381: ...ad 6 bytes Starting address Module number 82H 05H 45H L 23H H 00H H 12H L 18H L 00H H 23H H 00H H 45H L 12H L 18H L 00H H 1 2 3 82H 83H 84H 85H 86H 87H Address Storage status of data read Buffer memor...

Страница 382: ...read 240 PCRD TBL A Executes the read operation 250 PRINT Digital output of CH1 A 0 Displays the result 260 END 2 Program example for a format 2 control table 100 A program example that reads buffer m...

Страница 383: ...names of PLC CPUs on MELSECNET II MELSECNET B and MELSECNET 10 networks using this code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU...

Страница 384: ...data read PLC CPU type name Code read hexadecimal A2UCPU A2USCPU 82H A2UCPU S1 A2USCPU S1 83H A3UCPU 84H A4USCPU 85H AJ72LP25 BR25 8BH A2ACPU A2ASCPU S1 93H A3ACPU 94H A0J2HCPU A1SCPU A1SJCPU 98H A2CC...

Страница 385: ...PCRD TBL A Executes the read operation 150 PRINT Type name code of PLC CPU H HEX A 0 Displays the result 160 END 2 Program example for a format 2 control table 100 A program example that reads the PLC...

Страница 386: ...re stored here 1 4 Processing code Specify the processing code 2 5 3 6 Starting address Specify the starting address of the parameter area to be read Processing Code 14 4 7 Number of bytes Specify the...

Страница 387: ...llowable specification range 2 Specify the station number of the PLC CPU from which data is to be read See Section 4 2 2 for the allowable specification range 3 Detailed error codes are stored here Se...

Страница 388: ...d all data by specifying the starting address and the number of bytes to be read in units of 128 bytes as follows Specify 2 H100 3 0 4 128 Specify 2 H80 3 0 4 128 Specify 2 H0 3 0 4 128 Parameter area...

Страница 389: ...number to communicate with to the local station 150 TBL 1 14 Specifies to read parameters 160 TBL 4 128 Specifies the number of bytes to be read 170 FOR J H0 TO H3F80 STEP 128 180 D J Specifies the st...

Страница 390: ...fies network number 1 160 TBL 2 1 Specifies station number 1 170 TBL 4 14 Specifies to read parameters 180 TBL 7 128 Specifies the number of bytes to be read 190 FOR J H0 TO H3F80 STEP 128 200 D J Spe...

Страница 391: ...de reads the network information of an accessed station Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which data is to be read Se...

Страница 392: ...apacity of storage area for data read is smaller than the number of data this code ends normally without generating an error Define arrays larger than the necessary amount of data Program Example 1 Pr...

Страница 393: ...e specification range 1 Processing code Specify 22 Format 2 control table 0 Format 2 control table Specify 256 1 Specify the number of the network to be accessed See Section 4 2 2 for the allowable sp...

Страница 394: ...cal station 120 TBL 1 22 Specifies to read routing parameters 130 RCRD TBL A Executes the read operation 140 END 2 Program example for a format 2 control table 100 DIM TBL 10 A 100 Defines arrays 110...

Страница 395: ...value Specify 0 It is possible to read the type name of the Q QnA series PLC CPU using this code Specify the following data for control table Format 1 control table 0 Specify the station number of th...

Страница 396: ...the requested CPU PLC No 1 PLC No 2 PLC No 3 PLC No 4 Control PLC 992 H3E0 993 H3E1 994 H3E2 995 H3E3 1023 H3FF 5 Processing code Specify 513 H201 6 Fixed value Specify 0 H0 The type name of the Q ser...

Страница 397: ...I 210 PRINT Type name string of Q series CPU KATAMEI Displays the result 220 PRINT Type name code H HEX A 9 230 END 2 Program example for a format 2 control table 100 A program example that reads the...

Страница 398: ...ecifies network number 1 140 TBL 2 1 Specifies station number 1 150 TBL 4 H03E3 Specifies the requested CPU PLC No 4 160 TBL 5 513 Specifies to read Q QnA series CPU s type name 170 TBL 6 0 Specifies...

Страница 399: ...ce points to be read It is possible to read the device memory of the Q QnA series PLC using this code Specify the following data for control table Format 1 control table 0 Specify the station number o...

Страница 400: ...rocessing code Specify 515 H203 5 Specify the device using the defined code See Section 4 2 5 for the code numbers 6 Specify the device number lower digit of the device specified in 5 See Section 4 2...

Страница 401: ...ecify the requested CPU PLC No 1 PLC No 2 PLC No 3 PLC No 4 Control PLC 992 H3E0 993 H3E1 994 H3E2 995 H3E3 1023 H3FF 6 Specify the device using the defined code See Section 4 2 5 for the code numbers...

Страница 402: ...eads the device memory of the Q QnA series CPU 110 DIM TBL 10 A 100 Defines the arrays 120 TBL 0 255 Specifies the station number to communicate with to the local station 130 TBL 1 515 Specifies to re...

Страница 403: ...BL 4 515 Specifies to read device memory of the Q QnA series CP 160 TBL 5 144 Specifies internal relays M 170 D 0 Specifies device number 0 180 H INT D 65536 Splits into lower and higher digits 190 L...

Страница 404: ...device memory of the Q QnA series CPU 160 TBL 5 H03E3 Specifies the requested CPU PLC No 4 170 TBL 5 144 Specifies internal relays M 180 D 0 Specifies device number 0 190 H INT D 65536 Splits into low...

Страница 405: ...ecify the requested CPU 1 4 5 Processing code Specify the processing code 2 5 6 Lower Number of word device points Specify the number of word device points Higher Number of bit device points Specify t...

Страница 406: ...fication range 7 Specify the device number higher digit of the specified device See Section 4 2 5 for the allowable specification range 8 Specify the device processing unit When reading in bit units W...

Страница 407: ...2 5 for the code numbers 9 Specify the device number lower digit of the specified device See Section 4 2 5 for the allowable specification range 10 Specify the device number higher digit of the specif...

Страница 408: ...0 9 Specify the device using the defined code See Section 4 2 5 for the code numbers 10 Specify the device number lower digit of the specified device See Section 4 2 5 for the allowable specification...

Страница 409: ...H INT D 65536 110 L D H 65536 120 H RIGHT 0000 HEX H 4 130 L RIGHT 0000 HEX L 4 In case of a format 2 control table 140 6 VAL H L 150 7 VAL H H to 9 VAL H L 10 VAL H H Data is stored for the number o...

Страница 410: ...200 TBL 6 L Stores the lower digit of the device number 210 TBL 7 H Stores the higher digit of the device number 220 TBL 8 0 Specifies word units as processing unit 230 TBL 9 0 Fixed value 240 TBL 10...

Страница 411: ...11 241 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS 400 H INT D 65536 Splits into lower and higher digits 410 L D H 65536 420 H RIGHT 0000 HEX H 4 430 L RIGHT 0000 HEX L 4 440 L VAL H L 450 H VAL H H 460 R...

Страница 412: ...pecifies device number 0 210 GOSUB 420 220 TBL 9 L Stores the lower digit of the device number 230 TBL 10 H Stores the higher digit of the device number 240 TBL 11 0 Specifies word units as processing...

Страница 413: ...UCTIONS AND FUNCTIONS 400 PCRD TBL A Executes the read operation 410 END 420 H INT D 65536 Splits into lower and higher digits 430 L D H 65536 440 H RIGHT 0000 HEX H 4 450 L RIGHT 0000 HEX L 4 460 L V...

Страница 414: ...Specifies data registers D 210 D 0 Specifies device number 0 220 GOSUB 430 230 TBL 10 L Stores the lower digit of the device number 240 TBL 11 H Stores the higher digit of the device number 250 TBL 1...

Страница 415: ...UNCTIONS 400 TBL 23 0 Fixed value 410 PCRD TBL A Executes the read operation 420 END 430 H INT D 65536 Splits into lower and higher digits 440 L D H 65536 450 H RIGHT 0000 HEX H 4 460 L RIGHT 0000 HEX...

Страница 416: ...cify the station number of the PLC 3 3 Detailed error code Detailed error codes are stored here 4 Requested CPU Specify the requested CPU 1 4 5 Processing code Specify the processing code 2 5 6 Starti...

Страница 417: ...0 bytes Format 2 control table 0 Format 2 control table Specify 256 H100 1 Specify the network number of the network to be accessed See Section 4 2 2 for the allowable specification range 2 Specify th...

Страница 418: ...or codes 4 Processing code Specify 533 H215 5 Specify the requested CPU PLC No 1 PLC No 2 PLC No 3 PLC No 4 Control PLC 992 H3E0 993 H3E1 994 H3E2 995 H3E3 1023 H3FF 6 Specify the starting I O number...

Страница 419: ...e starting address is 000H the special function module number is 00H b In case of a module where the first half slot is allocated as a vacant slot e g AD72 A84AD PLC CPU Special function module 32 poi...

Страница 420: ...e 4 digit expression of the head number of the I O signals seen from a remote I O station Specify the module number using the head I O signal seen from a remote I O station regardless of the settings...

Страница 421: ...the FROM TO instruction 2 into a hexadecimal number and add the starting address of each module Example When specifying address 1 of the FROM TO instructions the preset value of CH 1 of the type AD61...

Страница 422: ...5H L 12H L 18H L 00H H 1 2 3 82H 83H 84H 85H 86H 87H Address Storage status of data read Buffer memory viewed from the BASIC program Buffer memory viewed from the PLC CPU Address Specify 2 If a charac...

Страница 423: ...n 140 TBL 1 533 Specifies to read buffer memory 150 TBL 2 H9 Specifies the starting I O number 160 D H94 Specifies the buffer memory address 170 H INT D 65536 Splits into lower and higher digits 180 L...

Страница 424: ...ion number 1 160 TBL 4 533 Specifies to read buffer memory 170 TBL 5 H9 Specifies the starting I O number 180 D H94 Specifies the buffer memory address 190 H INT D 65536 Splits into lower and higher d...

Страница 425: ...L 4 533 Specifies to read buffer memory 170 TBL 5 H3E3 Specifies the requested CPU 180 TBL 6 H9 Specifies the starting I O number 190 D H94 Specifies the buffer memory address 200 H INT D 65536 Splits...

Страница 426: ...memory 1 1 2 H2 Monitor registration of device memory 3 H3 Random writing to device memory 5 H5 Monitor registration of extension file registers 6 H6 Random writing to extension file registers 7 H7 W...

Страница 427: ...even if the number of elements used is 10 or less An error occurs if the PCWT instruction is executed without defining the array Usually an array with 10 or fewer elements can be used without definin...

Страница 428: ...to device memory other than extension file registers of the PLC CPU using this code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU to w...

Страница 429: ...ssing code Specify 1 5 Specify the device processing unit When reading in bit units 1 When reading in word units 2 6 Specify the device using the defined code See Section 4 2 5 for the code numbers 7...

Страница 430: ...changed using the RSET instruction Processing cannot be performed normally with processing code 1 if the block number of the file registers has been changed to 29 or greater using the RSET instruction...

Страница 431: ...a format 2 control table 130 TBL 1 1 Specifies network number 1 140 TBL 2 1 Specifies station number 1 130 TBL 4 1 Specifies to write to device memory 140 TBL 5 2 Specifies word units 150 TBL 6 3 Spe...

Страница 432: ...on of device memory of the PLC CPU except extension file registers By performing monitor registration it becomes easy to monitor devices nonsequentially using the PCRD instruction Specify the followin...

Страница 433: ...ng in bit units 1 When reading in word units 2 6 Specify the number of device points to be monitored The allowable specification ranges for the number of points are as follows When bit units are speci...

Страница 434: ...ecification for the second point is 2 1 2 2 1 2 1 The following processing is performed if file registers are specified as the device memory to be monitored 1 If the file registers have never been cha...

Страница 435: ...L1 0 255 Specifies the station number to communicate with to the lacal station 180 TBL1 1 2 Specifies to monitor registered device memory 190 TBL1 2 2 Specifies word units 200 TBL1 3 5 Specifies the n...

Страница 436: ...L1 1 1 Specifies network number 1 190 TBL1 2 1 Specifies station number 1 200 TBL1 4 2 Specifies to monitor registered device memory 210 TBL1 5 2 Specifies word units 220 TBL1 6 5 Specifies the number...

Страница 437: ...ecify the number of points to be written It is possible to write data nonsequentially to the PLC CPU s device memory except extension file registers using this code Specify the following data for cont...

Страница 438: ...fication range 3 Detailed error codes are stored here See Appendix 4 4 2 for the details about the error codes 4 Processing code Specify 3 5 Specify the device processing unit When writing in bit unit...

Страница 439: ...to the devices See Section 4 2 6 as well for how to specify data to be written 2 Data written 1 1 3 2 5 Data written 2 1 3 2 The following processing is performed if file registers are specified as th...

Страница 440: ...0 A 11 1 Turns Y00 ON 200 A 12 2 A 13 5 A 14 1 Turns Y05 ON 210 PCWT TBL A Executes the write operation 220 END 2 Program example for a format 2 control table 100 A program example that writes data n...

Страница 441: ...reater using this code Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU to which data is written See Section 4 2 2 for the allowable spec...

Страница 442: ...le registers If 0 is specified for the block number data is written to the file registers of the PLC CPU This is the same processing as writing to R by writing device memory If a number greater than 0...

Страница 443: ...to be written 170 A 0 1234 Specifies the data to be written 180 PCWT TBL A Executes the write operation 190 END 2 Program example for a format 2 control table 100 A program example that writes data t...

Страница 444: ...g the PCRD instruction Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU from which data is read See Section 4 2 2 for the allowable speci...

Страница 445: ...ints 0 2 3 1 Block number Device number Block number Device number The specification for the first point is 1 1 2 1 1 1 2 The specification for the second point is 2 1 2 2 1 2 1 Block number Specify t...

Страница 446: ...ion 130 TBL1 1 5 Specifies to register extension file registers to be monitored 140 TBL1 2 2 Specifies the number of points to be monitored 150 A 0 1 A 1 0 Specifies block number 1 and device number 0...

Страница 447: ...Specifies to register extension file registers to be monitored 160 TBL1 5 2 Specifies the number of points to be monitored 170 A 0 1 A 1 0 Specifies block number 1 and device number 0 180 A 2 1 A 3 1...

Страница 448: ...table Format 1 control table 0 Specify the station number of the PLC CPU to which data is written See Section 4 2 2 for the allowable specification range 1 Processing code Specify 6 2 Specify the num...

Страница 449: ...block number data is written to the extension file registers The maximum value that can be specified for the block number varies depending on the PLC CPU s memory n 1 3 Device number Data written 3 4...

Страница 450: ...the block number and device number to which data is written and data to be written 160 A 3 1 A 4 1 A 5 5678 170 PCWT TBL A Executes the write operation 180 END 2 Program example for a format 2 control...

Страница 451: ...3 6 Device number Specify the device number of the extension file registers expressed in sequential addresses 4 7 Number of points Specify the number of points to be written It is possible to write da...

Страница 452: ...e PLC CPU to which data is written See Section 4 2 2 for the allowable specification range 3 Detailed error codes are stored here See Appendix 4 4 2 for the details about the error codes 4 Processing...

Страница 453: ...assigned to block numbers that do not exist in the memory cassette When the device numbers are assigned block numbers not found in the memory cassette are skipped 8191 0 to Area of block No 1 Area of...

Страница 454: ...ddresses 110 DIM TBL 10 A 20 Defines arrays 120 TBL 0 255 Specifies the station number to communicate with to the local station 130 TBL 1 7 Specifies to write data to extension file registers by speci...

Страница 455: ...ite data to extension file registers by specifying sequential addresses 140 D 10 Specifies the sequential addresses for writing 150 H INT D 65536 160 L D H 65536 170 H RIGHT 0000 HEX H 4 Higher byte o...

Страница 456: ...gram to be written 4 7 Number of steps Specify the number of steps to be written This code is used to write a sequence program to the PLC CPU Specify the following data for control table Format 1 cont...

Страница 457: ...here See Appendix 4 4 2 for the details about the error codes 4 Processing code Specify 8 5 Specify the program to be written To write the main program To write a subprogram subprogram 1 To write sub...

Страница 458: ...cified step 1 Starting step number when a timer setting value is specified FE00H the device number of the timer expressed in hexadecimal 2 Starting step number when the counter setting value is specif...

Страница 459: ...e of ladder steps in a program Settings in a program Settings in BASIC H0000 H0001 H0009 H000A H7FFF H8000 H8002 H8004 H87FE K0 K1 K9 K10 K32767 D0 D1 D2 D1023 T K C K T D C D to to to to to to How to...

Страница 460: ...ce program 8 k steps 120 DIM TBL 10 A 100 Defines arrays 130 OPEN 0 PROG8 DAT FOR INPUT AS 1 Opens the file 140 FOR J H0 TO H1FC0 STEP 64 150 FOR I 0 TO 63 160 INPUT 1 A I Reads from the file 170 NEXT...

Страница 461: ...FOR J H0 TO H1FC0 STEP 64 150 FOR I 0 TO 63 160 INPUT 1 A I Reads from the file 170 NEXT I 180 TBL 0 256 Specifies a format 2 control table 190 TBL 1 1 Specifies network number 1 200 TBL 2 1 Specifies...

Страница 462: ...ram to be written 4 7 Number of bytes Specify the number of bytes to be written This code is used to write a microcomputer program to the PLC CPU Specify the following data for control table Format 1...

Страница 463: ...Appendix 4 4 2 for the details about the error codes 4 Processing code Specify 9 5 Specify the microcomputer program to be written To write the main microcomputer program To write a sub microcomputer...

Страница 464: ...ytes H0000 to H67FE A3CPU A3ACPU A3HCPU A3MCPU A3NCPU A3UCPU A4UCPU A73CPU A7LMS F Maximum 58 k bytes for both main and sub microcomputer programs H0000 to H7FE The maximum number of bytes of the micr...

Страница 465: ...PUT AS 1 Opens the file 140 FOR J H0 TO H1F80 STEP 128 150 FOR I 0 TO 127 160 INPUT 1 A I Reads from the file 170 NEXT I 190 TBL 0 255 Specifies the station number to communicate with to the local sta...

Страница 466: ...OR J H0 TO H1F80 STEP 128 150 FOR I 0 TO 127 160 INPUT A I Reads from the file 170 NEXT I 190 TBL 0 256 Specifies a format 2 control table 200 TBL 1 1 Specifies network number 1 210 TBL 2 1 Specifies...

Страница 467: ...ing Code 10 2 5 Starting address Specify the starting address of the comment data to be written 3 6 Number of bytes Specify the number of bytes to be written This code is used to write comment data to...

Страница 468: ...of bytes in comment data is the capacity set by the parameter 6 Specify the number of bytes to be written The allowable specification range is from 1 to 128 bytes The maximum number of bytes in comme...

Страница 469: ...of bytes to be written 220 PCWT TBL A Executes the write operation 230 NEXT J 240 CLOSE Closes the file 250 END 2 Program example for a format 2 control table 100 A program example that writes the co...

Страница 470: ...2 5 Starting address Specify the starting address of the extension comment data to be written 3 6 Number of bytes Specify the number of bytes to be written This code is used to write extension comment...

Страница 471: ...y the number of bytes to be written The allowable specification range is from 1 to 128 bytes The maximum number of bytes of extension comment data is determined by the capacity set by the parameter Th...

Страница 472: ...of bytes to be written 220 PCWT TBL A Executes the write operation 230 NEXT J 240 CLOSE Closes the file 250 END 2 Program example for a format 2 control table 100 A program example that writes the ex...

Страница 473: ...address Specify the buffer memory address Processing Code 12 5 8 Number of bytes Specify the number of bytes to be written It is possible to write data to the special function module s buffer memory u...

Страница 474: ...allowable specification range 3 Detailed error codes are stored here See Appendix 4 4 2 for the details about the error codes 4 Processing code Specify 12 5 Specify the module number of the special f...

Страница 475: ...e last address is 01FH the special function module number is 01H b In case of a module where the first half slot is allocated as a vacant slot e g AD72 A68AD PLC CPU Vacant slot 16 points 010 02F to t...

Страница 476: ...of the link parameters set at the MELSECNET master station M L M R M R M L R M L R L R No B W W W Y X Y X Y X R1 R2 R3 29C 309 215 24F 1B6 214 0F9 15E 080 0A3 15F 1B5 400 48F 510 64F 270 32F 000 08F...

Страница 477: ...I O addresses seen from a remote I O station I O addresses set by the common parameters AJ72LP25 to to to to to to to to to to The special function module s buffer memory contains 16 bits one word per...

Страница 478: ...s to be written 6 bytes Starting address Module number 82H 05H PCRD TBL SD 23H H 45H L SD 0 00H H 12H L SD 1 18H L 00H H SD 2 45H L 23H H 00H H 12H L 18H L 00H H 23H H 00H H 45H L 12H L 18H L 00H H 1...

Страница 479: ...to be written 230 A 0 H3E8 Specifies the values to be written 240 PCWT TBL A Executes the write operation 250 END 2 Program example for a format 2 control table 100 A program example that writes data...

Страница 480: ...to the PLC CPU Specify the following data for control table Format 1 control table 0 Specify the station number of the PLC CPU to which data is written See Section 4 2 2 for the allowable specificati...

Страница 481: ...ad address and the number of bytes to be written in units of 128 bytes as follows Specify 2 H100 3 0 4 128 Specify 2 H80 3 0 4 128 Specify 2 H0 3 0 4 128 Parameter area 0H 80H 100H 180H Specify 2 HB80...

Страница 482: ...tation 190 TBL 1 14 Specifies to write parameters 200 D J Specifies the starting address of the parameter data to be written 210 H INT D 65536 220 L D H 65536 230 H RIGHT 0000 HEX H 4 Higher byte of t...

Страница 483: ...10 TBL1 4 14 Specifies to write parameters 220 D J Specifies the starting address of the parameter data to be written 230 H INT D 65536 240 L D H 65536 250 H RIGHT 0000 HEX H 4 Higher byte of the star...

Страница 484: ...4 2 2 for the allowable specification range 1 Processing code Specify 15 Format 2 control table 0 Format 2 control table Specify 256 1 Specify the network number of the network to be accessed See Sec...

Страница 485: ...the local station 130 TBL 1 15 Specifies to analyze parameter data 140 PCWT TBL A Executes the analysis 150 END 2 Program example for a format 2 control table 100 A program example that analyzes the...

Страница 486: ...e PLC CPU to which the remote STOP is to be performed See Section 4 2 2 for the allowable specification range 1 Processing code Specify 16 Format 2 control table 0 Format 2 control table Specify 256 1...

Страница 487: ...tation 130 TBL 1 16 Specifies to perform remote STOP to a PLC CPU 140 PCWT TBL A Executes the remote STOP 150 END 2 Program example for a format 2 control table 100 A program example that stops a PLC...

Страница 488: ...PLC CPU to which the remote RUN is to be performed See Section 4 2 2 for the allowable specification range 1 Processing code Specify 17 Format 2 control table 0 Format 2 control table Specify 256 1 S...

Страница 489: ...station 130 TBL 1 17 Specifies to perform remote RUN to a PLC CPU 140 PCWT TBL A Executes the remote RUN 150 END 2 Program example for a format 2 control table 100 A program example that runs a PLC CP...

Страница 490: ...e station on which the communication module is mounted using this code Specify the following data for control table Format 1 control table 0 Always specify the self station 255 1 Processing code Speci...

Страница 491: ...always executed If a communication module is mounted on a station where one or more special function modules that can interrupt the PLC CPU are also mounted the module closest to the PLC CPU executes...

Страница 492: ...number of device points It is possible to write data to a Q QnA series PLC CPU s device memory using this code Specify the following data for control table Format 1 control table 0 Specify the statio...

Страница 493: ...Processing code Specify 515 H203 5 Specify the device using the defined code See Section 4 2 5 for the code numbers 6 Specify the device number lower of the device specified in 5 See Section 4 2 5 fo...

Страница 494: ...PLC No 1 PLC No 2 PLC No 3 PLC No 4 Control PLC 992 H3E0 993 H3E1 994 H3E2 995 H3E3 1023 H3FF 6 Specify the device using the defined code See Section 4 2 5 for the code numbers 7 Specify the device n...

Страница 495: ...ple that writes data to a Q QnA series PLC CPU s device memory 110 DIM TBL 10 A 20 Defines arrays 120 TBL 0 255 Specifies the station number to communicate with to the local station 130 TBL 1 515 Spec...

Страница 496: ...es the number of points to be written 250 A 0 HF 260 PCWT TBL A Executes the write operation 270 END 3 Program example a for format 3 control table 100 A program example that writes data to a Q QnA se...

Страница 497: ...ted CPU Specify the requested CPU 1 4 5 Processing code Specify the processing code 2 5 6 Lower Number of word device points Specify the number of word device points to be read Higher Number of bit de...

Страница 498: ...owable specification range 6 Specify the device number higher of the specified device See Section 4 2 5 for the allowable specification range 7 Specify the device processing unit When writing in bit u...

Страница 499: ...ee Section 4 2 5 for the code numbers 8 Specify the device number lower of the specified device See Section 4 2 5 for the allowable specification range 9 Specify the device number higher of the specif...

Страница 500: ...e written 1 8 Specify the device type using the defined code See Section 4 2 5 for the code numbers 9 Specify the device number lower of the specified device See Section 4 2 5 for the allowable specif...

Страница 501: ...INT D 65536 L D H 65536 H RIGHT 0000 HEX H 4 L RIGHT 0000 HEX L 4 6 VAL H L 7 VAL H H In case of a format 2 control table 9 VAL H L 10 VAL H H In storage area for data to be written specify the data...

Страница 502: ...f the device number 210 TBL 7 0 Specifies word units as processing unit 220 TBL 8 0 Fixed value 230 TBL 9 144 Specifies internal relays M 240 D 0 Specifies device number 0 250 GOSUB 400 260 TBL 10 L S...

Страница 503: ...higher digit of the device number 230 TBL 10 0 Specifies word units as processing unit 240 TBL 11 0 Fixed value 250 TBL 12 144 Specifies internal relays M 260 D 0 Specifies device number 0 270 GOSUB 4...

Страница 504: ...230 TBL 10 H Stores the higher digit of the device number 240 TBL 11 0 Specifies word units as processing unit 250 TBL 12 0 Fixed value 260 TBL 13 144 Specifies internal relays M 270 D 0 Specifies de...

Страница 505: ...pecify the station number of the PLC 3 3 Detailed error code Detailed error codes are stored here 4 Requested CPU Specify the requested CPU 1 4 5 Processing code Specify the processing code 2 5 6 Star...

Страница 506: ...Format 2 control table 0 Format 2 control table Specify 256 H100 1 Specify the network number of the network to be accessed See Section 4 2 2 for the allowable specification range 2 Specify the statio...

Страница 507: ...Processing code Specify 533 H215 5 Specify the requested CPU PLC No 1 PLC No 2 PLC No 3 PLC No 4 Control PLC 992 H3E0 993 H3E1 994 H3E2 995 H3E3 1023 H3FF 6 Specify the starting I O number of the int...

Страница 508: ...he starting address is 000H the special function module number is 00H b In case of a module where the first half slot is allocated as a vacant slot e g AD72 A84AD PLC CPU Special function module 32 po...

Страница 509: ...digit expression of the starting number of the I O signals viewed from a remote I O station Specify the module number using the starting I O signal viewed from a remote I O station regardless of the s...

Страница 510: ...imal convert address for the FROM TO instruction x 2 into a hexadecimal number then add the starting address of each module Example When specifying address 1 of the FROM TO instructions the preset val...

Страница 511: ...H L 12H L 18H L 00H H 1 2 3 82H 83H 84H 85H 86H 87H Address Storage status of data written Buffer memory viewed from the BASIC program Buffer memory viewed from the PLC CPU Address Specify 2 If an inp...

Страница 512: ...address 230 TBL 5 1 Specifies the number of points to be read 240 A 0 1000 Specifies the values to be written 250 PCRD TBL A Executes the write operation 260 END 2 Program example of a format 2 contro...

Страница 513: ...ber 1 150 TBL 2 1 Specifies station number 1 160 TBL 4 533 Specifies to read buffer memory 170 TBL 5 H3E3 Specifies the requested CPU PLC No 4 180 TBL 6 H0 Specifies the starting I O number 190 D H1 S...

Страница 514: ...ond item of data to be displayed is displayed following the first character string in immediate succession Note however that a comma cannot be used to separate items of data to be displayed unless the...

Страница 515: ...displayed Syntax data to be displayed Specify the character string or numeric value to be displayed Examples 123 56 PRINT USING 123 56 Displays 123 56 ABCD PRINT USING ABCD Displays four letters ABCD...

Страница 516: ...any remaining character spaces of the format PRINT USING ABCD ABCD OD PRINT USING ABCD EFGH ABCDEFGH OK PRINT USING AB CD AB CD OK Format specification for a numeric value In order to display a numer...

Страница 517: ...is displayed before or after a numeric value respectively PRINT USING 68 9 68 9 OK PRINTUSING 24 24 0 OK PRINT USING 55 55 0 OK If this character is specified at the end of the format string a negativ...

Страница 518: ...e characteristic If a sign or a sign is not specified at the beginning or end of the format string respectively a blank space or a sign is displayed for the integer part PRINT USING 234 56 2 35e 02 OK...

Страница 519: ...to a sequential file In order to use the PRINT instruction it is necessary to open a sequential file using the OPEN instruction in advance The PRINT instruction writes data to a sequential file in th...

Страница 520: ...opened as file number 1 A 1234 B ABCD Sequential file 1 1234ABCD Examples PRINT 2 USING C Adds to the numeric value C and writes it to the file opened as file number 2 C 456 7 Sequential file 2 456 7...

Страница 521: ...ber Random file buffer 3 2 1 Description The PUT instruction writes data in a random file buffer to a random file If file number is omitted data will be written to the record number next to the one sp...

Страница 522: ...offset 2 Specify the offset value in byte units from the beginning of the storage area for data to be written Syntax number of bytes Specify the length of data to be written in byte units PUTMEM TO 0...

Страница 523: ...s specified by the PUTMEM instruction Buffer memory address 0 Buffer memory address 1 Buffer memory address BFFH 17FEH 17FFH 1800H 1801H 37FEH 37FFH Buffer memory Common memory As shown above one addr...

Страница 524: ...respect to the address device specified in write destination in offset 1 in byte units Specify which part of the data in variables etc specified in storage area for data to be written in offset 2 sho...

Страница 525: ...ten the number of bytes specified when writing n characters is as follows since one en character contains 2 bytes number of bytes n The allocation size and type of each data item in buffer memory shou...

Страница 526: ...ten Displays the data written 180 FOR I 1 TO 10 190 PRINT A I 1 200 NEXT I 210 ZRELEASE 1 Releases resource number 1 220 END Ends the execution 10 This program reads data from extension registers TASK...

Страница 527: ...A 0 A 2 Reads the value of the 40th bit counting from the 0th bit of A 0 Description The RDSET function reads the bit data at a position specified in integer expression in the one dimensional integer...

Страница 528: ...e the same 65535 32768 32767 0 1 32768 FFFFH 8000H 7FFFH 0000H FFFFH 8000H 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 0111 1111 1000 0000 0000 0000 1000 0000 0000 0000 0000 0000 0000 0000 to to...

Страница 529: ...e variable type specified in the READ instruction can be either a numeric value or character string However the types of the value to be read and the variable must match If the types do not match a Sy...

Страница 530: ...entered is displayed as it is in the program list It is possible to branch to a REM instruction from a GOTO or GOSUB instruction but in this case the execution is simply started from the first executa...

Страница 531: ...in the new line numbering If it is omitted it is assumed that 10 is specified The RENUM instruction changes the line numbers used in each of instructions such as GOTO GOSUB IF THEN IF GOTO ON GOTO an...

Страница 532: ...r If line number is omitted the READ instruction after the execution of the RESTORE instruction reads values from the first DATA instruction in the program If line number is specified the READ instruc...

Страница 533: ...n error Examples RESUME 150 Ends the error handling and resumes the program execution from line 150 Description The RESUME instruction ends the error handling specified by the ON ERROR GOTO instructio...

Страница 534: ...expression indicates the length of the character string to be extracted If the value of numeric expression is 0 a null character string is returned If a value greater than 255 is specified an Illegal...

Страница 535: ...nction generates a random number in the interval from 0 and up to but not including 1 The generated random number varies depending on the value specified in numeric expression If numeric expression is...

Страница 536: ...the value of the most significant bit sign bit is shifted to the least significant bit Rotated to the left if the value of numeric expression 2 is positive Rotated to the right if the value of numeric...

Страница 537: ...fies the number of bits to be rotated 40 C 1 50 D ROT A B Rotates the bits 60 E ROT A C 70 PRINT Rotate A A to the left by one bit D D Displays the result 80 PRINT Rotate A A to the right by one bit E...

Страница 538: ...ry to use the FIELD instruction to define a character string variable before executing the RSET instruction If the character string expression is shorter than the field length assigned to the characte...

Страница 539: ...number Description The RUN 1 instruction starts the execution of the program currently exists in the program area If line number is specified the execution starts from the specified line If line numbe...

Страница 540: ...nd executes it The RUN 2 instruction loads a program into memory from a memory card FD or HD and executes it Specify the memory card FD or HD from which the program is read in drive number using the f...

Страница 541: ...in AD51H S3 MEMORY CARD 1 0 To specify the memory card inserted in AD51H S3 MEMORY CARD 2 1 To specify the A drive of the console 2 To specify the C drive of the console 3 To specify the D drive of th...

Страница 542: ...of the array where 5 was found Description The SEARCH function searches for the value specified in value to be searched for in the array variable specified in array variable name and returns the numbe...

Страница 543: ...M A 10 Defines an array 30 FOR I 0 TO 10 Repeats from I 1 to 10 40 A I I 3 Stores values in the array variable 50 PRINT A I A I 60 NEXT I 70 B SEARCH A 6 0 3 Searches for 6 80 PRINT 6 is found in A B...

Страница 544: ...tive 0 to A if the value of B is 0 and 1 to A if the value of B is negative Description The SGN function returns the sign of a value It returns 1 if the value of numeric expression is positive 0 if it...

Страница 545: ...ally Thus if 16 is specified in numeric expression 2 the function value will always be 0 Shifted to the left if the value of numeric expression 2 is positive Shifted to the right if the value of numer...

Страница 546: ...d be shifte 40 C 1 50 D SHA A B Arithmetic shift 60 E SHA A C 70 PRINT Shift A A to the left by one bit arithmetically D D Displays the result 80 PRINT Shift A A to the right by one bit arithmetically...

Страница 547: ...16 is specified in numeric expression 2 the function value will always be 0 Shifted to the left if the value of numeric expression 2 is positive Shifted to the right if the value of numeric expressio...

Страница 548: ...ue should be shifted 40 C 1 50 D SHT A B Logical shift 60 E SHT A C 70 PRINT Shift A A to the left by one bit logically D D Displays the result 80 PRINT Shift A A to the right by one bit logically E E...

Страница 549: ...alue and assigns it to A Description The SIN function returns the sine function value of numeric expression which must be given in radians 180 x angle numeric expression can be any type of value but t...

Страница 550: ...value range for numeric expression is from 0 to 255 If a value greater than 255 is specified an Illegal function call error occurs The space character returned by the SPACE function is the half byte n...

Страница 551: ...ed to the communication port specified by the ZODV instruction or write it to a printer connected to the communication port specified by the ZLDV instruction See the ZODV instruction for information a...

Страница 552: ...QR function returns the square root of the specified value The value of numeric expression must be 0 or positive The calculation of the SQR function is performed in single precision Program Example 10...

Страница 553: ...nn nnnnn indicates a line number Unlike the END instruction the STOP instruction does not close open files After a program is forced into the status where it waits for instruction entry by the executi...

Страница 554: ...recision and floating points The length of the character string returned is equal to the number of digits of the value plus one character representing the sign If the value is positive the sign charac...

Страница 555: ...11 385 11 385 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN A 123 B 456 C 1 23456E 07 A B 579 A B 123 456 C 1 23456E 07 O REMARK See the HEX OCT and VAL functions...

Страница 556: ...ber of times Specify the number of characters in the string obtained in numeric expression 1 If character string expression is used to specify the character only the first character in the string is v...

Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...

Страница 558: ...ommunication module s system mode S CR OK SYSTEM In execution mode The SYSTEM instruction stops the programs in all tasks and returns to the communication module s system mode In addition an Illegal f...

Страница 559: ...e specified in variable 2 Any types of variables can be specified in variable integer single precision double precision or character string However a Type mismatch error occurs if the types of two var...

Страница 560: ...character position indicated by numeric expression If the current character display position already exceeds the value in numeric expression a new line is started and the same operation is performed T...

Страница 561: ...n returns the tangent function value of numeric expression which must be given in radians 180 x angle Numeric expression can be any type of value but the TAN function always calculates the result in s...

Страница 562: ...cond 1 Use colons to separate hours minutes and seconds 2 The hours are specified in 24 hour format from 0 to 23 3 If either of the specifications is 0 to 9 add a leading 0 to make it 00 to 09 4 All t...

Страница 563: ...11 393 11 393 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the User s Manual of the applicable CPU for information about the accuracy of the PLC CPU s clock See the DATE function...

Страница 564: ...he TROFF instruction is used to debug programs together with the TRON instruction When the TROFF instruction is executed the trace tracking is ended The TROFF instruction can be executed in both direc...

Страница 565: ...tions are displayed enclosed in square brackets while the program is executed The display can be shown only on the console screen the display target specification by the ZODV instruction is ignored Th...

Страница 566: ...specified The first and second characters in the string must be the 0 characters which indicate an octal value Specify digits only from the third character and onward Space line feed and tab characte...

Страница 567: ...C Converts the character string 1234 to the numeric value 1234 ignoring the leading space 120 PRINT VAL D Returns 0 because the character string does not represent a numeric value 130 PRINT VAL E Tre...

Страница 568: ...extension register ED80 Description The W variable reads or writes word information of devices Specify the following device type for device Extension registers ED Specify a device number in the follow...

Страница 569: ...I instructions and then write to each device Example 100 DIM A 1 110 CDBI 123456 A 0 Converts 123456 to 32 bit data and then assigns the lower 16 bits to A 0 and the higher 16 bits to A 1 120 W ED 102...

Страница 570: ...ber of repetitions of the execution a condition for repeated execution is specified If the value of expression is True any other value than 0 the instructions from the one immediately after the WHILE...

Страница 571: ...er loop is completely contained within the outer loop Program Example 10 This program repeats a calculation while the specified condition holds 20 I 1 Sets the initial value 30 WHILE I 10 Repeats unti...

Страница 572: ...haracters in the string is printed in the new line If the value specified in output value is 255 it is interpreted as if the output width is infinite the CR carriage return code is not sent to the pri...

Страница 573: ...it counting from the 0th bit of A 0 Description The WTSET function writes data 1 or 0 specified in integer expression 2 to the bit specified in integer expression 1 in the one dimensional integer arra...

Страница 574: ...0H FFFFH 8000H 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 0111 1111 1000 0000 0000 0000 1000 0000 0000 0000 0000 0000 0000 0000 to to to to to to to to to Program Example 10 This program writes...

Страница 575: ...tly being created or executed to A Description The ZBAS shows in which of the communication module s BASIC task areas the program currently being created or executed resides It is possible to create a...

Страница 576: ...2C ZCLOSE Closes all communication ports opened in the program Description The ZCLOSE instruction closes communication channels opened by the ZOPEN instruction and terminates the communication through...

Страница 577: ...munication channel The content of the processing is specified by the processing code in the control table as follows Processing code Description RS 232C RS 422 PARALLEL 16 Setting communication parame...

Страница 578: ...opened an error occurs Specify the processing code that corresponds to the processing to be performed and the parameters required in the processing in control table which must be an integer array vari...

Страница 579: ...bytes respectively Processing Code 17 3 Stop bit Read the status of the stop bit into the lower byte It is possible to set or read communication parameters of an open communication channel using thes...

Страница 580: ...L2 3 H1 Sets the stop bit 120 ZCNTL A 0 TBL2 Executes the setting of the communication parameters 130 TBL3 0 17 Specifies to read the communication parameters 140 ZCNTL A 0 TBL3 Executes reading the c...

Страница 581: ...ta This data has no meaning work area used by the system Processing Code 19 3 Receive buffer Read the size of the receive buffer It is possible to set or read communication control parameters of an op...

Страница 582: ...xpress the higher byte as a 2 digit hexadecimal number Specify the number of bytes for the receive buffer size in the following manner 0 No receive buffer data received before the execution of a recei...

Страница 583: ...ding 140 A RIGHT 0000 HEX TBL3 1 4 150 L RIGTH A 2 160 H LEFT A 2 170 B 0 VAL H L The value of the lower byte of TBL 3 180 B 1 VAL H H The value of the higher byte of TBL 3 190 B RDSET 1 B 0 Checks th...

Страница 584: ...characters 1 and 2 Read the code for break character 1 into the lower byte and the code for break character 2 into the higher byte Processing Code 23 3 Break characters 3 and 4 Read the code for brea...

Страница 585: ...mal number Program Example 10 This program sets and reads break characters 20 DIM TBL1 2 TBL2 4 TBL3 4 Defines arrays 30 A 1 Communication channel CH1 RS 232C 40 TBL1 0 9600 Sets the baud rate 50 TBL1...

Страница 586: ...uous break characters Specify 25 for the processing code in order to read the continuous break characters Specify whether or not continuous break characters should be enabled in setting 0 Disabled 1 E...

Страница 587: ...e baud rate 140 TBL1 1 H107 Sets the character length and parity bit 150 TBL1 2 H1 Sets the stop bit 160 ZOPEN A TBL1 Opens the communication channel 170 TBL2 0 24 Specifies to set continuous break ch...

Страница 588: ...interface cannot be controlled by the DTR ER control signal Specify 32 for the processing code The ON OFF status of each control signal is specified in the following manner using the higher and lower...

Страница 589: ...r length and the parity bit 60 TBL1 2 H1 Sets the stop bit 70 ZOPEN A TBL1 Opens the communication channel 80 TBL2 0 18 Specifies to set the communication control parameters 90 TBL2 1 H0 Control by th...

Страница 590: ...code is used to read the ON OFF status of the CS CTR DSR DR RS RTS DTR ER and CD control signals of an open communication channel Specify 33 for the processing code The CS CTR control signal cannot b...

Страница 591: ...CH 0 TBL2 Executes the read operation 100 A RDSET 0 TBL2 1 Reads the bit 110 B RDSET 8 TBL2 1 120 C RDSET 0 TBL2 2 130 D RDSET 8 TBL2 2 140 E RDSET 0 TBL2 3 150 PRINT CS control signal Displays the s...

Страница 592: ...ancel the high impedance before sending the data The impedance should then be set high again after sending the data Stations other than the station sending data should be in the high impedance status...

Страница 593: ...ve occurred in an open communication channel using this code Specify 64 for the processing code The reception error causes are expressed in the following manner using the lower 8 bits of 1 1 2 3 0 Par...

Страница 594: ...communication channel 70 TBL2 0 64 Specifies to read the causes of reception errors 80 ZCNTL CH 0 TBL2 Executes the read operation 90 A RDSET 3 TBL2 1 Reads the bits 100 B RDSET 4 TBL2 1 110 C RDSET 5...

Страница 595: ...r using this code Specify 80 for the processing code The reading operation can be performed on CH1 RS 232C CH2 RS 232C and CH3 RS 422 485 Program Example 5 This program reads the receive buffer size a...

Страница 596: ...d during communication with an external device that uses the ZSEND and ZRECEIVE instructions Shift JIS Kanji code KI code JIS Kanji code KO code The KI Kanji shift in and KO Kanji shift out codes vari...

Страница 597: ...out code 10 in the higher byte This processing code is used to specify Kanji shift in codes and Kanji shift out codes which are used at inputting outputting JIS Kanji codes when Kanji code conversion...

Страница 598: ...characters is specified as 3 Shift in code 2nd character 1st character 4 Higher byte Lower byte This byte is ignored 3rd character 5 Shift out code 9 This byte is ignored 10 Thus in order to specify...

Страница 599: ...ing 150 TBL 0 100 Specifies to set Kanji shift in shift out codes 160 TBL 1 1 Specifies to change the codes 170 TBL 2 3 Specifies the number of characters for shift in codes 180 TBL 3 3 Specifies the...

Страница 600: ...wing manner using the lower 8 bits of 1 1 2 3 0 Terminal error 1 Normal 0 Terminal error 4 5 6 7 Bits marked with X are ignored Out of paper 1 Out of paper 0 Paper supplied Terminal connection status...

Страница 601: ...the printer status 50 ZCNTL 4 0 TBL Executes the read operation 60 A RDSET 0 TBL 1 Reads the bits 70 B RDSET 1 TBL 1 80 C RDSET 2 TBL 1 90 PRINT The printer status Displays the result 100 IF A 1 THEN...

Страница 602: ...code The initialization signal is sent to the printer via the INIT signal of the parallel interface The data set at the initialization caused by the INIT signal depends on the printer see the manual o...

Страница 603: ...ame event number is executed A program waiting for the generation of the event if any can then resume execution If the event generation is disabled the following occurs The event corresponding to even...

Страница 604: ...nd functions INPUT INKEY INPUT LINE INPUT Specify the communication port to which the device used for data input is connected in channel number Channel number Communication port 0 1 2 3 The console sp...

Страница 605: ...he printer is connected in channel number in the following manner Channel number Communication port 0 1 2 3 4 A printer connected to a peripheral device the printer set by the basic utility of the per...

Страница 606: ...perform communication between programs that operate in multitask operations It is possible to define up to 32 message ports message port number is used to specify which of the message ports to be defi...

Страница 607: ...al value of all of output element Integer data Single precision floating point data Double precision floating point data Character data 2 bytes per data 4 bytes per data 8 bytes per data 1 byte per ch...

Страница 608: ...40 PRINT A Displays the result 150 ZMESSAGE KILL 1 Erases message port 1 160 ZMESSAGE KILL 2 Erases message port 2 170 END 10 This program exchanges data between tasks via the message ports TASK 2 20...

Страница 609: ...ge port number of the message port to be closed in message port number If it is omitted all open message ports will be closed Message ports specified in message port number cannot be used in a program...

Страница 610: ...to read messages written in a message port If no messages have been written in the message port the program execution is halted and the program waits for a message to be written Specify the number of...

Страница 611: ...precision Double precision ZMESSAGE GET 1 P Q R ZMESSAGE GET 1 A1 A2 A3 Integer 3 Integer Single precision Double precision In timeout value specify the maximum time the program waits for a message t...

Страница 612: ...Specify the message port number of the message port to be deleted in message port number In order to delete message ports it is necessary to close all open message ports in all programs being executed...

Страница 613: ...pen message ports previously defined by the ZMESSAGE instruction Specify the message port number of the message port to be opened in message port number The ZMESSAGE instruction only defines the messa...

Страница 614: ...ssages to message ports Specify the message port number of the message port to which messages are to be written in message port number A numeric constant character string constant numeric variable cha...

Страница 615: ...11 445 11 445 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZMESSAGE ZMESSAGE CLOSE ZMESSAGE GET ZMESSAGE KILL and ZMESSAGE OPEN instructions and Section 8 5 2...

Страница 616: ...stored before the transfer offset 2 Specify the data storage location within the transfer source variable array or character variable using a number from 0 to 65534 in byte units number of transferre...

Страница 617: ...0 and 1 to 1 and 2 0 1 2 Transfer destination Example 2 Transfer destination Transfers to a memory area with a different data type 0 1 2 Transfer destination Example 3 Transfer destination Transfers t...

Страница 618: ...arget range for transfer If transfer destination is specified as an array variable name specify the byte offset value relative to the starting address of the memory area of the specified element only...

Страница 619: ...umber of bytes if the numbers of bytes to be transferred differ between transfer destination and transfer source The value ranges that can be specified for offset 1 offset 2 and number of transferred...

Страница 620: ...ariable B 20 DIM A 9 Defines an array 30 A 0 H4241 Stores the data 40 A 1 H4443 50 PRINT A 0 HEX A 0 Displays the data before being transferred 60 PRINT A 1 HEX A 1 70 PRINT 80 B SPACE 255 Stores dumm...

Страница 621: ...ructions functions CLS PRINT USING LOCATE SPC PRINT TAB Specify the communication port to which the device used for data output is connected in channel number using the values below Channel number Com...

Страница 622: ...he communication module should be used in channel number The correspondence between channel numbers and communication ports are as follows Channel number Communication port 1 2 3 4 CH1 RS 232C CH2 RS...

Страница 623: ...Since the character length and parity bit are required to be specified using the lower and higher bytes it is convenient to use hexadecimal as shown below 2 H Indicates the lower byte as a 2 digit hex...

Страница 624: ...specified in control table and stores it in input element Specify which communication port of the communication module should be used in channel number The correspondence between channel numbers and c...

Страница 625: ...r occurs the number of bytes of data received before the timeout error occurrence is stored in control table 1 and the data received before the timeout error occurrence is stored in input element The...

Страница 626: ...ta character is treated as 1 byte therefore specify the same number for the number of bytes requested to be received as the number of characters of data to be received Note however that if full byte c...

Страница 627: ...an array 200 TBL2 0 12 Sets the number of bytes requested to be received 210 TBL2 1 0 Stores the number of bytes received 220 TBL2 2 300 Sets the timeout value 230 WOR TBL2 0 2 Reads 2 bytes 240 DIM C...

Страница 628: ...Turns ON the RS control 210 ZCNTL CH 0 CNTL Executes the control by signals 220 230 DATA SEND 240 DIM TBL 2 Defines an array 250 TBL 0 12 Sets the requested characters 260 TBL 1 0 Stores the number o...

Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...

Страница 630: ...whose execution is being paused executes the ZRESERVE instruction and specifies the same resource number as the resource that was released it can take over the exclusive use of the resource Specify th...

Страница 631: ...f the resource In order to terminate the exclusive use specify the same resource number as in the ZRESERVE instruction that prohibited the use and execute the ZRELEASE instruction The ZRESERVE and ZRE...

Страница 632: ...ogram B ZRESERVE 1 ZRESERVE 2 ZRELEASE 2 ZRELEASE 1 Program C ZRESERVE 0 ZRESERVE 2 ZRELEASE 2 ZRELEASE 0 Example of deadlock occurrence When programs D and E are being executed concurrently if E exec...

Страница 633: ...l table and stores it in input element Specify which communication port of the communication module should be used in channel number The correspondence between channel numbers and communication ports...

Страница 634: ...ytes of data sent before the timeout error occurrence is assigned to control table 1 The allowable specification range is from 0 to 65535 However if a value from 32768 to 65535 is to be specified it s...

Страница 635: ...tion and assign data to it before executing the ZSEND instruction If an integer array name or character array variable is specified as output element make sure to define the array using the DIM instru...

Страница 636: ...es an array 200 TBL 0 30 Sets the number of bytes requested to be sent 210 TBL 1 0 Assigns the number of bytes transmitted to TBL 1 220 TBL 2 100 Sets the timeout value 230 SD SOUSIN DATA ABCDEFGH 123...

Страница 637: ...number of characters received 210 TBL 2 300 Sets the timeout value 220 TBL 3 0 Sets the number of break characters 230 TBL 4 0 Sets break characters 1 and 2 240 TBL 5 0 Sets break characters 3 and 4 2...

Страница 638: ...11 468 11 468 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZRECEIVE and ZCNTL instructions and Section 7 3 4...

Страница 639: ...e event executes the next statement regardless of whether or not there is another program that waits for the event generation The event should be defined using the DEF ZEVENT instruction and the event...

Страница 640: ...uction starts up a program in the specified task area When starting a program already resident in memory of the communication module Specify only number then the program stored in the task area specif...

Страница 641: ...is saved in system name If the specified system name does not exist a File not found error occurs Specify the name and extension of the file for the saved program in file name In order to start up a...

Страница 642: ...o each program s priority When each program is started up the priority is set to 1 The ZURGENCY instruction has the functionality to change the priority of the program that executes this instruction I...

Страница 643: ...m 0 to 9 Examples ZWAIT DELAY 00 01 00 0 Pauses the program execution for one minute Description The ZWAIT DELAY instruction pauses the program execution until the time specified in time has elapsed t...

Страница 644: ...rated the program is put into the wait status Specify the event number of the event whose generation is to be waited for in event number The event number should be the one given to the event at the de...

Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...

Страница 646: ...HD used for saving or reading a program or data for a drive number A unique number is assigned to each memory card interface FDD and HDD specify these numbers as the drive number AD51H MITSUBISHI MEM...

Страница 647: ...haracters System names that cannot be used The following words have special meanings and therefore cannot be used AUX CLOCK CON NUL PRN BAT COM EXE However these words can be used as a part of a syste...

Страница 648: ...name Extension Characters that can be used Alphabet A to Z a to z Numbers 0 to 9 Kana Kanji JIS level 1 standard Kanji and non Kanji Certain symbols _ Number of characters that can be used Name Exten...

Страница 649: ...ose file name begins from A BAS Represent all files whose file extension is BAS Represent all files within the specified system name Any character specified after an asterisk in a file name or extensi...

Страница 650: ...AS AD51HG BAS AD51H BAS All of these will be included 4 Characters after an asterisk will be disregarded When using a wild card with the KILL instruction check which files will be included beforehand...

Страница 651: ...ZODV instructions that switch the console the settings of the character display position and the console switching may become disrupted as shown in the example below Create the program in such a way t...

Страница 652: ...ND FILES GET GETMEN INPUT INPUT KEY KEYLIST KILL LFILES LINE LINE INPUT LINE INPUT LIST LLIST LOAD LOCATE LPRINT LPRINT USING MERGE NAME NEW PRINT PRINT USING PRINT PRINT USING PUT PUTMEN RUN SAVE SET...

Страница 653: ...ower 4 bits hexadecimal 0 The characters shown in a shaded box vary according to the terminal used see the manual for the console See the manual for the terminal used for the Kanji codes REMARK The fo...

Страница 654: ...e upper left corner Ctrl B Moves the cursor to the left item by item Ctrl C Acts identically to the Break key Ctrl E Deletes all characters from the position at which the cursor is currently blinking...

Страница 655: ...H DC1 code 11H XOFF Specifies to disable transfer from an external device DC3 code 13H DC3 code 13H Escape Escape sequence introducer ESC code 1BH ESC code 1BH Cursor backward BS code 08H BS code 08H...

Страница 656: ...RR STOP RUN RESET M PROTECT INDICATOR RESET The error code and the line where the error occurred are displayed alternately in hexadecimal format Error code Line where the error occurred The error code...

Страница 657: ...ame Bad file number 52 34H A file number other than 1 to 8 is specified Specify a file number within the range Can t continue 17 11H The execution cannot be restarted using the CONT instruction the po...

Страница 658: ...already existing file name or change the file name to be changed to a different one File already open 55 37H An instruction such as OPEN or KILL was executed to an already open file Modify the program...

Страница 659: ...instruction Overflow 6 6H Calculation results or input numerical values have exceeded the allowable range Modify the program so that the calculation results do not exceed the range Position not on Sc...

Страница 660: ...t error 31 FH Characters for the specified number of bytes are not entered within the time specified by the INPUT instruction Check whether or not there was an input Type mismatch 13 DH The types of v...

Страница 661: ...expressed as a 4 digit hexadecimal number The code is read as follows Indicates the task number where an error occurred Indicates the error code The error code given by the ERR function is a decimal...

Страница 662: ...efined it is not necessary to define the message port anew 832H The specified message port is not defined Use the port after defining it 833H The message length exceeded 256 bytes Decrease the message...

Страница 663: ...ted from multiple tasks Modify the program so that the instruction is not executed from multiple tasks 984H A fatal error occurred in the memory card Replace the memory card 985H The format of the fil...

Страница 664: ...H Baud rate specification is incorrect Specify the baud rate correctly A94H Character length specification is incorrect Specify the character length correctly A95H Parity bit specification is incorrec...

Страница 665: ...m at the time of monitor registration Use the same system configuration as at the time of monitor registration B87H There are too many points to be monitored Decrease the number of monitoring points B...

Страница 666: ...20H INIE error F21H MISE error Reset the module Or replace the hardware F80H Memory card 1 battery low Replace the battery with the memory card connected while the power to the AD51H S3 is on F81H Mem...

Страница 667: ...eck to see if there is a corresponding extension R register block in the specified extension R register block number or the CPU 7149H ROM operating error The CPU is currently accessing the ROM Change...

Страница 668: ...c cotangent ARCCOT X ATN X 1 5708 Cosecant SCS X 1 SIN X Cotangent COT X 1 TAN X Secant SEC X 1 COS X Hyperbolic sine SINH X EXP X EXP X 2 Hyperbolic cosine COSH X EXP X EXP X 2 Hyperbolic tangent TAN...

Страница 669: ...ENT INPUT B BEEP DELETE INPUT BIN DIM INPUT BLOAD DRAW INSTR BSAVE DRD INT DWT C CALL K KEY CDBI E ED KILL CDBL EDIT CHAIN ELSE L LEFT CHR EM LEN CIDB END LET CINT EOF LFILES CISN EQV LINE CLEAR ERASE...

Страница 670: ...OP ZMESSAGE KILL OUT STRING ZMESSAGE OPEN STR ZMESSAGE PUT P PC SWAP ZRELEASE PEEK SYSTEM ZRESERVE PEEK2 ZSIGNAL POKE T TAB ZSTART POKE2 TAN ZURGENCY PORT TC1 ZWAIT DELAY POS TC2 ZWAIT EVENT PRCHE THE...

Страница 671: ...e external device when the free area in the receive buffer becomes three fourths or more of the total space because of receive requests from the BASIC program in the communication module BASIC program...

Страница 672: ...a data transmission is stopped due to the reception of the DC3 control signal the remaining data will be sent when a DC1 control signal is received again later Channel open 1 BASIC program ZOPEN ZSEND...

Страница 673: ...ol signal is turned OFF when the free area in the receive buffer becomes one fourth or less of the total space as data received from the external device is stored An ER control signal is turned ON whe...

Страница 674: ...rom the external device is stored until there is no more free area in the receive buffer However the received data remaining in the receive buffer when the communication channel is closed and the rece...

Страница 675: ...es one fourth or less of the total space as data received from the external device is stored An RS RTS control signal is turned ON when the free area in the receive buffer becomes three fourths or mor...

Страница 676: ...rom the external device is stored until there is no more free area in the receive buffer However the received data remaining in the receive buffer when the communication channel is closed and the rece...

Страница 677: ...ps When the data transmission stops due to the DR DSR control signal being turned off the remaining data will continue to be sent when the DR DSR control signal turns ON again later BASIC program ZOPE...

Страница 678: ...s When the data transmission stops due to the CS CTS control signal being turned off the remaining data will continue to be sent when the CS CTS control signal turns ON again later BASIC program ZOPEN...

Страница 679: ...R DSR RS RTS CS CTS Connector RS 232C External device Connector If the RS RTS control is disabled data can be received from the external device but data cannot be sent to the external device In order...

Страница 680: ...nal name RD RXD SD TXD ER DTR SG DR DSR RS RTS CS CTS Connector RS 232C External device Connector If either the RS RTS or the ER DTR control is disabled data can be received from the external device b...

Страница 681: ...1 Opens the channel 60 TBL2 0 22 Specifies to set the break character 70 TBL2 1 2 Specifies the number of break characters 2 types 80 TBL2 2 H30D Specifies the break characters H03 and H0D data 90 ZCN...

Страница 682: ...o receive buffer A B C D E F BASIC program Communication channel open Result of channel opening Receive request Communication module Data OS Ignored Input elements A B C D E F Reception result ZOPEN t...

Страница 683: ...received 1 When there is no receive buffer If a transmission error occurs while a BASIC program is receiving data from the host after requesting to receive data the data received up to the time when t...

Страница 684: ...to the BASIC program Data received normally after the transmission error is stored in the receive buffer again so it can be accessed by the BASIC program BASIC program Communication channel open Resul...

Страница 685: ...eception request from the BASIC program has been completed the following processing is performed 1 All of the remaining data in the receive buffer is deleted 2 After processing 1 is completed data rec...

Страница 686: ...in the reception buffer for the amount of characters requested to be received from the BASIC program is returned to the BASIC program When the processing of the reception request from the BASIC progr...

Страница 687: ...6 Sending or Receiving Character Data of 256 Bytes or More When sending or receiving character data of 256 bytes or more to from an external device in non procedure mode via the RS 422 interface or RS...

Страница 688: ...vice transaction permission Specifications subject to change without notice HEAD OFFICE MITSUBISHI DENKI BLDG MARUNOUCHI TOKYO 100 8310 TELEX J24532 CABLE MELCO TOKYO NAGOYA WORKS 1 14 YADA MINAMI 5 H...

Отзывы: