RS V8849 Hoja De Instrucciones página 28

Tabla de contenido

Publicidad

Idiomas disponibles
  • ES

Idiomas disponibles

  • ESPAÑOL, página 12
V8849
This function returns 0 if the arguments were satisfactory,
-1 if the arguments are faulty
Example:
datum()
datum(0,300)
See also:
move(),cmove()
—————————————————————————————————————
halt()
Stop motion smoothly
—————————————————————————————————————
Purpose:
To smoothly halt the motors without losing position.
Syntax:
halt()
halt both motors
halt(axis)
halt specified axis
Remarks:
The rate of deceleration is set by the param() command. After halt()
the motors will not be at the original target position. Their actual
position can be established by the where() command.
This function returns
Example:
halt(1)
// smoothly stop axis #1 motor
See also:
move(), param(), where()
—————————————————————————————————————
in()
Read opto-inputs
—————————————————————————————————————
Purpose:
To read the state of the optocoupler inputs.
Syntax:
in() read all the inputs as number 0->255 in(n) read input #n (0->7)
returns 0 or 1
Remarks:
The two forms allow one to read the inputs as a group or else
individually. The return value 1 means power is applied to the input.
This function returns -1 if the arguments are faulty.
Example:
in(0)
// return state of input #0 (0 or 1)
in()&3
// mask inputs #0 and #1
See also:
out()
—————————————————————————————————————
limit()
Read limit switch status
—————————————————————————————————————
Purpose:
To read the status of the limit switches.
Syntax:
limit()
return 1 if any limit active else 0
limit(axis)
return 1,0,-1 for specified axis according to whether
at positive limit, at no limit, at negative limit.
Remarks:
This command should be used to check that motion was not aborted
because of mechanical limitations. Note that the default condition of
no limit means power is applied to the limit switch inputs. The
onboard limit polarity jumper can be used to reverse this convention.
Normally one would use datum() after detecting a limit as the abrupt
stopping of the motor might have caused a loss of position integrity.
This function returns -2 if the arguments are faulty
Example:
limit(0)
// read state of axis #0 limit switch
See also:
datum(), movel(), cmovel(), where()
—————————————————————————————————————
manual()
Enable manual (mouse) motion
———————————————————————————————
Purpose:
To allow the user to use a mouse, trackerball or hand
encoders to change the position of the motors.
Syntax:
manual()
allow mouse to control both axes
manual(axis)
allow mouse to control specified axis only
Remarks:
The motion of the mouse must be kept slow if the stepper motor has
a coarse resolution as it may stall.
The manual mode is terminated by stop(), halt() or any move()
command.
This function returns -1 if the arguments are faulty and 0 otherwise.
Example:
manual(1)
// now use mouse to move axis #1
See also:
datum(), where(), stop()
—————————————————————————————————————
memfree()
Indicate unused memory
—————————————————————————————————————
Purpose:
To indicate to the programmer how much room is left for further
program entry.
Syntax:
memfree()
returns the number of bytes still free
Remarks:
memory is used by the program listing, by the semicompiled
program, the symbol table and the motion control tables.
Example:
memfree()
// prints how much space is left
—————————————————————————————————————
move()
Move to a position (accelerated)
—————————————————————————————————————
Purpose:
To start an accelerated/decelerated motion move to the specified
position.
Syntax:
move(x,y) move to position x,y where x and y are in units of motor
steps
Remarks:
The move() command does not wait until the command is completed
before returning. This is because one might well want the program to
do something else while the motor is moving (ie: sample the inputs).
If a move() command is issued while the motors are already moving
first the motors will halt and then the
move() command will be executed.
move() will return 0 if there was no error
Example:
move(1000,1000)
—————————————————————————————————————
movel()
Move to limits (with acceleration)
—————————————————————————————————————
Purpose:
To start a move to the limits using accelerated motion
Syntax:
movel(x,y) move to limits specify by sign and value of x and y
ie:
1 move to positive limit
0 do not move
-1 move to negative limit
Remarks:
The movel() command does not wait until the command is completed
before returning. This is because one might well want the program
to do something else while the motor is moving (ie: sample the inputs
or time out).
If a movel() command is issued while the motors are already moving
28
first the motors will halt and then the movel() command will be
// make current position the origin
// make position of axis #0 300
0 if no axis was active
1 if the axis was moving
-1 if the arguments are faulty
1 if a previous move was active
-1 if the arguments are wrong....
(there must be 2).
// move to position 1000,1000
executed.
movel() will return
Example:
movel(-1,-1)
// move to negative limits
See also:
moving(), cmovel(), params(), limit()
—————————————————————————————————————
moving()
Check motion status
—————————————————————————————————————
Purpose:
To determine what is moving.
Syntax:
moving()
returns 1 if either axis is moving (else 0)
moving(axis)
returns 1 if specified axis is moving
Remarks:
This command is NEARLY ALWAYS REQUIRED in conjunction with
the move() or cmove() commands in order to establish when they are
completed.
This function returns -1 if the arguments are wrong
Example:
move(1000,1000)
while (moving()){
}
move(0,0)
See also:
move(), cmove()
—————————————————————————————————————
out()
Set opto-coupled outputs
—————————————————————————————————————
Purpose:
To set the state of the optocoupled outputs.
Syntax:
out()
returns current state of outputs
out(val)
set the outputs as a group to val
out(n,val)
set the state of output #n to val (0 or 1)
Remarks:
The first form treats the 8 outputs as an 8-bit binary number in the
range 0 to 255. The second form sets a specific output n (0->7) on
(1) or off (0).
This function returns -1 if the arguments are wrong
Example:
out(170)
// sets the outputs in a 0101..pattern
out(3,1)
// turns on output 1
See also:
in()
—————————————————————————————————————
param()
Setup motor parameters
—————————————————————————————————————
Purpose:
To set the parameters for accelerated motion of a particular axis.
Syntax:
param(axis,base,top,accel)
param(axis,base,top,accel,decel)
where axis is 0 or 1, base and top are in units of steps per second
and accel and decel are in units of steps per second per second.
Remarks:
The base speed is the speed at which accelerated motion starts and
this should be set as high as possible. It is completely independent
of the speed set by the cvel() command.
The top speed is the top speed of the motor in steps per second.
The first form specifies an acceleration to be used for both
acceleration and deceleration (this saves memory) and the second
form allows for different acceleration and deceleration.
The command prescale() causes all these integer values to be
divided by the prescale value before use. This allows for fractional
step speeds. Typically the prescale value is 1,10,100,1000 or
100000.
This function returns
0 is the arguments are satisfactory
1 if they are incompatible
-1 if they are faulty
Example:
param(0,200,5000,1000,2000)
move(1000,0)
prescale(10)
param(0,2000,50000,10000,20000) // equi alent to above
See also:
prescale()
—————————————————————————————————————
prescale()
Increase range of speeds
—————————————————————————————————————
Purpose:
To allow for fractional step speeds and accelerations.
Syntax:
prescale(n)
Remarks:
Because all variables are integers it is impossible to directly specify
fractional step rates. The solution is to use prescale(). The prescale
value is originally1 but setting it to 100 would cause the the integer
arguments of the cvel() and param() commands to be internally
divided by the prescale value before use.
The prescale value is from 1 to 32767 but would normally be set to
1, 10, 100, 1000 or 10000. This function returns -1 if the argument is
faulty and 0 otherwise.
Example:
prescale(1000)
param(0,100,1000,10000) // equiv to param(0,0.1,1,10)
cvel(100,100)
See also:
param(), cvel()
—————————————————————————————————————
Singleline()
Turns on single line response
—————————————————————————————————————
Purpose:
To facilitate operation of the control board from a basic program.
Syntax:
singleline(1)
make all responses form a single line
singleline(2)
normal response (prompt after return)
Remarks:
Some users may prefer to control the control board from a basic
program using the immediate mode of the control board (no stored
control board program) It is convenient to demand a single line
response to a command issued by a BASIC program
Example:
User input:
singleline(1)^M
move(1000,1000)^M
singleline(0)^M
Where ^M is the carriage return character and ^J is the line feed
character.
0 if there was no error
1 if a previous move was active
-1 if the arguments are wrong
(there must be 2).
// this starts the move
// this waits till it completes
// move back to origin
// no motion yet
// now move
// equiv to cvel(0.1,0.1)
Control board response
0#^M^J
0#^M^J
0^M^J
#

Publicidad

Tabla de contenido
loading

Tabla de contenido