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

Скачать
Страница из 86
Chapter 4
NI-DNET Programming Techniques
© National Instruments Corporation
4-3
Polled I/O
Polled I/O connections use a separate poll command and response message 
for each device.
The overall scheme that NI-DNET uses to time polled I/O connections is 
determined by the 
PollMode
 parameter of 
ncOpenDnetIntf
. This 
PollMode
 parameter applies to all polled I/O connections (all calls to 
ncOpenDnetIO
 with 
ConnectionType
 of 
Poll
).
The following sections describe different schemes you can use for 
polled I/O.
Scanned Polling
You can set the 
ExpPacketRate
 of each polled I/O connection to the same 
value used for all strobed I/O. Using a common 
ExpPacketRate
 for all 
strobed and polled I/O is referred to as scanned I/O. Scanned I/O is also 
referred to as scanned polling with respect to polled I/O connections. When 
you use scanned I/O, NI-DNET transmits all strobe and poll command 
messages onto the network in quick succession.
Scanned I/O is a simple, efficient way to handle I/O connections that 
require similar response rates. With scanned I/O, the master knows that all 
strobe and poll commands go out at the same time. Therefore, the master 
does not need to manage individual timers, thus optimizing processing 
overhead. Scanned I/O also provides overall consistency. If a given 
DeviceNet system uses only scanned I/O, you know that all higher level 
control algorithms can execute at the single common strobe/poll 
ExpPacketRate
.
The common 
ExpPacketRate
 for all strobed and polled I/O connections 
should provide enough time for all strobe/poll commands and each slave’s 
response. You must also allow time for other I/O messages and explicit 
messages to occur in the 
ExpPacketRate
 time frame.
NI-DNET provides two different methods you can use to configure 
scanned I/O:
If you set the 
PollMode
 parameter of 
ncOpenDnetIntf
 to 
Automatic
, NI-DNET automatically calculates a valid common 
ExpPacketRate
 value for each strobed and polled I/O connection. 
When you use this scheme, you do not need to specify a valid 
ExpPacketRate
 when you open your strobed/polled I/O connections. 
For more information, refer to the 
in this chapter.