EMERSON PACSystems VersaMax MICRO PLC & NANO PLC. USER MANUAL (2019) - page 25

 

  Index      Manuals     EMERSON PACSystems VersaMax MICRO PLC & NANO PLC. USER MANUAL (2019)

 

Search            copyright infringement  

 

   

 

   

 

Content      ..     23      24      25      26     ..

 

 

 

EMERSON PACSystems VersaMax MICRO PLC & NANO PLC. USER MANUAL (2019) - page 25

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

354 

Changing the Load Correction Time 

The Load Correction time can be changed within the range 0 to 200µS by sending the new 
value in a COMMREQ, as explained later in this chapter.  

An example is illustrated below. 

In the diagram, T0 is the OFF Time, which is  

where  

f is the pulse frequency.

,  

T2 = Optical Isolator Delay,  

and T1+T2 = ON Time. 

Figure 198 

 

18.7

 

Pulse Train Outputs 

Pulse Train Outputs can be used to control stepper motors. 

18.7.1

 

Configuring a Pulse Train Output 

Configuring a channel as a Pulse Train Output is done by setting the Channel Function to 
Pulse Train in the PLC configuration. 

18.7.2

 

Program References for Pulse Train Outputs 

The following program references are assigned for use by Pulse Train Outputs.  

 

Channel  1 

Channel 2 

Channel  3  Channel 4 

Pulse Train Complete  

I0494 

I0495 

I0496 

I0511 

Enable Output  

Q0505 

Q0506 

Q0507 

Q0508 

Start Pulse Train 

Q0494 

Q0495 

Q0496 

Q0511 

Frequency:16 Bit Mode 
32 Bit Mode 

AQ123 

AQ125 

AQ127 

AQ121 

AQ120 

AQ123 

AQ126 

AQ117 

Number of Pulses: 16 bit mode 
32 Bit Mode 

AQ124 

AQ126 

AQ128 

AQ122 

AQ 121-122 

AQ124-125 

AQ127-128  AQ 118-119 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

355 

18.7.3

 

Enabling and Disabling Pulse Train Operation 

Pulse  Train  operation  starts  when  the  channel’s  Enable  Output  bit  is  set  to  1  and  the 
channel’s Start Pulse Train bit transitions from 0 to 1. This automatically clears the Pulse 

Train Complete bit to 0. Pulse Train operation continues until the specified number of pulses 
have occurred. A Pulse Train Output can be stopped before the requested number of pulses 
has been completed by setting its Enable Output bit to 0. If the Enable Output bit transitions 
from  1  to  0,  the  Pulse  Train  stops  immediately.  When  the  last  pulse  is  completed,  the 

channel’s Pulse Train Complete bit goes to 1.

 

A Pulse Train Output continues to operate when the Micro PLC goes from Run mode to Stop 
mode. If a Pulse Train Output is running  when power is lost, it will restart after power is 
restored when the PLC transitions with Run mode if both the Enable Output bit and the Start 
Pulse Train output bits are set to 1. 

18.7.4

 

Setting Up the Pulse Frequency 

The application program sets up the frequency of a Pulse Train Output by writing a value to 

the channel’s Frequency reference. The frequency range is 15Hz to 65kHz for Micro 20

-/40-

/64- PLCs, and 15Hz to 5kHz for other models).  

The sum total of frequency configured for all Pulse Train Outputs on a Micro PLC should be 
less  than  or  equal  to  65kHz  (this  frequency  is  available  for  a  Micro-20/40/64  only).  The 
minimum frequency that can be configured on each channel is 15Hz. For example: If all the 
channels are to be configured for Pulse Train with Ramp for maximum possible frequency, 
the frequencies on each channel can be 15kHz, 15kHz, 15kHz, and 20kHz. 

The frequency of a Pulse Train Output can be changed while the Pulse Train is operating. 
One  application  of  this  feature  would  be  to  ramp  up  at  the  beginning  of  the  Pulse  Train 
operation, and ramp down at the end. For a Micro-20, -40, -64 PLC, Pulse Ramping can also 
be done by configuring the channel for Pulse Train with Ramp. 

The actual frequency output can have a tolerance of 1%. 

If the maximum count speed is more than 30 kHz for a Type B Counter, or more than 60 kHz 
for Type A, resistance must be added to the encoder input as shown in the example below: 

Figure 199 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

356 

18.7.5

 

Setting Up the Number of Pulses 

The application program sets up the number of pulses to be output (0 to 65535) by writing 

the value to the channel’s Number of Pulses reference.  

 

18.7.6

 

Load Correction Time 

Pulse Train Outputs have a nominal duty cycle of 50%, but the PLC optical isolators can skew 
the duty cycle, depending on temperature and load.  To compensate for this, the PLC applies 
an additional load correction time to the zero-output time of each pulse. The default load 
correction time depends on the Micro PLC type. The default times are: 2µS for 20-/40-/64-
point Micro PLCs with DC outputs, 35µS for other Micro PLCs with DC outputs, 10µS for 20-
/40-/64-point Micro PLCs with relay outputs, or 85µS for other Micro PLCs with relay outputs 

Changing the Load Correction Time 

The Load Correction time can be changed within the range 0 to 200µS by sending the new 
value in a COMMREQ, as explained later in this chapter. 

An example is illustrated below.   

In the diagram, T0 is the OFF Time, which is  

where 

f is the pulse frequency.

T2 = Optical Isolator Delay, and  

T1+T2 = ON Time. 

Figure 200 

 

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

357 

18.8

 

Pulse Train with Ramp 

The  Pulse  Train  with  Ramp  feature  of  Micro-20,  -40,  and  -64  PLCs  combines  the  basic 
operation of a Pulse Train Output with configurable acceleration and deceleration times to 
produce Pulse-Train profile like the example shown below. 

Figure 201 

 

18.8.1

 

Configuring Pulse Train with Ramp 

An output can be set up as a Pulse Train with Ramp by selecting 4 Type A or 1 Type A / 1 Type 
B as the Counter Type and selecting Pulse Train with Ramp as the Channel Function.  

A Pulse Train with Ramp has configurable acceleration and deceleration rates. The default 
for both is 1,000,000 (the maximum). Both acceleration and deceleration can be selected 
during configuration from the range of 90 to 1,000,000. Acceleration and deceleration do 
not need to be the same. Appropriate values depend on the application and the capability 
of the stepper motor being driven by the module. Acceleration and Deceleration can also 
be temporarily changed from the application program. 

18.8.2

 

Program References for Pulse Train with Ramp Outputs 

The following program references are used by Pulse Train with Ramp Outputs (Can only be 
configured in 4TypeA/1TypeA 1TypeB configuration). 

 

Output 1 

Output 2 

Output 3 

Output 4 

Pulse Train Complete  

I0494 

I0495 

I0496 

I0511 

 

 

 

 

 

Start Pulse Train 

Q0494 

Q0495 

Q0496 

Q0511 

Enable Output  

Q0505 

Q0506 

Q0507 

Q0508 

Frequency      

AQ123 

AQ125 

AQ127 

AQ121 

Number of pulses  

AQ124 

AQ126 

AQ128 

AQ122 

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

358 

18.8.3

 

Setting Up the Pulse Frequency for Pulse Train with 
Ramp 

The application program sets up the frequency of a Pulse Train with Ramp by writing a value 

to the channel’s Frequency reference. The frequency range is 15Hz to 65kHz. 

 

The sum total of frequency configured for Pulse Train with Ramp channels should be less 
than or equal to 65kHz. The minimum frequency that can be configured on each channel is 
15Hz. For example: If all the channels are to be configured for Pulse Train with Ramp for 
maximum  possible  frequency,  the  frequencies  on  each  channel  can  be  15kHz,  15kHz, 
15kHz, and 20kHz. 

The frequency, acceleration, deceleration, and number of counts of a Pulse Train with Ramp 
cannot be changed when the ramp output has started. If the frequency is changed in the 
%AQ references after the ramp output has started, the new frequency is used for the next 
ramp that is generated.  

The actual frequency output can have a tolerance of 1%. 

18.8.4

 

Setting Up the Number of Pulses 

The application program sets up the number of pulses to be output (0 to 65535) by writing 
the value to the cha

nnel’s Number of Pulses reference. 

 

18.8.5

 

Changing the Acceleration and Deceleration 

Acceleration  and  deceleration  are  set  up  in  the  channel  configuration.  The  configured 
acceleration and deceleration can also be temporarily changed in the rage of 90 to 1,000,00 
using  a  COMMREQ  in  the  application  program,  as  explained  later  in  this  chapter. 
Acceleration and deceleration cannot be changed while the function is operating. 

18.8.6

 

Controlling Operation of a Pulse Train with Ramp Output 

A Pulse Train with Ramp starts when th

e channel’s Enable Output bit is 1 and the channel’s 

Start Pulse Train bit transitions from 0 to 1.  

When the Pulse Train begins, the channel’s Pulse Train Complete bit is set to 0.  The channel 

outputs the specified number of pulses in varying pulse widths, to produce a velocity profile 

similar to the one shown below.  After the last pulse is completed, the channel’s Pulse Train 

Complete bit is set to 1. 

After a Pulse Train with Ramp function has started, it continues until either all of its pulses 
have been generated or its Output Enable bit changes from1 to 0.  

The  ramp  up  or  ramp  down  motion  occurs  in  steps  of  100ms;  so  the  velocity  gradient 
changes every 100ms until the desired frequency is reached (provided there is a sufficient 
number of pulses to ramp up to the desired frequency). 

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

359 

Figure 202 

 

For the example above, the ramp up time is 500ms (1/2 second), so the ramp up takes place 
in 5 steps: 100ms, 200ms, 300ms, 400ms, 500ms with frequencies of 1kHz, 2kHz, 3kHz, 
4kHz, and 5kHz respectively. 

The application program can stop a Pulse Train with Ramp before the requested number of 
pulses has been completed by setting its Enable Output bit to 0. When the Enable Output 
bit transitions from 1 to 0, the output starts decelerating.  The channel outputs a number of 
pulses based on: (1) the configured deceleration and (2) the velocity at the time the Enable 

Output bit goes Off.  When the last pulse is completed, the channel’s Pulse Train Complete 

bit is set to 1. 

Stop Ramp with Deceleration 

If the Enable Bit set to 0 during the “at velocity” part of the Pulse Train, the output ramps 

down  normally  as  shown  at  left  below.    If  the  Enable  Bit  is  set  0  during  the  acceleration 
phase,  ramping  up  stops  and  ramping  down  begins  immediately  as  shown  at  right.  The 
deceleration occurs at the configured or commanded rate. 

Figure 203 

 

If the Ramp output is already decelerating (because the number of pulses has been 
reached) when the Enable Output bit transitions from 1 to 0, the Pulse Train output 
continues decelerating at the same rate. 

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

360 

Stop Ramping Immediately 

When the Micro PLC powers up or receives a new configuration, it automatically sets up all 
Ramp channels to decelerate when the Output Enable bit goes to 0. 

If a Pulse Train with Ramp output should stop immediately, a COMMREQ can be used, as 
described later in this chapter. 

18.9

 

COMMREQs for the HSC/PWM/PTO Functions 

The  application  program  can  use  the  COMMREQ  function  to  provide  data  or  send  the 
following commands to High-Speed Counters, Pulse Train outputs, or PWM outputs that are 
currently enabled: 

 

Load Accumulator 

 

Load High and Low Limits 

 

Load Accumulator Increment 

 

Set Counter Direction 

 

Load Timebase 

 

Load ON and Off Presets 

 

Load Preload 

 

Load Stop Mode or Resume Decelerate Mode (for Micro-20, -40, -64 CPUs only) 

 

Load Acceleration and Load Deceleration (for Micro-20, -40, -64 CPUs only) 

 

Load Correction 

Program logic should be set up to assure that the command is sent to the module once, not 
repeatedly.  These  changes  are  temporary;  they  lost  when  the  PLC  is  powered  down  and 
when a new configuration is stored from the programmer. 

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

361 

18.9.1

 

The COMMREQ Command Block 

The  command  data  must  be  placed  in  the  correct  order  (in  a  command  block)  in  CPU 
memory before the command is executed. The command block is composed of 14 words 
as shown below. All values are hexadecimal unless otherwise indicated. The command block 
can be placed in any word-oriented area of memory that is not reserved (see Chapter 22: fo
a list of reserved areas). 

Offset 

Data 

Description  

address 

0004 

Always 0004 

address +1 

don’t care

 

Not used (always  zero). The  Micro PLC  ignores  the  Wait flag for all 
COMMREQ junctions. 

address +2 

don’t care

 

not used 

address +3 

don’t care

 

not used 

address +4 

don’t care

 

not used 

address +5 

don’t care

 

not used 

address +6 

don’t care

 

not used 

address +7 

don’t care

 

not used 

address +8 

0008 

Data type (8 = registers) 

address +9 

000A 

Start location of Command Word 

1 (%R0011) 

address +10 

nnnn 

Command Word (see next page) 

address +11 

nnnn 

LS Data Word 

address +12 

nnnn 

MS  Data  Word  used  only  for  ramping  in  4  Type  A  32-bit  or  
One Type A, One Type B 32-bit mode in Micro 20-/40-/64-CPU.  
Not used by other Micro PLCs 

Contents of the Command 

The last three words of the Command contain the command parameters. These words are 
treated as independent bytes. They can be entered in hexadecimal or decimal format. The 
format for the last three words is: 

Figure 204 

 

The Command Word, located at “address +10” of the command, identifies the 

action to be 

performed. The MSB of the command word specifies the channel number (1 

 4 for Type 

A, always 1 for Type B).

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

362 

Example: 

To set Counter 1 to 1234H, load command registers with: 

Command word:  

0101 

LS data word:  

1234 

MS data word:  

Example: 

To set Counter 1 to 200,000 (30D40H) in 32-bit mode, load command 
registers with: 

Command word:  

0101 

LS data word:  

0D40 

MS data word:  

0003 

Negative values must be entered in 32-

bit two’s complement format.

 

Example: 

To set the Load Preload to a value of 

1000 decimal,  

enter the hex value FFFF FC18 for command word 01nF. 

Command 
Word (hex) 

Command  Description 

0n01 

Load 
Accumulator 

Loads  any  value  within  a  counter’s  limits  directly  into  the 

Accumulator. If a count is received at the same time, the count is lost.  

0n02 

Load High 
Limit 

Sets the High and Low limit to any value in the counter range. Move 
the Low Limit first when shifting down or the High Limit first when 
shifting up. Loading limits in the wrong order can cause an error. The 
command is successful if all parameters are within the new range. 

0n03 

Load Low 
Limit 

0n04 

Load 
Accumulator 
Increment 

Offsets a counter Accumulator by up to +127 or 

128 counts. Only 

the LSB data is used with this command. This can be done at any time, 
even while the counter is counting at maximum rate. However, if a 
count is received at the same time the CPU updates the Accumulator 
value, the count is lost. If the offset causes the counter to exceed its 
limits, this parameter is rejected. 

0n05 

Set Counter 
Direction 

(Type A only) Changes the count direction. Only the LSB of the first 
data word is used for this command (00 = up, 01 = down).   

0n06 

Load 
Timebase 

Changes the time interval used for the counts/timebase word data.  
The range is 10 to 1000mS in 10mS intervals.  

0n0B 

Load ON 
Preset 

Sets up the output turn on points within the counter range. There is 
one  output  associated  with  each  counter.    See  the  previous 
information about Presets for appropriate settings.  

0n15 

Load OFF 
Preset 

Sets up the output turn off points within the counter range. There is 
one  output  associated  with  each  counter.  See  the  previous 
information about Presets for appropriate settings. 

0n1F 

Load 
Preload 

Changes the count value loaded into the counter Accumulator when 
the Preload input is activated.  

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

363 

Command 
Word (hex) 

Command  Description 

0n3B 

Load Stop 
Mode (or 
Resume 
Decelerate 
Mode) 

(Micro-

20/40/64  CPU  only)  Changes  a  Pulse  Train  output’s 

deceleration to stop the Ramp immediately when the Output Enable 
bit goes Off. The Ramp function must be enabled.  
The same command can be used to reset the output to Decelerate 
mode (the default) by entering the value 0001 in the LS data word.   

0n3C 

Load 
Acceleration 

(Micro-

20/40/64  CPU  only)  Changes  a  Pulse  Train  output’s 

acceleration. The Pulse Train with Ramp function must be enabled. 
For channels 1 

 3, acceleration and deceleration can be selected 

from  the  range  of 10  p/s2  to 1,000,000  p/s2.    For  channel  4,  the 
range  is  90 p/s2  to  1,000,000  p/s2  .    The  default  for  both  is 
1,000,000. 
In the acceleration and deceleration commands, the data value is a 
32-bit  number.  These  are  the  ONLY  Data  Commands  that  should 
have any value other than 0 in the MS data word.  
Example: to change the acceleration rate of Pulse Train output 1 to 
200,000 

(30D40H), 

load: 

 

Command 

word: 

013C 

 

LS 

data 

word: 

 

0D40 

 

MS data word: 0003 

0n3D 

Load 
Deceleration 

(Micro-

20/40/64  CPU  only)  Changes  a  Pulse  Train  output’s 

deceleration.  The  Ramp  function  must  be  enabled.    See  Load 
Acceleration above for details. 

0n3E 

Load 
Correction 

Sets the change (in µS) that should be applied to the duty cycle of a 
Pulse Train output to compensate for the slow turn-off time of the 
optical isolator circuit (35µS 

 DC outputs; 85µS relay outputs). The 

range is 0 to 200µS. 

Note:   

1.

 

If a Load Accumulator command is executed with the ON Preset value, the Preset will be turned on 
for that instance only. 

2.

 

If a Load Accumulator command is executed with the OFF Preset value, the Preset will be turned 
off for that instance only. 

 

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

364 

18.9.2

 

COMMREQ Example 

The example uses a COMMREQ to load the value 1234 into the Accumulator for Counter 3. 

Figure 205 

 

The first rung in the example includes a one-shot coil (%T0002) that executes the COMMREQ 
once. This prevents multiple messages from being sent. 

The next rung uses a Block Move Word function to load the  commands. In this example, 
%R0101 through %R0114 are used for the COMMREQ Command Block. Any registers can be 
used. 

The COMMREQ function has four inputs and one output. 

Parameter 

Description 

enable 

%T0002 to enables the COMMREQ function. 

IN 

Points to the starting address of the Command Block, which is %R0101. 

SYSID 

Indicates which rack and slot to send the message to (physical location of HSC 
module). The SYSID is always 0004 for the Micro PLC. 

TASK 

This parameter is ignored and should be set to zero. 

FT 

This output is energized if an error is detected during processing of the 
COMMREQ. 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

365 

Command Word Error Responses 

If the module receives an invalid command parameter in a Command Word, it returns an 
error code in the first word of its word input (AI) data. The following error codes are used for 
High-Speed Counter COMMREQs:  

Note: 

If the program issues a COMMREQ that changes count direction, the counter will go immediately 
into the new mode. Remember that the output does not change states at exactly the same points 
on an Up-counter as it does on a Down-counter. 

Error Code 

Description 

Definition 

Decimal 

Hex 

Invalid Command 

Command number received was invalid for 
the HSC.  

Invalid Counter Number or 
Channel 

Counter  number  in  the  Data  Command 
Word was not a valid counter based on the 
current configuration.  

11 

0b 

Counter/Channel 1 Limit Error   Invalid Low or High limit value 

New limit places Preload value out of range 
New limit places Off Preset out of range 
New limit places Accumulator value out of 
range 
Accumulator value is out of range 
Preload value is out of range 
On Preset value is out of range 
Off Preset value is out of range 

12 

0c 

Counter/Channel 2 Limit Error  

13 

0d 

Counter/Channel 3 Limit Error  

14 

0e 

Counter/Channel 4 Limit Error  

19 

13 

Load Stop Mode/Reset 
Decelerate Mode 

Invalid  value.  Must  be  1  (decelerate)  or  2 
(stop). 

20 

14 

Load Acceleration 

Acceleration  too  low.  Must  be  >  10  for 
channels 1-3 and >90 for channel 4.  

21 

15 

Load Acceleration 

Acceleration 

too 

high. 

Must 

be 

< 1,000,000  

22 

16 

Load Deceleration 

Deceleration  too  low.  Must  be  >  10.  for 
channel 1-3 and >90 for channel 4.  

23 

17 

Load Deceleration 

Deceleration 

too 

high. 

Must 

be 

< 1,000,000  

 

 

 

User Manual 

Chapter 18 

GFK-1645M 

Dec 2019 

 

High-Speed Counter, PWM, and Pulse Train Operation 

366 

18.10

 

HSC Application Examples 

18.10.1

 

RPM Indicator 

The HSC can be used as a position/motion indicator when connected to a feedback device 
(such as an encoder) that is coupled to a rotary motion. RPM indication can be obtained 

directly from the counter’s Counts/Timebase register (CTB) or derived from it by a simple 

calculation. 

The RPM calculation is:  

 

where: 

CTB =  

counts/timebase reading from the counter  

PPR =  

pulses/revolution produced by the feedback device  

T =  

timebase expressed in minutes 

If the number of pulses per revolution is an integer power of 10, setting the timebase for 6, 
60,  600,  6000,  or  60,000  produces  a  direct  reading  of  RPM  in  the  Counts  per  Timebase 
register with an assumed decimal placement.  

Example 

If  feedback  produces  1000  pulses/revolution,  CTB  reading  =  5210,  and  the  timebase  is 
configured for 60ms, which gives: 

T = 60/60000 = .0001 and 1/T = 1000. 

The Counts per Timebase reading equals 521 and 

 

CTB reading is RPM with 1 RPM resolution.  

Input Capture 

The High-Speed Counter strobe inputs can act as pulse catch inputs for inputs 2, 4, 6, and 8 
by using the Strobe Status bits as a latch. 

To use this feature: 

1.

 

Configure a Type A Counter on any channel. 

2.

 

Set the Preload//Strobe parameter to “Strobe”.

 

The corresponding Strobe Status bit will be latched if there is a pulse of at least 100 µsec in 
width. The Reset Strobe bits can be used as clear functions for the latched status bits. 

 

User Manual 

Chapter 19 

GFK-1645M 

Dec 2019 

 

Motion Control Functions 

367 

Chapter 19:

 

Motion Control Functions 

Micro-20,  Micro-40  and  Micro-64  PLCs  (release  3.6  or  later)  can  perform  basic  Motion 
Control  functions  of  Jogging,  Homing,  Blended  Move,  and  Stop  Motion.  This  chapter 
describes the use of motion control functions. 

 

Overview 

 

Program References for Motion Features 

 

Position Registers 

 

Function Block Instance Registers 

 

Error Codes for Motion Features 

 

Finding a Home Position 

 

Find Home Function Block 

 

Stopping Find Home 

 

Example Program Logic for Find Home 

 

Moving to the Home Position 

Go Home Function Block 

Stopping Go Home 

Example Program Logic for Go Home 

 

Jogging 

 

Jogging Function Block 

 

Stopping Jogging 

 

Example Program Logic for Jogging 

 

Blending 

 

Blending Function Block 

 

Stopping Blending 

 

Example Program Logic for Blending 

 

Examples of Blended Moves 

 

Stopping Motion on an Axis 

 

Stop Motion Function Block 

 

Example Program Logic for Stop Motion 

 

 

 

User Manual 

Chapter 19 

GFK-1645M 

Dec 2019 

 

Motion Control Functions 

368 

19.1

 

Overview 

The  High-Speed  Counter  outputs  of  a  Micro-20,  Micro-40.  or  Micro-64  PLC  can  be 
independently configured for motion support. Use of these features requires PAC Machine 
Edition version 5.5, SP2, SIM 6 or later. 

The channel’s configured HSC/PWM/PTO setting mu

st be either 4 Type A_32, or 1 Type A / 

1  Type  B_32.  The 

channel’s  Counter  Function  must  be  configured  as  Motion  Support. 

Configuration is described in Chapter 16:. 

Function  blocks  can  be  used  in  the  application  program  to  set  up  and  control  motion 
operations. The same function blocks supply additional parameters for the operation.  

19.1.1

 

Program References for Motion Features 

 

Output 1 

Output 2 

Output 3 

Output 4 

Position Register (REAL) 

AI006-007 

AI010-011 

AI020-021 

AI024-025 

Mode Select Bit (BOOL) 

Q497 

Q498 

Q499 

Q500 

Rotary Mode High Limit Register 
(DWORD) 

AQ117-118  AQ121-122  AQ125-126 

AQ113-114 

Rotary Mode Low Limit Register (REAL)  AQ119-120  AQ123-124  AQ127-128 

AQ115-116 

Motion Enable (BOOL) 

Q505 

Q506 

Q507 

Q508 

Axis error register (WORD) 

AI002 

AI003 

AI004 

AI005 

Axis error reset bits (BOOL)  

Q489 

Q490 

Q491 

Q492 

19.1.2

 

Position Registers 

The  Micro  PLC  stores  the  cumulative  motor  position  in  the 

channel’s  Position  Register, 

where it can be read from the application program. The capacity of the Position Register is 
a 32-bit real value. When used for motion support, the 32-bit Position Registers are used as 
shown in the table above. 

All  commanded  moves  increment  or  decrement  the  value  in  the  Position  Register,  so  it 
reflects the actual motor position. For example, the Position Register is set at 0.  A 10,000-
count move is commanded in the forward direction.  At the end of this move, the Position 
Register contains the value 10,000.  Now a 2,000-count move is commanded in the reverse 
direction.  At the end of this move, the Position Register contains the value 8,000 (10,000

2,000).  

The Position Register is automatically cleared: at power-up, when a new configuration is 
downloaded, when PLC memory is cleared, when the configuration is cleared, and when the 
CPU  transitions  from  STOP  to  RUN  mode.  It  is  set  to  zero  after  a  successful  Find  Home 
operation. When the Position Register is cleared, the cleared value appears in the reference 
memory window only when the PLC is put into RUN mode. 

 

 

 

User Manual 

Chapter 19 

GFK-1645M 

Dec 2019 

 

Motion Control Functions 

369 

Operating Modes of the Position Registers 

The position register can function in either Rotary mode or Linear Mode. 

Rotary Mode Operation of the Position Registers 

In Rotary mode, the Position Register wraps when the configured high limit or low limit is 
reached and continues incrementing or decrementing based on the direction of operation. 
Rotary mode is selected by setting output bit %Q497, Q498, Q499, or Q500 to 1, for channel 
1, 2, 3, or 4, respectively. The high limit and the low limits for Rotary mode can be set up 
using the references shown on the previous page. 

Position Register transitions for both clockwise and counterclockwise motions always start 
at the configured low limit. For example, if the low limit = -100.0 and the high limit = +100.0, 
a movement of 5 units in the clockwise direction sets the Position Register value to 

95.0, 

and a movement of 5 units in the counter-clockwise direction sets the position register value 
to +96. 

If  the  configured  High  Limit  is  less  than  the  Low  Limit,  the  error  is  displayed  in 
%AI0001/2/3/4 memory for each of the channels and the High Limit defaults to the Low 
Limit +1. 

Linear Mode Operation of the Position Registers 

In Linear mode, any configured Rotary limits are not used. The Position Registers increment 
or decrement from zero after power-up, and on every Stop to Run transition. At other times, 
the Position Registers increment or decrement from the last move position.  

Output bits %Q0497-Q0500 can be used to provide inputs for this mode for each of the four 
channels respectively. A value of 0 selects Linear mode and 1 selects Rotary mode. 

Limits of the Position Register value in Linear mode are +3.4e38 and 

3.4e38. If either limit 

is reached, the value stops changing. 

19.1.3

 

Function Block Instance Registers 

Figure 206 

 

 

 

 

 

 

 

 

Content      ..     23      24      25      26     ..