]> rtime.felk.cvut.cz Git - mf6xx.git/blob - src/HuLinux-2.4.3/samples/DigitalOUT/DOWriteMultipleBits.c
Initial commit; HuLinux ver. 2.4.3; All files auto-indented
[mf6xx.git] / src / HuLinux-2.4.3 / samples / DigitalOUT / DOWriteMultipleBits.c
1 /* Humusoft data acquisition library.
2  *
3  * Example that demonstrates using HudaqDOWriteMultipleBits.
4  * This function allows to influence only selected bits from
5  * digital outputs.
6  */
7
8 /* Copyright 2002-2007 Humusoft s.r.o. */
9
10 #include <stdio.h>
11
12 #include "hudaqlib.h"
13
14
15 int main(int argc, char* argv[])
16 {
17         HUDAQHANDLE h;
18
19         /* open a handle to the first MF624 device in the system */
20         h = HudaqOpenDevice("MF624", 1, 0);
21         if (h==0)
22         {
23                 printf("\nData acquisition device not found.\n");
24                 return(-1);
25         }
26
27         /* HudaqOpenDevice initializes all digital output bits to 0 */
28
29         /* Set first and fifth bits to value '1'. */
30         HudaqDOWriteMultipleBits(h, 0, 0x11, 0x11);
31         printf("\nBits 1 and 5 are set. Press any key to continue.");
32         getchar();
33
34         /* Reset bit 1 and set bit 6. */
35         HudaqDOWriteMultipleBits(h, 0, 0x21, 0x20);
36         printf("\nBit 1 is reset and bit 6 is set. Press any key to continue.");
37         getchar();
38
39
40         /* close the device handle */
41         HudaqCloseDevice(h);
42
43         return(0);
44 }
45