Download 5300-5600_BASIC_Reference_en-US_RevA

Transcript
2 Using StepperBASIC Functions
In this chapter
This chapter provides an in-depth description of how to perform
certain actions using StepperBASIC. These include the following:
• Scan functions
• Homing routines
• Overtravel limits
• POSITION check function
• Position verification and correction function
• Stall detection function
• Using the WHEN statement
• Electronic gearing
• Making the motor move
• Registration functionality
2.1 Scan Functions
Introduction
The purpose of the SCAN functions is to allow you to specify an
action to be taken when a given discrete input condition is
satisfied. The specified input condition is tested every millisecond
and the specified action is performed immediately as soon as the
condition is satisfied.
Similar functionality can be performed by an IF...THEN
statement in your Pacific Scientific StepperBASIC program.
However, using a SCAN function has two key advantages:
1. The SCAN response will be much faster than the
IF...THEN response because the SCAN condition is tested
every millisecond and the SCAN action is performed as soon
as the condition is satisfied.
2. When the SCAN function is used, there is no need to have a
program loop that regularly tests the specified condition.
Once the SCAN function is set up and turned on, the SCAN
condition will be automatically tested every millisecond until
the SCAN function is turned OFF.
Rev F
StepperBASIC Reference Manual
2 - 1