MicroLYNX – Sequence control without motion

The following program illustrates using a MicroLYNX as a sequence controller for an industrial test machine without any motion control. Normally a programmable logic controller (PLC) would be utilized for a sequencing operation, but the user already had a MicroLYNX unit available along with programming familiarity.

This machine needed a total of 17 I/O points and was easily accommodated by adding three MX-DI100-000 Isolated Digital I/O modules that brought the capability to 24 configurable I/O points. The required I/O mix included four discreet inputs, five outputs, and two BCD thumbwheel switches.

This program is typical of an I/O intensive sequence that requires operator pushbutton input, feedback from switches, relay controls, and LEDs to manage the pass / fail test of a quality control requirement.

 

'Vacuum_Tester01App.lxt

'================================================
'Configure I/O
'================================================
'Slot 0 Inputs Sinking Active Low
'Group 20
Ios 21=0,0,0 'Start Switch
Ios 22=0,0,0 'Hi Press Sw
Ios 23=0,0,0 'Lo Press Sw
Ios 24=0,0,0 'Ckt Contact
Ios 25=0,0,0 'Spare
Ios 26=0,0,0 'Spare

'Slot 1 Outputs Sinking Active Low
'MX-DI100-000 I/O Expansion Board
'Group 30
Ios 31=0,1,0 'Charge LED
Ios 32=0,1,0 'Test LED
Ios 33=0,1,0 'Pass LED
Ios 34=0,1,0 'Fail LED
Ios 35=0,1,0 '1CR for VACUUM PUMP
Ios 36=0,1,0 'Spare

'Slot 2 Inputs Sinking Active Low
'MX-DI100-000 I/O Expansion Board
'Group 40
'Low Nibble Thumbwheel
Ios 41=0,0,0 '1
Ios 42=0,0,0 '2
Ios 43=0,0,0 '4
Ios 44=0,0,0 '8
Ios 45=0,0,0 'Spare
Ios 46=0,0,0 'Spare

'Slot 3 Inputs Sinking Active Low
'MX-DI100-000 I/O Expansion Board
'Group 50
'High Nibble Thumbwheel
Ios 51=0,0,0 '1
Ios 52=0,0,0 '2
Ios 53=0,0,0 '4
Ios 54=0,0,0 '8
Ios 55=0,0,0 'Spare
Ios 56=0,0,0 'Spare

'================================================
'Declare variables
'================================================
VAR=time_lo 'thumbwheel low BCD
VAR=time_hi 'thumbwheel high BDC
VAR=thumb   'thumbwheel byte

'================================================
'Program
'================================================
Pgm 1
LBL startup        'start on power up
 PRINT "Press Start Button"

LBL loop1
 BR loop1, Io 21=0  'Wait for Start Input
 PRINT "Cycle Start"
 CALL Init_IO       'turn off all outputs
 CALL GetTW         'get time from thumbwheels
 PRINT "Time " thumb
 PRINT "Charge Cycle"

LBL charge         'charge cycle
 Io 31=1           'charge LED on
 Io 35=1           'CR1 on
 BR charge, Io 22=0 'hi press sw
 Io 31=0           'Charge LED off
 Io 35=0           'CR1 off
 Io 32=1           'test LED on
 PRINT "Test Cycle"

LBL test           'test cycle
 BR fail, Io 23=1  'br fail if lo vac switch
 BR fail, Io 24=0  'or no ckt switch
 DELAY 1000        '1 sec delay
 DEC thumb         'decrement 1 second
 PRINT thumb
 BR test, thumb > 0 'test loop timer

LBL pass
 Io 32=0           'Test LED off
 Io 33=1           'Pass LED on
 PRINT "Pass"
 BR cmpt

LBL fail
 Io 32=0           'Test LED off
 Io 34=1           'Fail LED on
 PRINT "Fail!"

LBL cmpt
 PRINT "Complete"
 PRINT "Remove Part From Tester"

LBL switch         'wait for ckt switch to open
 BR switch, Io 24=1
 CALL Init_IO       'initialize I/O
 PRINT "Load New Part"
 BR startup         'start over
END                'end program
'================================================
'Subroutines
'================================================
LBL Init_IO        'turn off all outputs
 Io 30=0
 DELAY 100         '100mS delay
RET

LBL GetTW                 'Get thumbwheel values
 LBL GetLo                 'Get low value
  time_lo=Io 40 & 15       'mask nibble
 LBL GetHi                 'Get high value
  time_hi=Io 50 & 15       'mask nibble
  time_hi=time_hi * 10     'shift decade up
  thumb=time_hi + time_lo  'thumbwheel value
RET

Pgm 

Download Vacuum Tester .lxt file
Right-click, select Save Target As...
(color-coded in IMS Terminal)

 

> Return to Sample Code Index