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

Скачать
Страница из 86
Chapter 4
NI-DNET Programming Techniques
© National Instruments Corporation
4-11
4.
Right-click on the 
ByteOffset
 terminal and select Create Constant
then enter 
0
 as the byte offset.
5.
Right-click on the 
8[TF] in
 terminal and select Create Control. In 
the front panel control that appears, you can use the button at index 0 
to control Run Fwd and the button at index 2 to control Fault Reset.
6.
Using the NI-DNET palette, place 
ncConvertForDnetWrite
 into 
your diagram.
7.
Wire the 
DnetData out
 terminal from the previous 
Convert
 into the 
DnetData in
 terminal of this 
Convert
.
8.
Right-click on the 
DnetType
 terminal and select Create Constant
then select 
INT
 from the enumeration.
9.
Right-click on the 
ByteOffset
 terminal and select Create Constant
then enter
2
 as the byte offset.
10. Right-click on the 
I32/I16/I8 in
 terminal and select Create 
Control. You can use the front panel control that appears to change 
Speed Reference.
11. Using the NI-DNET palette, place 
ncWriteDnetIO
 into your 
diagram.
12. Wire the 
DnetData out
 terminal from the previous 
Convert
 into the 
Data
 terminal of 
ncWriteDnetIO
.
For more information on the 
ncConvertForDnetWrite
 and 
ncConvertFromDnetRead
 functions, refer to the NI-DNET Programmer 
Reference Manual. For information on LabVIEW data types and their 
equivalent DeviceNet data types, refer to Chapter 1, NI-DNET Data Types
in the NI-DNET Programmer Reference Manual.
Accessing I/O Members in C
Since DeviceNet data types are very similar to C language data types, 
individual I/O members can be accessed in a straightforward manner. You 
can use the standard C language pointer manipulations to convert between 
C language data types and DeviceNet data types.
The following steps show an example of how standard C language can be 
used to access the Basic Speed Control Output Assembly described in the 
previous section.
1.
Declare an array of 4 bytes, as in the following.
NCTYPE_UINT8OutputAsm[4];