MODEL 2G800 Automated Sample Handler System User's Manual and Technical Reference September 2004 2.4 Brief Description of Computer Commands and System Responses 1. Establishing Communications Before any commands can be sent to the 2G800 System, the system must be put on line. This is accomplished by sending the character string @0, [0=zero] When the system is on line, the "on line" status LED located on the front panel will be on. This command will work if the system address is the factory setting of 0 (zero). Substitute the system address for the 0 if this is changed. Note that all commands are terminated with a comma (,) which is also ASCII character 44. 2. Setting Up Acceleration and Deceleration These commands consist of either an A (Acceleration) or D (Deceleration) followed by a decimal number between 0 and 127. Highest acceleration and deceleration is 0 and lowest is 127. If acceleration or deceleration is set too high, the system may miss steps and accuracy will be degraded. Settings in the 20-50 range are usually employed. Power on default is 5 for acceleration and 10 for deceleration. Examples of acceleration and deceleration commands are: A20, D15, A50, 3. Setting Up Velocity This command consists of an M followed by a decimal number between 50 and 12,000, for example M1200, Do not exceed 12,000 for this parameter or erratic behavior will result. The decimal number issued is 10 times the actual pulse rate to the motor. Since the motor requires 200 pulses (full step) or 400 pulses (half step) per revolution, a speed setting of M10000 sets the motor to revolve at 5 revolutions per second in full step or 2.5 revolutions in half step. This rate is one-half the sample rate rotation due to the pulley ratios. The sample handler is set up at the factory for half stepping. 4. Setting Up the Distance to be Traveled The translation or rotation distance is set up by issuing an N command followed by a decimal number between 1 and 16,777,215. The actual number of pulses supplied to the motor is the decimal number divided by 10. For this reason, only numbers evenly divisible by 10 should be used after the N command. Use of numbers not divisible by 10 will result in sample position creep. Full scale travel on a 53 inch long (travel) system is about 42,000 counts (half stepping). One sample cycle (360°) or rotation is 2000 counts (half stepping). 5. Motor Direction This is set by issuing either of the following commands: +, translation into rock magnetometer or clockwise sample rotation -, translation out of rock magnetometer or counterclockwise sample rotation 6. Axis Selected In the two axis system (translation and rotation), translation mode is selected by issuing the command: O1,0 [O=capital letter O, 0=zero] To select rotation, issue the command: O1,1 [O=capital letter O] The translation or rotation selected LED on the front panel will turn on in accordance with which mode is selected. When the unit is first turned on, the default mode is translation. 7. Home Switch Selected (2G811 System only) To activate home switch 1, send the command: O1,0 [O=capital letter O, 0=zero] To activate home switch 2, send the command: O1,1 [O=capital letter O] 8. Movement Commands Two immediate commands are available: S, start continuous motion using acceleration and velocity parameter Q, Stop motion using deceleration parameter Programmed movements (for a given number of counts specified by the N parameter) are initiated by the G command. Other examples of movement commands are: +G, +S, -G, 9. Verification of Parameters Verification of stored motion parameters can be accomplished by issuing a V command followed by a letter to indicate what variable is to be verified. For example: VP, verify position (internal counter) VN, verify programmed move distance VA, verify acceleration parameter VM, verify velocity parameter When interrogated in this way, the system will respond by sending back ASCII characters for the values requested, followed by a carriage return to terminate the reply. 10. Verification of System Status To determine the system status, issue the following command: %, Upon receiving this command, the system will answer back with a single character (with no line feed or carriage return character following). The returned character denotes the system status as follows: 5 end of move, previous G command complete 7 hard limit stop G motor is currently indexing Other responses are described in the Anaheim Automation manual included in Appendix A of this manual. If a command GF%, is issued, the imbedded F has the effect of inhibiting the return status character until the motor stops indexing. This is a useful option to use when an interrupt is desirable at the end of a programmed move. 11. Sample Flip If the system has sample flip capability, this is initiated by issuing the command O2,2, [O=capital letter O] Return the sample to the unflipped position with the command O2,0, [O=capital letter O, 0=zero] 12. Seek Home Command The system is equipped with both rotation and translation home sensors. These sensors allow the system to start from a known position at initial power on. The command format is: H1, Note that the direction is set at + when the carriage is on the rock magnetometer side of the translation home sensor, the carriage will never encounter the sensor; interruption of the right limit switch will stop the motion in this case. 3. FACTORY SWITCH SETTINGS The Sample Handler is set up at the factory as follows: 1. 1200 Baud data rate 2. Half stepping mode 3. Address 0 These can be reconfigured is desired. To change the mode between 1/2 step (400 steps/rev) and full step (200 steps/rev), remove the top cover on the translation and rotation driver consoles and change the position of the slide switch mounted on the printed circuit board. Select 1/2 step mode by moving slide switch to position nearest the edge of the printed circuit board. To change the system address, remove the controller console top cover. The system baud rate is determined by the position of the switches on dip switch SP1 near the edge of the printed circuit board. Switch positions 6, 7 and 8, select baud rate as follows: Baud 6 7 8 300 off off on 1200 on off on 9600 off on on The system address is determined by the setting of switch positions 1 through 5. Switch position 1 is the least significant bit and position 5 is the most significant bit. The system address is binary coded. ________________________________________________________________________________ Anaheim Automation Commands Command Format Commands are made up of one or two letters or a letter and one, two, or three numbers. All letters are upper case 8-bit ASCII characters with the most significant bit set to zero. All numbers are decimal ASCII sent most significant digit first followed by a nondecimal character. Spaces have no effect on the command format. The character that terminates a number will be used as the next command. For this reason a comma, carriage return, or line feed are accepted as null commands, not changing anything and not giving a command error. Command Summary A zz Acceleration is a number from 0 to 127. This controls the rate at which the motor will move from a slow speed to a faster speed. The higher the value the slower the motor accelerates. The power on default is 5. The formula for relating the acceleration to the parameter is as follows: Accel (steps/sec^2) = 1,050,422 / A (parameter) The formula for determining the time during acceleration is: Time = (Max speed - Base speed) / Acceleration The formula used to approximate the number of steps during acceleration is as follows: No. of Steps = (1,050,422 * (Time^2)) / (Accel parameter) + (Base speed) * time B dddd Base rate is the speed at which the motor motion starts and stops. This value is given in pulses per second and has a range of 50 to 5000. The initial value is 1000. A verify of this register will return the actual speed as calculated by dividing the crystal frequency bv four and then by the value selected as the base speed. CH n Hold time is a value from 0 to 127 representing the number of clock ticks to leave power on the motor after a move. This command causes the POWER pin to be pulled low within a specified number of ticks after a move of the motor is completed and it will stay low until just prior to the start of the next move command. This command allows the holding torque of the motor to be turned off automatically after a delay for the mechanical system stabilize thus reducing power consumption and allowing the motor to be turned by hand if this feature is required. If the value is zero then the power is left on forever. The default value is zero. CS zz Save the internal stored program and state in the external EEPROM so that it will not be lost on system power down. The state consists of the maximum speed, acceleration, deceleration, the crystal frequency, and a starting address given by zz. If zz is a valid address for the internal program (0-119) then the program will automatically start executing on power up or reset. Otherwise it is necessary to use the Run (R) command. CR Restore the program and state trom the external EEPROM. This command sets the program counter but does not auto-start the program. It is used primarily when the contents of the internal program have been altered in the process of reprogramming and you wish to return to the original program and/or parameters. CX rrrrrr Set the crystal frequency to the value of rrrrrr. The range of values is 4,000,000 to 8,000.000. This command does not check for out of range numbers. The crystal frequency is used by the chip for setting the base speed and maximum speed and for controlling the time for the wait command. D zz Deceleration is a number from 0 to 127. This controls the rate at which the motor will move from a fast speed to a slower speed. The higher the value the slower the motor decelerates. The deceleration is linear and the slope is determined by the deceleration parameter. The equations for time, distance, and rate are of the same form as those for acceleration. The power on default is 10. E zz Enter an internal program starting at location zz. Program entry is terminated by a carriage return. This command is covered in greater detail in the programming section. F Wait for the for the motor to be idle and the wait timer to be zero before accepting any further inputs. The F command is used in the direct mode only. If the controller is executing an internally stored program it will ignore all commands except a period (.) anyway. Without the F command the SMC25 will continue to accept commands while the motor is moving. This may be desirable, as when changing speed during a move or working with the inputs or outputs. Or it may be undesirable, such as when you wish to make a series of indexes. Without the F command any subsequent G commands received while the motor is indexing would set the "Not allowed while moving" message. Caution: If this command is used while the motor is executing a Slew command the only way to stop is with a reset or a hard limit switch input. G Start the motor indexing as defined by the P or N command. H i This command starts the motor looking for a home position in the direction last given by a +, -, or P command. It is not necessary to use a G command as motion will start immediately. If i equals zero then the motor will move at high speed until detecting a soft limit switch and then decelerate to the base speed and continue until detecting the home limit switch. If i equals one then the motor moves at high speed until the home limit switch is detected and then decelerates to the base speed, reverses direction and continues until the home limit switch is not detected. If the home limit switch is not detected at the time that the motor reverses direction it is assumed to have completely passed the home limit switch and the motor will search for the switch to be detected again before looking for the not detected state. In this mode, the home limit switch should not be connected to a multiplexer for detecting direction since the SMC25 must detect the same switch in both cSrections. When the home position is reached the position counter is set to zero. I xx, yy, zz If the input pins, as defined by the mask value xx (0-255), are equal to the value of yy (0-255), then go to program location zz (0-119). This command is only valid when used in the internal program. The first value entered (xx) specifies the binary weighted decimal value of the inputs pins to be tested. The second value entered (yy) is the binary weighted decimal pattern that these selected inputs are to match. If the data and selected pins match then the next command executed will be at the program location specified by zz (0-119). If there is no match then the next instruction is the one immediately following the IF command. J zz Set slow jog speed. The value of zz (0-255) is used as a divisor of the base speed. The default value is 20. K Unused. L yy, zz Loop back yy times to location zz. This command permits a sequence of commands to be repeated a specified number of times. The loop command is only used in the internal stored program mode. The first number entered specifies the number of times to loop and the second number specifies the program instruction to loop to. If yy is equal to zero then the loop is endless. When the specified number of loop backs have occurred then the program will continue with the next command. No nesting of loops is allowed. M dddd Set the maximum speed of the motor. The range is 50 to 20,000 when the crystal frequency is 8 megahertz. The upper limit is proportionately lower for lower crystal frequencies. The default value on power up is 10,000 pulses per second. If the distance of a move is enough to accelerate and decelerate through the full speed range specified then the remainder of the move will be made at this Max rate until deceleration is required at the end of the move. If the distance is not large enough, then the controller will only accelerate until it is time to decelerate back to the base speed, resulting in a triangular speed- distance profile. N rrrrrr Set the number of steps to move for the G command. The range is 0 to 16,777,215. The default value is zero. O zz, xx Output the value xx to the general purpose output pins selected by the mask zz. The first number entered, zz (0-255), is the binary weighted decimal value of the output pins to be modified by the binary weighted decimal value of the second number entered, xx (0-255). See the section on inputs and outputs for additional detail. P rrrrrr Set the direction and distance to achieve a move to absolute position rrrrrr. The range of values is 0 to 16,777,215. A G command is required to effect the move. The default value is zero. Q This command stops execution of the internal program if it is used in the program. If the motor is indexing it will ramp down and then stop. Use this command to stop the motor after issuing a slew command. R zz Start execution of the internal program at location zz (0-119), By specifying the entry point to the internal program more than one program may be stored internally at the same time. This command is also used as an unconditional branch in the internal program. S Slew the motor up to maximum speed and continue until reaching a hard limit switch or receiving a quit (Q) command. T Trace one step of the internal stored program. Each time the T command is entered one command is executed from the internal stored program. The VR command can be used to read the address of the command that will be executed next. U xx, yy, zz Until the input pins represented by the mask xx equal the value yy branch to location zz. This command is only valid in the internal program. Refer to the IF command for a more detailed description of the parameter format. V c Verify the contents of the register specified by the letter following the the V command. The data is sent as an ASCII decimal string followed by a carriage return and a line feed. If a Verily Enter command (VE) is sent the SMC25 returns the entire internal stored program. Each numeric parameter is followed by a carriage return and line feed. Illegal commands, such as might be found in the unused part of memory, will return the underline (_) character so that the host program can keep track of where everything is in memory. The verified program will be terminated by a period (.). The following is a list of the registers that can be verified. A Acceleration B Base speed D Deceleration E Internal program G Steps remaining in current move. Zero if not indexing. H Hold time I Input pins J Slow jog speed M Maximum speed N Number of steps to index O Output pins P Position. If motor is indexing this returns the position at the end of the index. R Internal program pointer used by trace (T) or continue (X) commands. Also updated by enter (E) command. W Ticks remaining on wait counter X Crystal frequency W zz Wait for zz (0-255) ticks before continuing if in internal program mode, otherwise just send a message when time is up. X Continue internal program from current position. Y Unused. Z rrrrrr Set the position register. This command sets the internal absolute position counter to the value of rrrrrr. As with other commands, if the parameter is not entered a zero is the default value. @c..c, Upon receipt of the @ command all axes are deselected. For each character in the list, if the character matches the address of this device then it is selected and the "Selected" output will be set low. If it does not match then the "Selected" output will be set high but the internal selection state of the device will not be changed. This is to allow external three state drivers to prevent bus contention when selecting multiple devices simultaneously. Only the most recently selected device will send data to the host. The list of characters is terminated by a comma. If just a "@," is sent then all axes are deselected. The valid address characters are 0-9 and A-V. These correspond to addresses 0-9 and 10-31. + Set the motor direction of movement to positive. - Set the motor direction of movement to negative. % Poll the device for any waiting messages such as errors or end of move. The responses are defined in the following table. # Description 0 Normal, no service required 1 Command error, illegal command sent 2 Range error, an out of range numeric parameter was sent 3 Command invalid while moving (e.g. G, S, H) 4 Command only valid in program (e.g. I, U, L) 5 End of move notice, a previous G command is complete 6 End of wait notice, a previous W command is complete 7 Hard limit stop, the move was stopped by the hard limit 8 End of program notice, internal program has completed G Motor is indexing and no other notice pending ? This command returns two numbers. The first number is the part identifier which is always 25 for the SMC25. The second number is the revision number. . (period) If a period is received the motor will stop, the timer will be cleared, and if the internal program is executing it will stop. It is possible for this command to stop execution of the internal program in the middle of an instruction causing the parameter for that instruction to be read incorrectly. For this reason the period command is only intended as a debugging tool. Programming The ability of the SMC25 to run completely from an internal program is most important in small systems where the expense of a host computer or high level controller is not practical. When used in conjunction with the external EEPROM the internal program feature allows the user to easily develop a custom stand alone step motor controller. In larger systems the internal stored program can be used to implement high level macros to reduce the communications overhead tor the host processor. When the program is stored internally the numbers are converted to binary to save space and then compressed to the specific number of bytes needed to represent the number entered. This allows the maximum amount of internal program but makes computing branch locations more difficult as well as determining program size prior to entry. To aid the user the table on the next page is provided to show the number of bytes of memory used by each instruction for the various ranges of values each can have. Any command not listed in the table is not available in the internal program mode. Program Memory Usage Command/Code <256 256-65535 >=64K Accel A 2 - - Base spd B 2 3 - Decel D 2 - - Go G 1 - - Home H 1 - - If I 4 - - Jog rate J 2 - - Loop L 3 - - Max spd M 2 3 - Number N 2 3 4 Output O 3 - - Position P 2 3 4 Quit Q 1 - - Jump R 2 - - Until U 4 - - Wait W 2 - - Zero* Z 2 3 4 Forward + 1 - - Reverse - 1 - - * If parameter is zero then only one byte