Chapter 4
NI-DNET Programming Techniques
4-8
ni.com
For strobed and polled I/O connections, determination of a valid
ExpPacketRate
can be somewhat complex. If you have trouble
estimating an
ExpPacketRate
value for strobed/polled I/O, set the
PollMode
parameter of your initial call to
ncOpenDnetIntf
to
Automatic
. When you use this automatic EPR feature, the
ExpPacketRate
parameter of
ncOpenDnetIO
is ignored for
strobed/polled I/O (
ConnectionType
of
Strobe
or
Poll
), and NI-DNET
calculates a safe EPR value for you. This automatic EPR is the same for all
strobed and polled I/O connections (scanned I/O).
After you start communication, you can use the
ncGetDriverAttr
function to determine the value calculated for
ExpPacketRate
. From that
value, you can then experiment with other
ExpPacketRate
configurations
using
PollMode
of
Scanned
or
Individual
.
The following information is used by NI-DNET to calculate a safe EPR:
•
NI-DNET assumes that it is the only master in your DeviceNet system.
•
The
BaudRate
parameter of
ncOpenDnetIntf
determines the time
taken for each message.
•
The
InputLength
and
OutputLength
parameters of each
ncOpenDnetIO
determine the time needed for each I/O message.
•
NI-DNET assumes that each strobed/polled I/O device can respond to
its command within 2 ms.
•
NI-DNET sets aside a fixed amount of time for explicit messages. This
time depends on the baud rate.
Using I/O Data in Your Application
Appendix A,
, explains that the data transferred to and
from a DeviceNet device on an I/O connection is usually processed by an
Assembly Object within the slave device. Input assemblies represent the
data received by NI-DNET from a remote device, and output assemblies
represent data that NI-DNET transmits to a remote device.
To use a device’s I/O data within your application, you need to understand
the contents of its input and output assemblies. You can find this
information in the following places:
•
Printed documentation provided by the device’s vendor.
•
If the device conforms to a standard device profile, the I/O assemblies
are defined within the DeviceNet Specification.