MCode Boolean Logic Demonstration

The following program uses the Boolean logic operators available in MCode software. The first section starting at PG 1 calls subroutines based on the logical interpretation of general purpose inputs and calls respective subroutines.

The program section starting at PG 200 demonstrates how to assign a logical 1 or 0 to a variable based on an input value. Notice that an input's value can be assigned as a true or false depending on the second operator being a 1 or 0.


S1=0,0 'configure inputs 1 - 4 gen purpose
S2=0,0 'active low, sinking
S3=0,0
S4=0,0
VA zk
VA zl
VA zm
VA zn


PG 1
LB su ' 1    1    1     0 (!=NOT)
CL x1, I1 & I2 & I3 & !I4 = 1
H 200 'or any input
CL x2, I1 | I2 | I3 | I4 = 1
H 200 'exclusive or
CL x3, I1 ^ I2 = 1
BR su
E
LB x1
PR "x1 true"
H 500
RT
LB x2
PR "x2 true"
H 500
RT
LB x3
PR "x3 true"
H 500
RT

PG 200
LB xy
zk = I1 = 0 'makes variable zk not I1
PR "Input I1= "I1
PR "Variable zk= "zk
zl = I2 = 1 'makes variable zl = I2
PR "Input I2= "I2
PR "Variable zl= "zl

E

PG

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