Call the stt subroutine – Rockwell Automation 1770,D17706.5.21 SMART TRANSMITTER TOOLKI User Manual
Page 24

Chapter 3
Using The Smart Transmitter Toolkit
3-5
Insert a JSR on an unconditional rung to call the STT subroutine.
The JSR instruction includes one program file number and one input
parameter. There are no return parameters.
The program file number is the program file number where you installed
the STT subroutine. For example, if you installed the STT subroutine
into program file number 5, the JSR must call program file number 5.
The input parameter is the integer file number for the current HART
field device. For example, if you created N10 and F11 for your HART
field device, the input parameter would be 10.
When the STT routine is called by your ladder logic, it generates the
specified HART command from the data that you provided in the integer
and floating-point data files.
After generating a properly formatted HART command, the STT
subroutine executes a BTW followed by a BTR to execute the command
just generated. It then reformats the returned data and places the outputs in
the locations specific to that HART command. See appendix A for more
detail on the command-specific outputs.
Because of the nature of enabling and finishing BTWs and BTRs, it takes
three calls minimum to the STT subroutine to obtain the outputs from the
HART command. This is a description of the steps that occur in each of
the three passes through the STT subroutine.
1st Pass
•
sets the enter/exit bit to 1
•
sets the trigger bit to 0
•
sets the enable bit to 1
•
generates the HART command
specified in integer word 5
•
initiates a BTW
•
sets the enter/exit bit to 0 and returns
2nd Pass
•
sets the enter/exit bit to 1
•
finishes the BTW
•
initiates a BTR
•
sets the enter/exit bit to 0 and returns
3rd Pass
•
sets the enter/exit bit to 1
•
finishes the BTR
•
produces outputs
•
sets the done or error bit to 1
•
sets the enable bit to 0
•
sets the enter/exit bit to 0 and returns
Example
In this example, the JSR calls the STT subroutine unconditionally. The
STT subroutine looks for input data in files N10 and F11. However, since
this example is using HART command 0, there is no input data in the
floating-point file.
JUMP TO SUBROUTINE
Prog file number
5
Input par
10
Return par
JSR
4. Call The STT Subroutine