beautypg.com

1 basic task example, 2 control block task example – Rockwell Automation 57C411 Resolver Input Module User Manual

Page 27

background image

4Ć9

4.5.1

BASIC Task Example

The following is an example of a BASIC task that handles interrupts

from the input module defined in section 4.4.

1000

COMMONRESOLVER_IN%

\!Resolver data

1005

COMMONISCR%

\!Interrupt status & control

1010

COMMONCCLK_EN@

\!Common clock enable

1020

COMMONUPDATE_TIME%

\!Resolver conversion time

1200

LOCAL RESOLVER_VALUE%

\!Resolver value

2000

!

2001

! Define the conversion parameters

2002

!

2010

UPDATE_TIME% = 1000

\!Convert every .5 seconds

3000

!

3001

! The following statement connects the name RESOLVER_EVENT to the

3002

! interrupt defined in ISCR%. The event name chosen should

3003

! be as meaningful as possible. The watchdog timeout has

3004

! been set to 120 clock ticks (660 msec). If the time between

3005

! interrupts exceeds this value, a severe error will be declared

3006

! and the system will be stopped. For more information refer to the

3007

! DCS 5000 Enhanced BASIC Language Instruction Manual (JĆ3600).

3008

!

3010

EVENT NAME=RESOLVER_EVENT,

3011

ăăINTERRUPT_STATUS=ISCR%,TIMEOUT=120

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

WAIT ONRESOLVER_EVENT

7000

!

7001

! The next statements perform the interrupt service routine

7002

!

7010

RESOLVER_VALUE% = RESOLVER_IN%

10000

END

4.5.2

Control Block Task Example

The following is an example of a control block task that handles

interrupts from the input module defined in section 4.4.

1000

COMMONRESOLVER_IN%

\!Resolver data

1005

COMMONISCR%

\!Interrupt status & control

1010

COMMONCCLK_EN@

\!Common clock enable

1020

COMMONUPDATE_TIME%

\!Resolver conversion time

1200

LOCAL RESOLVER_VALUE%

\!Resolver value

2000

!

2001

! Define the conversion parameters

2002

!

2010

UPDATE_TIME% = 100

\!Convert every 50 milliĆseconds

3000

!

3001

! The following statement connects the name RESOLVER_EVENT to

3002

! the interrupt defined in ISCR%. The event name chosen should

3003

! be as meaningful as possible. The watchdog timeout has

3004

! been set to 12 clock ticks (66 msec). If the time between

3005

! interrupts exceeds this value, a severe error will be declared

3006

! and the system will be stopped. For more information refer to the

3007

! DCS 5000 Enhanced BASIC Language Instruction Manual (JĆ3600).

3008

!

3010

EVENT NAME=RESOLVER_EVENT, &

3011

ăăINTERRUPT_STATUS=ISCR%, TIMEOUT=12