]> rtime.felk.cvut.cz Git - mf6xx.git/blob - src/HuLinux-2.4.3/samples/DigitalIn/DIRead.c
9abb31e4721838d474e99eaaccb892b1d44da412
[mf6xx.git] / src / HuLinux-2.4.3 / samples / DigitalIn / DIRead.c
1 /* Humusoft data acquisition library.\r
2  * Example that shows reading of digital input channels\r
3  * using the function to read a single channel.\r
4  */\r
5 \r
6 /* Copyright 2002-2007 Humusoft s.r.o. */\r
7 \r
8 #include <stdio.h>\r
9 \r
10 #include "hudaqlib.h"\r
11 \r
12 \r
13 int main(int argc, char* argv[])\r
14 {\r
15         HUDAQHANDLE h;\r
16         unsigned value;\r
17 \r
18         /* open a handle to the first MF624 device in the system */\r
19         h = HudaqOpenDevice("PCT7303B", 1, 0);\r
20         //  h = HudaqOpenDevice("PCD7004", 1, 0);\r
21         if (h==0)\r
22         {\r
23                 printf("\nData acquisition device not found.\n");\r
24                 return(-1);\r
25         }\r
26 \r
27         /* read whole digital channel at once */\r
28         value = HudaqDIRead(h,0);\r
29         printf("\nValue read from digital channel 0: %Xh ", value);\r
30 \r
31         /* close the device handle */\r
32         HudaqCloseDevice(h);\r
33 \r
34         return(0);\r
35 }\r
36 \r