Ts - time stamp, Command details, Example – Applied Motion RS-232 User Manual

Page 211

Advertising
background image

211

920-0002 Rev. I

2/2013

Host Command Reference

TS - Time Stamp

Compatibility: Q drives only
Affects:

Data Register “W”

See also:

RC, WD, All register commands

Transfers the oldest Time Stamp value from the time stamp buffer into the “W” data register. The time stamp value
is a time value in milliseconds, recorded between two input triggers when using the RC command. Each time a
defined input condition is “True” (triggered), the elapsed time from the previous input is stored in the time stamp
buffer. The time stamp buffer is 8 words deep and acts as a FIFO buffer. The “I” data register, used by the RC
command, records when an input trigger has occurred. Sending the RC command clears the time stamp buffer.
Executing the TS command removes the oldest time value from the time stamp buffer and places it in the “W”
Data Register where it can be used. With each execution of the TS command a time value is transferred, until the
end of the time stamp buffer is reached. If a TS is sent with no time values in the time stamp buffer a “0” is placed
in the “W” data register.

Command Details:

Structure

TS

Type

BUFFERED

Usage

WRITE ONLY

Non-Volatile

NO

Register Access

“W” (039)

Units

milliseconds

Example:

This sample Q program illustrates the interaction of the RC and TS commands. After initialization, the program
waits for a falling edge event on input X3, at which point a 5 second timer begins counting down. During this
delay, the user may trigger X3 an arbitrary number of times. After 5 seconds, the motor will execute a series
of 5000-step moves, with the delay between each corresponding to the delay between switch closures on X3.
That is, if the user trips X3 four times waiting 1 second between each event, the motor will execute four 5000-
step moves with a 1 second dwell between each.

MT

1

Multi-tasking ON

EG

20000

20,000 steps/rev

AC

250

DE

250

VE

5

FI

3

200

Filter input 3 for 200 processor ticks

RX

I

0

Zero the “I” register

RC

X3F

Setup the “I” register for input X3

WI

X3F

Wait for input X3

WT

5.00

Wait 5 seconds >>> trigger inpuxt X3 a few times

TS

Throw away first time stamp

LABEL2 RD

I

Decrement “I” register

FL

5000

Feed 5000 steps

TR

I

1

Test “I” against 1

QJ

L

#LABEL1

Jump to end if “I” less than 1

TS

Time stamp

RM

W

1

Move “W” into “1”

WD

1

Delay for “1” milliseconds

QG

#LABEL2

Go to Label 2

LABEL1 NO

Stop program

Advertising
This manual is related to the following products: