HOME(DOCS)		Optical Printer Control System		HOME(DOCS)

NAME
    home - motor homing standalone program

OPTIONS
    -v    # verbose mode for debugging changes
    -d    # debug mode
    -h    # help

USAGE
    home [name-of-procedure] ..

EXAMPLES
    home             # home all axes defined in 'default' procedure
    home a b c       # call procedures 'a', 'b' and 'c'

DESCRIPTION
    home is part of the OPCS system, and is used to home
    motion control axes, shutter motors, set bits, check
    for conditions, etc.

    home has a simple, flexible command language that includes
    logical if() conditions, motor movement commands, and various
    other abilities useful for defining how axes are to initialize
    themselves.

DEFINING HOMING PROCEDURES
    Homing procedures are defined this way:
        
	start name-of-procedure
	{
	    commands..
	}
	end name-of-procedure
        
    ..and can be invoked from the command line via:

        home name-of-procedure

    In the case of setting up homing procedures for channels,
    the procedure names are the name of the axis, ie:
        
        start a
	{
	    print AERIAL HOME
	    ..
	}
	end a
        
    ..so that to home the 'a' axes, one just types the home command line:

        home a

    The homedefs.hom file has two special procedures:
        
        start always
	{
	        # commands that always execute, and are executed *first*;
	}
	end always

	start default
	{
		# Commands to execute if user just typed 
		# 'home' without any command line arguments     
	}
	end default
        
    When you run 'home' without arguments, the 'default' procedure
    in the homedefs.hom file is executed.


COMMANDS Home commands are put into the homedefs.hom file, enclosed in procedures. Here's a list of all the home commands: call [proc] # Call named procedure clrbit [port] [bitmask] # Clear port bit by OR/XORing [bitmask] cswait [centisecs] # Wait so many centiseconds end [label] # Declare the end of a procedure exit [code] # Exit with an error code fail? { commands } # Run { cmds } if gohome/gochange cmd failed go [chan] [dist] [spd] # Send a motor some distance gochange [chan] [maxdist] [spd] # Run until home sensor changes state gohome [chan] [maxdist] [spd] # Home a motor goto [label] # goto a label within proc (label-name:) homeport [chan] [port] [mask] [test] # Define port to test for home condition ishome? [chan] { cmds } # Is a channel at its home position? istrip? [chan] { cmds } # Is a chan's trip switch is tripped? kuperbase [port] # kuper port base [default=0x300] nothome? [chan] { cmds } # Is chan NOT at its home position? notrip? [chan] { cmds } # Is a chan's trip switch NOT tripped? outport [port] [bytevalue] # Write a byte to a port pass? { commands } # Run { cmds } if go/gohome/gochange passed portset? [port] [mask] { cmds } # Check if port bit set portclr? [port] [mask] { cmds } # Check if port bit clear print [string] # Prints a message to the screen printport [port] # Print the value at a port in hex pse # Wait for a keypress from the user reset [chan] [value] # Reset counter for [chan] to [value] setbit [port] [bitmask] # Set port bit by ORing [bitmask] start [label] # Declare the beginning of a procedure (NOTE: lable name 'always' defines a procedure ALWAYS parsed) system [command] # Execute a DOS command tripport [chan] [port] [mask] [test] # Define port to test for trip condition xorbit [port] [bitmask] # Invert port bit by XORing [bitmask] ENVIRONMENT VARIABLES OPCSDEBUG - if set to '1', 'home' will dump the velocity arrays to stdout after the motors have moved. The output can be redirected to a file for better inspection. The 16 bit velocity values printed are 16 bit words of the form: 0 x 0 8 1 0 <-- hex - - - - ___________| | | |___________ | ___| |___ | | | | | 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 <-- binary | | | | | \_______________________/ | | | | | Speed (11 bits) | | | | | | | | | Direction bit | | | | | | | Full Rotation (counter) | | | | | Soft Reverse | | | Allstop check bit | Full Stop (last velocity in array) The lower 12 bits (dir + speed) are sent directly to the Kuper card. The upper 4 bits are interpreted by the 'mdrive' resident driver code. EXAMPLE HOMEDEFS.HOM FILE #################################################################### # HOME PROGRAM'S DEFINITIONS FILE # This file contains commands particular only to the 'home' program. # 'home' is a standalone program that can move the motors, and watch # for changes in the home sensors. #################################################################### # DEFINE PORTS FOR THE USER'S INSTALLATION start always # THESE COMMANDS *ALWAYS* PARSED { ### HOME SENSORS homeport a 0060 7f 1d homeport e 0000 00 00 homeport i 0000 00 00 homeport b 03bd 10 10 homeport f 0000 00 00 homeport j 0000 00 00 homeport c 03bd 20 20 homeport g 0000 00 00 homeport k 0000 00 00 homeport d 03bd 80 80 homeport h 0000 00 00 homeport l 0000 00 00 ### TRIP SWITCHES tripport a 0000 00 00 tripport e 0000 00 01 tripport i 0000 00 01 tripport b 0000 00 01 tripport f 0000 00 01 tripport j 0000 00 01 tripport c 0000 00 01 tripport g 0000 00 01 tripport k 0000 00 01 tripport d 0000 00 01 tripport h 0000 00 01 tripport l 0000 00 01 } end always start b { print -n MAIN: ishome? b { print -n RUNOUT FROM HOME - go b -100 .2 ishome? b { print print *** Cant run out of home position! (are motors off?) exit 1 } cswait 20 } print -n SEEKING HOME - gohome b 200 .2 fail? { print -n SEEK HOME IN REV DIR - go b -300 .2 # (arrive at home from same direction) gohome b 400 .2 fail? { print print *** Cant find home position! (are motors off?) exit 1 } } print DONE. } end b start c { print -n CAMERA: ishome? c { print -n RUNOUT FROM HOME - go c -100 .2 ishome? c { print print *** Cant run out of home position! (are motors off?) exit 1 } cswait 20 } print -n SEEKING HOME - gohome c 200 .2 fail? { print -n SEEK HOME IN REV DIR - go c -300 .2 # (arrive at home from same direction) gohome c 400 .2 fail? { print print *** Cant find home position! (are motors off?) exit 1 } } print DONE. } end c start d { print -n FADER: ishome? d { print -n RUNOUT FROM HOME - go d 3000 .11 ishome? d { print print *** Cant run out of home position! (are motors off?) exit 1 } cswait 20 } print -n SEEKING HOME - gohome d -11450 .11 fail? { print print *** Cant find home position! (are motors off?) exit 1 } cswait 10 go d -1950 .11 print DONE. } end d # USED BY JOG(OPCS) start deenergize { print *** HOMEDEFS.HOM: No 'deenergize' target defined. } end deenergize exit 0 ORIGIN Gregory Ercolano, Topanga, California 05/12/00
© Copyright 1997 Greg Ercolano. All rights reserved.