beautypg.com

Timer applications, Encoder applications, Encoder connections – Sensoray 425 User Manual

Page 12: Pin name function

background image

Sensoray Model 425 Instruction Manual

Page 10

Counter Interrupts

Counter channels may be programmed to generate interrupt
service requests in response to captured events. A channel
asserts it’s interrupt request when two conditions are
simultaneously met: the Capture flag is set, and the channel
interrupt is enabled. The Control port is used to enable and
disable counter interrupts:

When servicing an interrupt request from the 425 board,
examine the Status port to determine which device (or
devices) requires service:

Timer Applications

A timer is often used to generate an interrupt request
upon expiration of a time interval. Such applications
will typically follow this sequence of events:

Preload an initial value into the counter. The initial value

equals the number of 3MHz cycles that will occur
during the desired time interval. For example, the value
3,000,000 will produce a 1 second interval.

Enable the counter interrupt and arm the event capture.

Timer rollover occurs, setting the Capture flag and

generating an interrupt request.

Host responds to the interrupt request by executing an

interrupt handler. By reading the Status register, the host
determines that the counter is requesting service. The
host disables the interrupt and disarms event capture,
then performs the appropriate application functions.

Encoder Applications

Encoders are frequently used in motion control systems
to track absolute position. In a typical system, each
control axis employs a limit switch in conjunction with

encoder index to recognize the axis reference position.
The motor seeks the reference position by “backing
up” until the limit switch activates.

A typical encoder application, with interrupts, follows
this sequence of events to seek a reference position:

“Reverse” motor until the limit switch activates, then stop

the motor. The limit switch could be easily connected to
a relay channel for interrupt-driven edge detection.

Arm the counter channel event capture and enable the

counter channel interrupt.

Start the motor in the “forward” direction.

Encoder index activates, simultaneously zeroing the

counter, setting the Capture flag, and generating an
interrupt request.

The host responds to the interrupt request by executing an

interrupt handler. By reading the Status register, the host
determines that the counter is requesting service. The
host disables the interrupt and disarms event capture,
then performs the appropriate application functions.

Encoder Connections

Connector J1 is used to make all electrical connections
to external encoders or other pulse sources:

Control Port (base + 16, write only) : Set Interrupt Enables

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

V

0

0

0

0

0

1

0

0

0

A1

A0

0

0

0

0

V=1 to enable interrupt,
V=0 to disable interrupt.
A

1

and A

0

specify which counter

channel is to be enabled/disabled:

A

1

A

0

Encoder

00

Channel 0

01

Channel 1

10

Channel 2

11

Not Valid

Status Port (base + 22, read only) : Determine IRQ Source

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

x

x

x

x

RQR RQ2 RQ1 RQ0

x

x

x

x

x

x

x

x

Bit

Service Requestor

RQR

Relay Channel(s)

RQ2

Counter Channel 2

RQ1

Counter Channel 1

RQ0

Counter Channel 0

Pin

Name

Function

1

-A

0

Channel 0 phase A input (-)

2

+A

0

Channel 0 phase A input (+)

3

GND

GND

4

-B

0

Channel 0 phase B input (-)

5

+B

0

Channel 0 phase B input (+)

6

+5V

+5V

7

-X

0

Channel 0 index input (-)

8

+X

0

Channel 0 index input (+)

9

GND

GND

10

-A

1

Channel 1 phase A input (-)

11

+A

1

Channel 1 phase A input (+)

12

+5V

+5V

13

-B

1

Channel 1 phase B input (-)

14

+B

1

Channel 1 phase B input (+)

15

GND

GND

16

-X

1

Channel 1 index input (-)

17

+X

1

Channel 1 index input (+)

18

+5v

+5v

19

-A

2

Channel 2 phase A input (-)

20

+A

2

Channel 2 phase A input (+)

21

GND

GND

22

-B

2

Channel 2 phase B input (-)

23

+B

2

Channel 2 phase B input (+)

24

+5V

+5V

25

-X

2

Channel 2 index input (-)

26

+X

2

Channel 2 index input (+)