IF THEN Sample

This sample configures input 1 as a general purpose input which can then be used as a control bit in the program. If I1 is true, the program continuously loops in label M1 with a relative move of 200000. If I1 goes false, the program falls through M1 and loops in label M2 with a relative move of -100000. A good way to observe the sequence of code execution is to launch the program in trace mode (EX SU,1). Every instruction is mirrored to the terminal window, which is beneficial for program development and debug.

'If THEN Sample

'CODE                  DESCRIPTION

PG 100                'Enter program mode at address 100
LB SU                 'Label using SU to start program
                      'upon power up
S1=0,1                'Sets I/O 1 as a general purpose
                      'input, active high
LB M1                 'Label to begin motion profile 1
MR 200000             'Move relative 200000 steps
H                     'Hold until motion is complete
BR M1, I1=1           'If input is true then branch to
                      'label M1
LB M2                 'Label to begin motion profile 2
MR -100000            'Move relative 100000 steps
H                     'Hold until motion is complete
BR M1, I1=1           'If input is true then brance to
                      'label M1
BR M2                 'Unconditional branch to label M2
E                     'End program
PG                    'Exit program mode

Download IF THEN sample .mxt file
(color-coded in IMS Terminal)

[Return to Motion Control Sample Code Index]


IMS Logo Wide

370 N. Main St., P.O. Box 457
Marlborough, CT 06447 U.S.A.
Phone: 860 / 295-6102
Fax: 860 / 295-6107
Email: info@imshome.com

Contact

TECHNICAL SUPPORT (U.S.A.)
Phone: 860 / 295-6102
Fax: 860 / 295-6107
E-mail: etech@imshome.com

IMS ASIA PACIFIC OFFICE
30 Raffles Pl., 23-00 Chevron House
Singapore 048622
Phone: +65 / 6233 / 6846
Fax: +65 / 6233 / 5044
E-mail: wllee@imshome.com

IMS EUROPEAN SALES MGT.
4 Quai Des Etroits
69005 Lyon, France
Phone: +33 / 4 7256 5113
Fax: +33 / 4 7838 1537
E-mail: bmartinez@imshome.com

IMS UK Ltd
.
25 Barnes Wallis Road
Segensworth East
Fareham, Hampshire, UK  PO15 5TT
Phone: +44 / 0 1489-889825
Fax:: +44 / 0 1489-889857
E-mail: mcheckley@imshome.com

U.S.A. SALES OFFICES
Eastern Region 

Phone: 973 / 661-1270
Fax: 973 / 661-1275
E-mail: jroake@imshome.com

Central Region
Phone: 260 / 402-6016
Fax: 419 / 858-0375
E-mail: dwaksman@imshome.com

Western Region
Phone: 602 / 578-7201
E-mail: dweisenberger@imshome.com