Chapter 4 NI-DNET Programming Techniques
NI-DNET User Manual 4-4 ni.com
• If you set the PollMode parameter of ncOpenDnetIntf to Scanned,
to configure scannedI/ O you must specify the exact same
ExpPacketRate when you open each of your strobed/polled
I/O connections. Using this scheme, you must determine a valid
ExpPacketRate for your DeviceNet system.
Figure 4-2 shows a scanned polling example for four polled devices at
MAC ID 14, 17, 20, and 30. The shaded areas indicate other message
traffic, such as the strobed I/O messages shown in Figure4-1.
Figure 4-2. Scanned Polling Timing Example
Background PollingScanned polling can be less efficient when used with devices with
significantly different response times or devices with significantly different
rates of physical measurement. In the example above (Figure4-2), consider
what would happen if device 14 took 52 ms to respond and device 20 took
38 ms to respond. In this case, even though device 17 and device 30
respond well within 20 ms, the common ExpPacketRate would need to
be at least 52 ms. This situation can often be avoided using a special case
of scanned polling called background polling.
To configure background polling, you first set the PollMode parameter of
ncOpenDnetIntf to Scanned. Then for each polledI/O connection you
configure (ncOpenDnetIO with ConnectionType set to Poll), you must
set ExpPacketRate to either a foreground rate or a background rate. The
foreground poll rate is the same as the common ExpPacketRate used for
all strobed I/O. Devices in this group generally respond quickly to poll
commands or have data that changes relatively quickly. The background
poll rate must be an exact multiple of the foreground poll rate. Devices in
this group generally respond slowly to poll commands or have data that
changes relatively slowly (such as temperature).
Background polling provides many of the same advantages as scanned
polling. The handling of only two groups optimizes performance. Also,
Poll Cmd 14
Poll Cmd 20
Poll Cmd 30
Poll Response 30
Poll Response 17
Poll Response 14
Poll Response 20
Poll Cmd 17
0 ms 5 ms 10 ms 20 ms15 ms