Справочник Пользователя для National Instruments NI-DNET

Скачать
Страница из 86
Chapter 4
NI-DNET Programming Techniques
© National Instruments Corporation
4-5
background polling maintains overall network consistency because 
NI-DNET evenly disperses all background poll commands among multiple 
foreground cycles. In other words, all background poll commands are not 
sent in quick succession and thus do not generate quick bursts of traffic on 
the network.
Figure 4-3 shows a background polling example which resolves the 
problem discussed previously. Devices at MAC ID 17 and 30 are 
foreground polled every 20 ms (as before). Devices at MAC ID 14 and 20 
are background polled every 60 ms (3 times the 20 ms foreground rate). 
The shaded areas indicate other message traffic.
Figure 4-3.  Background Polling Timing Example
Individual Polling
When the underlying response rates of all polled I/O devices do not fit into 
two clear groups, background polling can still be inefficient. For example, 
assume you have four different polled I/O sensors capable of updating 
measured input at 10 ms, 35 ms, 100 ms, and 700 ms respectively. Each 
device responds to its poll command within 1 ms but measures data at a 
different rate (such as a pushbutton for 10 ms and a temperature sensor for 
700 ms). You could group these into a foreground rate of 10 ms and a 
background rate of 700 ms, but then much DeviceNet bandwidth would be 
wasted polling the 35 ms and 100 ms devices at the foreground rate. For 
this situation, the 
individual polling
 scheme is most appropriate.
To configure individual polling, first set the 
PollMode
 parameter of 
ncOpenDnetIntf
 to 
Individual
. Then for each polled I/O connection 
you configure (
ncOpenDnetIO
 with 
ConnectionType
 set to 
Poll
), you 
must set 
ExpPacketRate
 to the rate desired for that device. Unlike the 
scanned polling or background polling scheme, each poll command is no 
longer associated with the strobe command’s rate, but instead is solely 
based on its 
ExpPacketRate
.
Poll Cmd 17
Poll Cmd 30
Bkd Poll Cmd 14
Poll Response 30
Poll Response 17
Poll Cmd 17
Poll Cmd 30
Bkd Poll Cmd 20
Poll Response 30
Poll Response 17
Poll Cmd 17
Poll Cmd 30
Poll Response 30
Poll Response 17
Bkd Poll Response 14
Bkd Poll Response 20
Poll Cmd 17
Poll Cmd 30
Blk Poll Cmd 14
0 ms
20 ms
40 ms
60 ms