- Computers & electronics
- Computer components
- Interface components
- Digital & analog I/O modules
- User manual
advertisement
IEC 61131-3 C Tools Function Specifications
hartCommand0
Read Unique Identifier
Syntax
#include <ctools.h>
BOOLEAN hartCommand0(unsigned module, unsigned address,
HART_DEVICE * const device);
Description
This function reads the unique identifier of a HART device using command 0 with a short-form address. This is a link initialization function.
The function has three parameters: the module-number of the 5904 module (0 to
3); the short-form address of the HART device (0 to 15); and a pointer to a
HART_DEVICE structure. The information read by command 0 is written into the
HART_DEVICE structure when the response is received by the 5904 HART interface module.
The function returns TRUE if the command was sent. The function returns
FALSE if the module number is invalid, or if the device address is invalid.
Notes
The function returns immediately after the command is sent. The calling program needs to wait for the response to be received. Use the hartStatus command to read the status of the command.
The number of attempts and the number of preambles sent are set with the hartSetConfiguration command.
A program needs to initialize the link before executing any other commands.
See Also
hartCommand11, hartStatus, hartSetConfiguration
Document (Version 2.50) 5/12/2011 220 220
IEC 61131-3 C Tools Function Specifications
hartCommand1
Read Primary Variable
Syntax
#include <ctools.h>
BOOLEAN hartCommand1(unsigned module, HART_DEVICE * const device,
HART_VARIABLE * primaryVariable);
Description
This function reads the primary variable of a HART device using command 1.
The function has three parameters: the module-number of the 5904 module (0 to
3); the device to be read; and a pointer to the primary variable. The variable pointed to by primaryVariable is updated when the response is received by the
5904 HART interface module.
The primaryVariable needs to be a static modular or global variable. A primaryVariable should be declared for each HART I/O module in use. A local variable or dynamically allocated variable may not be used because a late command response received after the variable is freed will write data over the freed variable space.
The function returns TRUE if the command was sent. The function returns
FALSE if the module number is invalid.
Notes
The HART_DEVICE structure needs to be initialized using hartCommand0 or hartCommand11.
The function returns immediately after the command is sent. The calling program needs to wait for the response to be received. Use the hartStatus command to read the status of the command.
The number of attempts and the number of preambles sent are set with the hartSetConfiguration command.
The code field of the HART_VARIABLE structure not changed. Command 1 does not return a variable code.
See Also
hartCommand2, hartStatus, hartSetConfiguration
Document (Version 2.50) 5/12/2011 221 221
IEC 61131-3 C Tools Function Specifications
hartCommand2
Read Primary Variable Current and Percent of Range
Syntax
#include <ctools.h>
BOOLEAN hartCommand2(unsigned module, HART_DEVICE * const device,
HART_VARIABLE * pvCurrent, HART_VARIABLE * pvPercent);
Description
This function reads the primary variable (PV), as current and percent of range, of a HART device using command 2.
The function has four parameters: the module-number of the 5904 module (0 to
3); the device to be read; a pointer to the PV current variable; and a pointer to the
PV percent variable. The pvCurrent and pvPercent variables are updated when the response is received by the 5904 HART interface.
The pvCurrent and pvPercent variables needs to be static modular or global variables. A pvCurrent and pvPercent variable should be declared for each
HART I/O module in use. A local variable or dynamically allocated variable may not be used because a late command response received after the variable is freed will write data over the freed variable space
The function returns TRUE if the command was sent. The function returns
FALSE if the module number is invalid.
Notes
The HART_DEVICE structure needs to be initialized using hartCommand0 or hartCommand11.
The function returns immediately after the command is sent. The calling program needs to wait for the response to be received. Use the hartStatus command to read the status of the command.
The number of attempts and the number of preambles sent are set with the hartSetConfiguration command.
The code field of both HART_VARIABLE structures is not changed. The response from the HART device to command 2 does not include variable codes.
The units field of the pvCurrent variable is set to 39 (units = mA). The units field of the pvPercent variable is set to 57 (units = percent). The response from the
HART device to command 2 does not include units.
See Also
hartCommand1, hartStatus, hartSetConfiguration
Document (Version 2.50) 5/12/2011 222 222
IEC 61131-3 C Tools Function Specifications
hartCommand3
Read Primary Variable Current and Dynamic Variables
Syntax
#include <ctools.h>
BOOLEAN hartCommand3(unsigned module, HART_DEVICE * const device,
HART_VARIABLE * variables);
Description
This function reads dynamic variables and primary variable current from a HART device using command 3.
The function has three parameters: the module number of the 5904 module (0 to
3); the device to be read; and a pointer to an array of five HART_VARIABLE structures.
The variables array needs to be static modular or global variables. An array of variables should be declared for each HART I/O module in use. A local variable or dynamically allocated variable may not be used because a late command response received after the variable is freed will write data over the freed variable space.
The variables array is updated when the response is received by the 5904 interface as follows.
Variable Contains
variables[0] primary variable current variables[1] primary variable variables[2] secondary variable variables[3] tertiary variable variables[4] fourth variable
The function returns TRUE if the command was sent. The function returns
FALSE if the module number is invalid.
Notes
The HART_DEVICE structure needs to be initialized using hartCommand0 or hartCommand11.
The function returns immediately after the command is sent. The calling program needs to wait for the response to be received. Use the hartStatus command to read the status of the command.
The number of attempts and the number of preambles sent are set with the hartSetConfiguration command.
Not all devices return primary, secondary, tertiary and fourth variables. If the device does not support a variable, zero is written into the value and units code for that variable.
Document (Version 2.50) 5/12/2011 223 223
IEC 61131-3 C Tools Function Specifications
The code field of both HART_VARIABLE structures is not changed. The response from the HART device to command 3 does not include variable codes.
The units field of variable[0] is set to 39 (units = mA). The response from the
HART device to command 3 does not include units.
See Also
hartCommand33, hartStatus, hartSetConfiguration
Document (Version 2.50) 5/12/2011 224 224
IEC 61131-3 C Tools Function Specifications
hartCommand11
Read Unique Identifier Associated with Tag
Syntax
#include <ctools.h>
BOOLEAN hartCommand11(unsigned module, char * deviceTag,
HART_DEVICE * device);
Description
This function reads the unique identifier of a HART device using command 11.
This is a link initialization function.
The function has three parameters: the module number of the 5904 module (0 to
3); a pointer to a null terminated string containing the tag of the HART device; and a pointer to a HART_DEVICE structure. The information read by command
11 is written into the HART_DEVICE structure when the response is received by the 5904 interface.
The function returns TRUE if the command was sent. The function returns
FALSE if the module number is invalid.
Notes
The function returns immediately after the command is sent. The calling program needs to wait for the response to be received. Use the hartStatus command to read the status of the command.
The number of attempts and the number of preambles sent are set with the hartSetConfiguration command.
A program needs to initialize the link before executing any other commands.
See Also
hartCommand0, hartStatus, hartSetConfiguration
Document (Version 2.50) 5/12/2011 225 225
IEC 61131-3 C Tools Function Specifications
hartCommand33
Read Transmitter Variables
Syntax
#include <ctools.h>
BOOLEAN hartCommand33(unsigned module, HART_DEVICE * const device, unsigned variableCode[4], HART_VARIABLE * variables);
Description
This function reads selected variables from a HART device using command 33.
The function has four parameters: the module number of the 5904 module (0 to
3); the device to be read; an array of codes; and a pointer to an array of four
HART_VARIABLE structures.
The variables array needs to be static modular or global variables. An array of variables should be declared for each HART I/O module in use. A local variable or dynamically allocated variable may not be used because a late command response received after the variable is freed will write data over the freed variable space.
The variableCode array specifies which variables are to be read from the transmitter. Consult the documentation for the transmitter for valid values.
The variables array is updated when the response is received by the 5904 interface as follows.
Variable Contains
variables[0] transmitter variable, code and units specified by variableCode[0] variables[1] transmitter variable, code and units specified by variableCode[1] variables[2] transmitter variable, code and units specified by variableCode[2] variables[3] transmitter variable, code and units specified by variableCode[3]
The function returns TRUE if the command was sent. The function returns
FALSE if the module number is invalid.
Notes
The HART_DEVICE structure needs to be initialized using hartCommand0 or hartCommand11.
The pointer variables needs to point to an array with at least four elements.
Document (Version 2.50) 5/12/2011 226 226
IEC 61131-3 C Tools Function Specifications
The function returns immediately after the command is sent. The calling program needs to wait for the response to be received. Use the hartStatus command to read the status of the command.
The number of attempts and the number of preambles sent are set with the hartSetConfiguration command.
The function requests four variables and expects four variables in the response.
See Also
hartCommand3, hartStatus, hartSetConfiguration
Document (Version 2.50) 5/12/2011 227 227
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 12 Safety Information
- 15 About The Book
- 15 At a Glance
- 16 IEC 61131-3 C Tools Overview
- 17 Supported Language Features
- 20 Getting Started
- 20 System Requirements
- 21 Program Development Tutorial
- 25 C Program Development
- 25 Program Architecture
- 29 Compiling Source Code
- 30 Linking Object Files
- 33 Controller Initialization
- 33 Loading Programs into RAM
- 34 Executing Programs
- 35 Real Time Operating System
- 35 Task Management
- 37 Resource Management
- 38 Inter-task Communication
- 39 Event Notification
- 40 Error Reporting
- 41 SCADAPack Task Architecture
- 42 RTOS Example Application Program
- 50 Overview of Programming Functions
- 50 Controller Operation
- 56 Controller I/O Hardware
- 67 Serial Communication
- 74 Communication Protocols
- 78 Modbus Database
- 80 Modbus Addressing
- 82 DNP Communication Protocol
- 85 IEC 61131-3 Variable Access Functions
- 85 HART Communication
- 87 IEC 61131-3 C Tools Function Specifications
- 88 alarmIn
- 90 allocate_envelope
- 91 check_error
- 92 checksum
- 93 checkSFTranslationTable
- 94 clear_errors
- 95 clear_protocol_status
- 96 clearSFTranslationTable
- 97 clearStatusBit
- 98 clear_tx
- 99 configurationRegisterMapping
- 100 configurationSetApplicationID
- 104 crc_reverse
- 105 createRoutingTable
- 106 create_task
- 109 databaseRead
- 111 databaseWrite
- 113 datalogCreate
- 116 datalogDelete
- 118 datalogPurge
- 120 datalogReadNext
- 122 datalogReadStart
- 124 datalogRecordSize
- 125 datalogSettings
- 126 datalogWrite
- 127 dbase
- 129 deallocate_envelope
- 130 dnpInstallConnectionHandler
- 135 dnpClearEventLog
- 136 dnpConnectionEvent
- 137 dnpCreateRoutingTable
- 138 dnpGenerateEventLog
- 139 dnpGetAI16Config
- 140 dnpGetAI32Config
- 141 dnpGetAISFConfig
- 142 dnpGetAO16Config
- 143 dnpGetAO32Config
- 144 dnpGetAOSFConfig
- 145 dnpGetBIConfig
- 146 dnpGetBIConfigEx
- 147 dnpGetBOConfig
- 148 dnpGetCI16Config
- 149 dnpGetCI32Config
- 150 dnpGetConfiguration
- 154 dnpGetConfigurationEx
- 155 dnpGetRuntimeStatus
- 156 dnpGetUnsolicitedBackoffTime
- 157 dnpReadRoutingTableDialStrings
- 158 dnpReadRoutingTableEntry
- 159 dnpReadRoutingTableSize
- 160 dnpSaveAI16Config
- 161 dnpSaveAI32Config
- 162 dnpSaveAISFConfig
- 163 dnpSaveAO16Config
- 164 dnpSaveAO32Config
- 165 dnpSaveAOSFConfig
- 166 dnpSaveBIConfig
- 167 dnpSaveBIConfigEx
- 168 dnpSaveBOConfig
- 169 dnpSaveCI16Config
- 170 dnpSaveCI32Config
- 171 dnpSaveConfiguration
- 173 dnpSaveConfigurationEx
- 174 dnpSaveUnsolicitedBackoffTime
- 175 dnpSendUnsolicited
- 181 dnpSendUnsolicitedResponse
- 182 dnpWriteRoutingTableEntry
- 183 dnpWriteRoutingTableDialStrings
- 184 end_application
- 185 end_task
- 186 endTimedEvent
- 187 enronInstallCommandHandler
- 191 forceLed
- 192 getABConfiguration
- 193 getBootType
- 194 getclock
- 195 getClockAlarm
- 196 getClockTime
- 197 getControllerID
- 198 getIOErrorIndication
- 199 getPortCharacteristics
- 200 getPowerMode
- 201 get_port
- 202 getProgramStatus
- 204 get_protocol
- 205 getProtocolSettings
- 207 getProtocolSettingsEx
- 209 get_protocol_status
- 210 getSFTranslation
- 211 get_status
- 212 getStatusBit
- 213 getTaskInfo
- 215 getVersion
- 216 getWakeSource
- 217 hartIO
- 218 hartCommand
- 220 hartCommand
- 228 hartStatus
- 230 hartGetConfiguration
- 231 hartSetConfiguration
- 232 hartPackString
- 233 hartUnpackString
- 234 install_handler
- 236 installClockHandler
- 238 installDbaseHandler
- 240 installSetdbaseHandler
- 242 Dbase Handler Function
- 246 Setdbase Handler Function
- 247 installExitHandler
- 248 installModbusHandler
- 249 Handler Function
- 254 installRTCHandler
- 255 RTCHandler Function
- 256 interruptCounter
- 257 interruptInput
- 258 interrupt_signal_event
- 259 interval
- 260 ioBusReadByte
- 261 ioBusReadLastByte
- 262 ioBusReadMessage
- 264 ioBusSelectForRead
- 265 ioBusSelectForWrite
- 266 ioBusStart
- 267 ioBusStop
- 268 ioBusWriteByte
- 269 ioBusWriteMessage
- 271 ioClear
- 272 ioDatabaseReset
- 274 ioRefresh
- 275 ioReset
- 276 isaRead16Din
- 277 isaRead32Din
- 278 isaRead4Ain
- 279 isaRead4Counter
- 280 isaRead4202Inputs
- 282 isaRead4202DSInputs
- 284 isaRead5505Inputs
- 287 isaRead5506Inputs
- 289 isaRead5601Inputs
- 291 isaRead5602Inputs
- 293 isaRead5604Inputs
- 295 isaRead5606Inputs
- 297 isaRead8Ain
- 298 isaRead8Din
- 299 isaReadLPInputs
- 301 isaReadSP100Inputs
- 303 isaWrite16Dout
- 304 isaWrite2Aout
- 305 isaWrite32Dout
- 306 isaWrite4Aout
- 307 isaWrite4AoutChecksum
- 309 isaWrite4202Outputs
- 310 isaWrite4202OutputsEx
- 312 isaWrite4202DSOutputs
- 313 isaWrite5303Aout
- 314 isaWrite5505Outputs
- 316 isaWrite5506Outputs
- 318 isaWrite5601Outputs
- 319 isaWrite5602Outputs
- 320 isaWrite5604Outputs
- 322 isaWrite5606Outputs
- 325 isaWrite8Dout
- 326 isaWriteAout
- 328 isaWriteLPOutputs
- 330 isaWriteSP100Outputs
- 331 ledGetDefault
- 332 ledPower
- 333 ledPowerSwitch
- 334 ledSetDefault
- 336 master_message
- 342 modbusExceptionStatus
- 343 modbusSlaveID
- 344 modbusProcessCommand Function
- 346 modemAbort
- 347 modemAbortAll
- 349 modemDial
- 351 modemDialEnd
- 352 modemDialStatus
- 353 modemInit
- 355 modemInitEnd
- 356 modemInitStatus
- 357 modemNotification
- 358 optionSwitch
- 359 pidExecute
- 361 pidInitialize
- 362 pollABSlave
- 363 poll_event
- 364 poll_message
- 365 poll_resource
- 366 portConfiguration
- 367 portIndex
- 368 portStream
- 369 processModbusCommand
- 371 queue_mode
- 372 readBoolVariable
- 374 readCounter
- 375 readCounterInput
- 376 readBattery
- 377 readInternalAD
- 378 readIntVariable
- 380 readMsgVariable
- 382 readRealVariable
- 384 readRoutingTableEntry
- 385 readRoutingTableSize
- 386 readStopwatch
- 387 readThermistor
- 388 readTimerVariable
- 390 read_timer_info
- 391 receive_message
- 392 release_processor
- 393 release_resource
- 394 report_error
- 395 request_resource
- 396 resetAllABSlaves
- 397 resetClockAlarm
- 398 route
- 399 runLed
- 401 searchRoutingTable
- 402 send_message
- 404 setABConfiguration
- 405 setBootType
- 406 setclock
- 407 setClockAlarm
- 409 setdbase
- 411 setDTR
- 412 setIOErrorIndication
- 413 setPowerMode
- 414 set_port
- 416 setProgramStatus
- 417 set_protocol
- 418 setProtocolSettings
- 420 setProtocolSettingsEx
- 422 setSFTranslation
- 426 setStatus
- 427 setStatusBit
- 428 settimer
- 429 setWakeSource
- 430 signal_event
- 432 sleep
- 434 start_protocol
- 435 startup_task
- 436 startTimedEvent
- 438 timer
- 439 timeoutCancel
- 440 timeoutRequest
- 443 wait_event
- 444 wd_auto
- 445 wd_manual
- 446 wd_pulse
- 447 writeBoolVariable
- 448 writeIntVariable
- 450 writeRealVariable
- 451 writeMsgVariable
- 453 writeTimerVariable
- 455 writeRoutingTableEntry
- 456 IEC 61131-3 C Tools Macro Definitions
- 469 IEC 61131-3 C Tools Structures and Types
- 469 ABConfiguration
- 469 ADDRESS_MODE
- 469 ALARM_SETTING
- 470 clock
- 470 DATALOG_CONFIGURATION
- 470 DATALOG_STATUS
- 471 DATALOG_VARIABLE
- 471 DialError
- 472 DialState
- 472 dnpAnalogInput
- 473 dnpAnalogOutput
- 473 dnpBinaryInput
- 473 dnpBinaryInputEx_type
- 473 dnpBinaryOutput
- 474 DNP_CONNECTION_EVENT Type
- 475 dnpConfiguration
- 479 dnpConfigurationEx
- 484 dnpCounterInput
- 484 dnpPointType
- 484 DNP_RUNTIME_STATUS
- 485 envelope
- 486 HART_COMMAND
- 486 HART_DEVICE
- 487 HART_RESPONSE
- 487 HART_RESULT
- 487 HART_SETTINGS
- 488 HART_VARIABLE
- 488 ledControl_tag
- 489 ModemInit
- 489 ModemSetup
- 490 PROTOCOL_SETTINGS
- 490 PROTOCOL_SETTINGS_EX Type
- 491 prot_settings
- 491 prot_status
- 492 pconfig
- 493 PORT_CHARACTERISTICS
- 494 pstatus
- 494 READSTATUS
- 495 routingTable
- 495 SFTranslation
- 495 SFTranslationStatus
- 496 TASKINFO
- 496 taskInfo_tag
- 497 timer_info
- 497 VERSION
- 498 WRITESTATUS
- 499 C Compiler Known Problems
- 499 Use of Initialized Static Local Variables