beautypg.com

6 using the external strobe input – Rockwell Automation 57C411 Resolver Input Module User Manual

Page 28

background image

4Ć10

4000

!

4001

! The following statement enables common clock from this module.

4002

! If there is more than one interrupt task in a chassis, the task

4003

! that enables common clock should always be the lowest priority

4004

! task.

4005

!

4010

CCLK_EN@ = TRUE

\!Common clock enable

5000

!

5001

! Place additional initialization software here

5002

!

6000

!

6001

! The next statement synchronizes the task with the external

6002

! event via the interrupt. Task execution will be suspended

6003

! until the interrupt occurs. If this task is the highest

6004

! priority task waiting to execute at the time of the

6005

! interrupt, it will become active. If it is not the

6006

! highest priority task, it will remain suspended until

6007

! all higher priority tasks have executed, at which point

6008

! it will become active.

6009

!

6010

CALL SCAN_LOOP(TICKS=9, EVENT=RESOLVER_EVENT)

7000

!

7001

! The next statements perform the interrupt service routine

7002

!

7010

CALL PULSE_MULT(INPUT= RESOLVER_IN%, MULTIPLIER=16385, &

OUTPUT= RESOLVER_VALUE%)

10000

END

4.6

Using the External Strobe Input

At the time of the external event, the resolver position is transferred to

register 1, where it will remain until the next event occurs. If your

application software is reading the resolver position at a periodic rate

(register 0), the difference between register 0 and register 1

represents the amount of travel from the time that the event occurred

until the current scan of the application software. A typical application

would be detecting the leading edge of an object moving on a

conveyor.
The data captured by the strobe input will be as accurate as the

external device driving the input. Note that when a strobe input has

occurred, you must reset the input so that another one can occur.

This is accomplished by writing a 1" to bit 12 of register 3.
The following is an example of a control block task that handles the

strobe input from the input module defined in section 4.4.

1000

COMMONRESOLVER_IN%

\!Resolver data

1001

COMMONRESOLVER_IN_EXT%

\!Strobe resolver data

1005

COMMONISCR%

\!Interrupt statusă& control

1010

COMMONCCLK_EN@

\!Common clock enable

1020

COMMONUPDATE_TIME%

\!Resolver conversion time

1030

COMMONSTROBE_STATUS@

\!Strobe status

1040

COMMONSTROBE_ACK@

\!Strobe acknowledge

1200

LOCAL RESOLVER_VALUE%

\!Resolver value

1210

LOCAL STROBE_RESET@

\!Strobe state

1220

LOCAL PERIOD_DISTANCE%

\!Resolver travel scan/scan

1230

LOCAL EVENT_DISTANCE%

\!Resolver travel from event to scan

2000

!

2001

! Define the conversion parameters

2002

!

2010

UPDATE_TIME% = 100

\!Convert every 50 milliseconds

3010

EVENT NAME=RESOLVER_EVENT,INTERRUPT_STATUS=ISCR%, &

ąąTIMEOUT=12

4010

CCLK_EN@ = TRUE

\!Common clock enable

6008

!

6010

CALL SCAN_LOOP( TICKS=9, EVENT=RESOLVER_EVENT)

7000

!

7001

! The next statements catch the occurence

7002

! of the strobe and reset it.

7003

!

7010

CALL TRANSITION ( INPUT= STROBE_STATUS @, &

OUTPUT=STROBE_RESET@)

7020

STROBE_ACK@= NOT STROBE_RESET@