1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 'LIBERTY* MDRIVE DEMO PROGRAM 'Last modified 02/21/2013 'Sample test program for demontsration purposes only 'Not tested or verified for safety or any function '[VARIABLES] 'Define I/O configuration Is=1,0,0 Is=2,0,0 Is=3,0,0 Is=4,0,0 Os=1,16,0 'Set up system variables Vi=20000 Vm=1000000 A=500000 D=A Hc=20 Rc=75 '[PROGRAMS] 'The main program block is labeled SU 'a keyword which will execute the program 'om power up. PG 1 LB Su P=0 'The block G1 will cally various subroutines 'based upon the wieght of the input bsnk 'which is stored in register R1 LB G1 R1=In R1=R1 & 7 O1=0 CL K0,R1 = 0 CL K1,R1 = 1 CL K2,R1 = 2 CL K3,R1 = 3 CL K4,R1 = 4 CL K5,R1 = 5 CL K6,R1 = 6 CL K7,R1 = 7 H 10 BR G1 E '[SUBROUTINES] 'These 8 routines will rotate the motor '1 time for each input bit and repeat 'the input wieght changes LB K0 PR "Logic 000" MR R1*51200 H O1=1 H 2000 RT LB K1 PR "Logic 001" MR R1*51200 H H 200 RT LB K2 PR "logic 010" MR R1*51200 H H 200 RT LB K3 PR "Logic 011" MR R1*51200 H H 200 RT LB K4 PR "Logic 100" MR R1*51200 H H 200 RT LB K5 PR "Logic 101" MR R1*51200 H H 200 RT LB K6 PR "Logic 110" MR R1*51200 H H 200 RT LB K7 PR "Logic 111" MR R1*51200 H H 200 RT PG S 'Keep this line to save program on load '[END] |
Home > Resources > Example Programs > Binary mask
Binary mask
Description
This program will demonstrate ability to execute various subroutines depending on the binary value of inputs 1-3 while masking all inputs above input 3. The code shown on the right may be copied and pasted into the program editor window of the Motion Control Programmer application, or a zip file containing the program file may be downloaded below.
Requirements
Example program
When it comes to your form, fit and function requirements, don’t settle. Get precisely what you need working with us. We know motion.
Contact us with any questions about how we can help you with your motion application or for assistance with your IMS products.
Browse our resource section and find the most useful tools and documents for all our products.