Download AD51H-BASIC Programming Manual (Command)
Transcript
3 LET'S CREATE AND EXECUTE A PROGRAM MELSEC-Q 3.8 How to Use Arrays Let's assume that a quantity of 100 data must be assigned to variables. Using A1, A2 ... as variables, for example. We need 100 lines of code. ……… 10 A1=52 20 A2=60 30 A3=17 100 variables will be required, and that's a lot of trouble. It is much more convenient to use arrays in such instances. It is necessary to tell BASIC that arrays will now be used. This is done by using the DIM instruction. DIM A(99) This allocates locations to place data as shown below. Since the number 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 the following. A(50)=70 Now, the value within the parentheses can be specified by a variable, instead of a number. S=50 : A(S)=70 Since the value of S is 50, 70 will be assigned to A(50). Now, let's consider assigning 100 data to variables again. When READ, DATA, and FOR-NEXT from Section 3.5 and 3.6 are used. 10 20 30 40 50 DIM FOR READ NEXT DATA A(99) I=0 TO 99 A(I) 52, 60, 70, • • • How about this? The program is now amazingly short. Array variables become a useful tool when repeating similar processes by specifying a variable for a value within parentheses. 3 - 29 3 - 29
Related documents
Sony ZS-X1 User's Manual
QD51(-R24) A1SD51S AD51H-S3
DAVID SLS-2 Specifications
TECHNICAL BULLETIN
MSI-NC911 User Manual - Microcomputer Systems, Inc.
Intelligent Communication Module User`s Manual (Hardware)
USER`S MANUAL - Vital Systems
SV13/22Programming Manual (Motion SFC
All-digital Single-channel AC Servo Driver QS7 Series User Manual
MELSECNET/10 Mode - Mitsubishi Electric
Autolog User`s Guide, 3rd ed., 9/02 (773 Kbytes)
- Scantime.co.uk
iForks Order Picker User Manual
DSP56300 Enhanced Synchronous Serial Interface (ESSI
User Manual - Affordable Scales & Balances
Q Corresponding Intelligent Communication Module User`s Manual
QD51(-R24)
Series to Q Series Handbook (Fundamentals)
PC-Scheme/Geneva 4.02 log
Transition from MELSEC-A/QnA (Large Type), AnS/QnAS (Small
PAUP 3.1 Manual
Windows Platform & Installation Guide