Quick and simple analog input test (C++ and VB project)

  • This sample reads data from AIN1:. Registry settings are outlined in the projects and corresponds in the majority of cases with the kernels standard settings.

    Files

    • Ain.zip

      (41.97 kB, downloaded 345 times, last: )

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hello,
    we are trying to run the sample on our NetDCU9. The output on the display is always 0x03ff, no matter if the pin is connected to 3.3V or to ground.
    First we configured the registry settings as described in this example and tried to use AD0 with channel 0. Because it did not work and you used AIN1 in the sample we changed the setting to channel 1 and used AD1. Is it right to use channel 1 and AD1 for this example with AIN1?
    Additionally we would like to know how the input and output range of the A/D-converter is configured. 0V at the pin means 0x0000 as output of the A/D doesn’t it?
    Are there any documents which describe the functions ReadFile() and CreateFile() a little more detailed concerning the function and the parameters.
    Best regards.

  • Hello,
    Yes, we checked the file you mentioned and we used an earlier version for our registry settings. With the new file we overlooked them but the analogue input still is not working.
    Our registry settings are as following:
    00 “indexâ€Â=dword:1\
    01 “channelâ€Â=dword:1\
    02 “Prefixâ€Â=string:AIN\
    03 “Dllâ€Â=string:ANALOGIN.dll\
    04 “Orderâ€Â=dword 151\
    05 “FriendlyNameâ€Â=string:Digital I/O driver for NetDCU\


    Are these settings correct to use the analogue input channel 1 of the NetDCU9?
    To test the example program we connected AD1 with 3.3V at pin 7 of J7 and with GND at pin 8 of J7. Our output from the test program is always 0x03ff. If AD1 is connected to ground the output should be 0x0000 shouldn’t it?
    Best regards.

  • Ok, your settings seems to be right. And i will cheeck it in detail.
    But can you answer the following questions before:
    Which kernel version do you use?
    Did you saw that anlog in was loaded (serial debug output or HKLM/Driver/ActiveXX)?
    Did you use exacly the same code as in the sample? Else please post me the code.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • We use the kernel version NK9_CF2_MP_IE_090205.zip and we used exactly the C++ code from the example.
    How can we check if the analogue in was loaded over serial debug output? Is there any description how to use the serial debug?

  • Hello,

    Quote

    How can we check if the analogue in was loaded over serial debug output? Is there any description how to use the serial debug?

    You can disable/enable serial debug output in the bootloader by command "O". Command "h" gives you a short overview about bootloader commands. Bit if "CreateFile" returns a valid handle you can also be sure the drivers is loaded.


    I checked NetDCU9 AIN driver and saw that that following configuration for "channel" regsiter is valid:
    0x10 Reads value from analogue channel 0
    0x14 Reads value from analogue channel 1
    0x18 Reads value from analogue channel 2
    0x1C Reads value from analogue channel 3
    Does it work now?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Thank you very much for this information and the fast reply. Now it is working.
    But perhaps you should check the mentioned file above and update the channels. We could have saved 3 days working if we had used the correct channel the first time.
    Best regards.

  • Hello, in most cases the samples are specific for one board so a check of documentation is requried before deploy the sample on an other board. But you are right there is an error in the "Device Driver Documentation" and i will update it asp.


    Thank you very much for your cooperation.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.