--- /dev/null
+/* Humusoft data acquisition library.\r
+ *\r
+ * Example that shows configuration of\r
+ * encoder.\r
+ */\r
+\r
+/* Copyright 2002-2007 Humusoft s.r.o. */\r
+\r
+#include <stdio.h>\r
+\r
+#include "hudaqlib.h"\r
+\r
+\r
+int main(int argc, char* argv[])\r
+{\r
+ HUDAQHANDLE h;\r
+ int value;\r
+\r
+ /* open a handle to the first MF624 device in the system */\r
+ h = HudaqOpenDevice("MF624", 1, 0);\r
+ if (h==0)\r
+ {\r
+ printf("\nData acquisition device not found.\n");\r
+ return(-1);\r
+ }\r
+\r
+ /* Configure encoder to count input pulses. */ \r
+ if(HudaqSetParameter(h, 0, HudaqEncMODE, HudaqEncMODERISING) != HUDAQSUCCESS)\r
+ {\r
+ printf("\nCannot switch encoder to counting mode.\n");\r
+ HudaqCloseDevice(h);\r
+ return(-2);\r
+ }\r
+\r
+ /* Turn on hardware filter for input signal. */ \r
+ if(HudaqSetParameter(h, 0, HudaqEncFILTER, 1) != HUDAQSUCCESS)\r
+ {\r
+ printf("\nCannot filter input signal.\n");\r
+ } \r
+\r
+ printf("Counting external pulses on input A by encoder, press Enter to continue.\n");\r
+ getchar();\r
+\r
+ /* Read encoder 0 value, print it. */\r
+ value = HudaqEncRead(h,0);\r
+ printf("Encoder channel 0, value read %d.\n", 0, value);\r
+\r
+ /* close the device handle */\r
+ HudaqCloseDevice(h);\r
+\r
+ return(0);\r
+}\r
+\r