Program Test; {For information scroll down!} Var Lpt: Word; S: String; Axis: Char; Steps, Speed, Dummy, L, M: Longint; Code: Integer; A, B, C: Byte; begin WriteLn(''); WriteLn('Copyright (c) 2002 by Walter. Email: walter@preg.de'); WriteLn(''); If ParamCount = 4 then begin {Get 4 values from command line} Val(ParamStr(1), Lpt, Code); S := Copy(ParamStr(2), 1, 1); Axis := UpCase(S[1]); Val(ParamStr(3), Steps, Code); Val(ParamStr(4), Speed, Code); {Print values to screen to give the user a feedback} WriteLn('Port = "', Lpt, '"'); WriteLn('Axis = "', Axis, '"'); WriteLn('Steps = "', Steps, '"'); WriteLn('Speed = "', Speed, '"'); WriteLn(''); {Fill the A, B, C control bytes. Depending on axis (X, Y, Z or C) and} Case Axis of {direction (- or +) we'll fill A, B and C)} 'X': If Steps < 0 then begin A := 0; B := 1; C := 0; end else begin A := 2; B := 3; C := 0; end; 'Y': If Steps < 0 then begin A := 0; B := 4; C := 0; end else begin A := 8; B := 12; C := 0; end; 'Z': If Steps < 0 then begin A := 0; B := 16; C := 0; end else begin A := 32; B := 48; C := 0; end; 'C': If Steps < 0 then begin A := 0; B := 64; C := 0; end else begin A := 128; B := 192; C := 0; end; end; {Output the steps to the LPT port. The pins of the Lpt port will be set} If Steps <> 0 then begin {accordingly to low / high} If Speed <> 0 then begin Write('Executing ... '); For L := 1 to Abs(Steps) do begin {Loop of steps} Port[Lpt] := A; {Output byte A} For M := 1 to Speed do Inc(Dummy); {Make a little delay} Port[Lpt] := B; {Output byte B} For M := 1 to Speed do Inc(Dummy); {Make a little delay} Port[Lpt] := C; {Output byte C} For M := 1 to Speed do Inc(Dummy); {Make a little delay} end; {The output of A, B and C will move your motor 1 step} WriteLn('Done'); end; end; end else begin WriteLn('error: wrong parameter'); WriteLn('TEST Port Axis Steps Speed'); WriteLn('Read the source file TEST.PAS for more information!'); end; end. { Start TEST.EXE with 4 parameter. TEST Port Axis Steps Speed Port = 888, 956 or 632 (try all three, one will work) Axis = x, y, z or c Steps = the amount of steps you want the motor to execute negative values (e.g. -300) will invert the direction Speed = this value is used in a loop to create a delay the higher the value the slower the motor try 50000 on a Pentium 100 Mhz test and find your own Speed value! Example: test 888 x 200 50000 test 888 x -200 50000 test 888 y -345 50000 In case of problems make sure that operation mode "Normal" is selected for your Lpt port in your PC's BIOS. If "EEP", "ECP" or such is selected this might cause the error. Hint: You might create batch files to make the handling of TEXT.EXE easier. Example: Create file LEFT.BAT and write inside: TEST.EXE 888 X 200 50000 Create file RIGHT.BAT and write inside: TEST.EXE 888 X -200 50000 For easy testing you just need to type left or right on your computer's DOS prompt. This saves you from the burdon to type the long parameter again and again. Of course you might also name your files L.BAT and R.BAT (or what you like) which makes life even easier and l or r will do it. For best performance work under plain old DOS. Visit my homepage if yo need a free copy of FreeDOS. You can get one ready made on a bootable floppy disk. Disk images are available for free download. Come to my message board in case you need support. Search the Internet for "CncPlayer" at any maijor search engine to find me. Good luck, Walter }