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

4Ć7
Each application program, or task, that wishes to reference the
symbolic names assigned to the input module may do so by
declaring those names COMMON.
The frequency with which tasks read their inputs and write their
outputs depends on the language being used. Control block tasks
read inputs once at the beginning of each scan and write outputs
once at the end of scan. BASIC tasks read an input and write an
output for each reference throughout the scan.
The following is an example of a configuration task for the input
module:
1000
!
1001
! resolver input
1002
!
1005
IODEF RESOLVER_IN%[SLOT=4, REGISTER=0]
1006
IODEF RESOLVER_IN_EXT%[SLOT=4, REGISTER=1]
1010
!
1011
! common clock enable
1012
!
1015
IODEF CCLK_EN@[SLOT=4, REGISTER=3, BIT=6]
1020
!
1021
! A/D update period
1022
!
1025
IODEF UPDATE_TIME%[SLOT=4, REGISTER=4]
1050
!
1051
! Place any additional configurationăstatements here
1052
!
2000
END
4.4.1
BASIC Task Example
This example will read the resolver input once every second and
store the value in the symbol CURRENT_VALUE". The resolver
position will be sampled every 100 milliseconds.
1000
COMMON RESOLVER_IN%
\!Resolver data(periodic)
1010
COMMON CCLK_EN@
\!common clock enable
1020
COMMON UPDATE_TIME%
\!Update period for resolver conversion
1400
!
1500
LOCAL CURRENT_VALUE%
\!Current value of analog input
1900
!
2000
UPDATE_TIME% = 200
\!0.1 second conversion
2010
CCLK_EN@ = TRUE
\!turn on the clock
4000
!
4001
! Place any additional initialization software here
4002
!
5000
START EVERY 1 SECONDS
5010
CURRENT_VALUE% = RESOLVER_IN%
10000
END
The symbolic names defined as COMMON" reference the inputs
defined in the sample configuration task above. The symbolic name
CURRENT_VALUE% is local to the BASIC task and does not have I/O
associated with it. Refer to the DCS 5000 Enhanced BASIC
Language Instruction Manual (JĆ3600) for more information.
4.4.2
Control Block Task Example
The following example will read the resolver data every 55
milliseconds and store the inverted value in the symbol READING".
The resolver's shaft position will be sampled every 500
microseconds.
1000
COMMON RESOLVER_IN%
\!Resolver data (periodic)
1010
COMMON CCLK_EN@
\!Common clock enable
1020
COMMON UPDATE_TIME%
\!Update period forĂresolver conv.
1400
!
1500
LOCAL READING%
\!Current negative value of input
1600
!