Jump to content
  • 0

USB-1608GX VB Analog Input Integration


kushal.nargundkar

Question

Hello all. I'm new to MCC & their USB device USB-1608GX for analog input measurement. We used to use NI USB6212 device & so have VB code written for sampling the data. I need to replace it with MCC drivers. How do I go about doing that? What changes would I have to make in order to make it happen?

I'm using Windows 10 as OS & VB.NET framework. I have download InstaCal and can see my device when I plug it in. Also I have downloaded UL & have been going through the examples. 

I am relatively new to VB as well. So ideally a sample solution file which is specifically for reading analog input values would be ideal.

Thanks in advance

Edited by kushal.nargundkar
Added more information
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello,

Your source of information is the Universal Library Help: https://www.mccdaq.com/pdfs/manuals/Mcculw_WebHelp/ULStart.htm. You can look up the functions to see what they do. To get to the USB-1608G page, use the Search feature and look up "USB-1608G". 

To get started, review the following program. https://kb.mccdaq.com/KnowledgebaseArticle50847.aspx This program reads the first four channels continuously. To stop it, press any key. 

I've attached its Visual Studio project to this post. The project uses a the mccdaq.dll. It was added to the project as Reference Extension. If you create a new project, right mouse click the project shown in the Solution Explorer and select Add->References, select Extensions and add MccDaq. 

Best regards,

John

VBNET_2013_Cont_Background_Scaled_Data.zip

Link to comment
Share on other sites

  • 0
On 3/29/2023 at 8:32 AM, JRys said:

Hello,

Your source of information is the Universal Library Help: https://www.mccdaq.com/pdfs/manuals/Mcculw_WebHelp/ULStart.htm. You can look up the functions to see what they do. To get to the USB-1608G page, use the Search feature and look up "USB-1608G". 

To get started, review the following program. https://kb.mccdaq.com/KnowledgebaseArticle50847.aspx This program reads the first four channels continuously. To stop it, press any key. 

I've attached its Visual Studio project to this post. The project uses a the mccdaq.dll. It was added to the project as Reference Extension. If you create a new project, right mouse click the project shown in the Solution Explorer and select Add->References, select Extensions and add MccDaq. 

Best regards,

John

VBNET_2013_Cont_Background_Scaled_Data.zip 16.15 kB · 1 download

Hello JRys,

I was going through the sample code you provided & had a few questions. Why do we have to ping pong between lower & upper half to capture the buffer data?

I changed the channel count to 8 & highchan to 4 since I have 8 channel AI board. When I did that & connected an external analog source to AI1, I saw all the other channels were also getting updated. My source was a sine wave of 5Vpp. I'd thought only AI1 would get updated. Does it scan all the channels & then outputs only the one that's changing?

In my ABS application, I'd have 2 AI channels- one for left channel & 1 for right. So, I'd need the data buffer to hold them separately as e.g. AI0 & AI1 & not mix them up.

Attached is a screenshot of the fault that I got when I incorporated into my VB solution file. Also attached is the NI Analog class I'm trying to replace with MCC Analog

image.thumb.png.fc6215823473ca69f095c3e1a3378971.png

MCCAnalog.vb

Edited by kushal.nargundkar
Link to comment
Share on other sites

  • 0

The AInScan function creates an acquisition that consists of a group of channels, a buffer, the buffer size, and options that dictate how it is to run. Only one can be running at a given time. However, your code uses a for-loop to run multiple continuous acquisitions, which is illegal. You should have gotten an error calling the second AInScan. Change the options parameter from:

Dim Opts As MccDaq.ScanOptions = Continuous + Background + ScaleData  

To

Dim Opts As MccDaq.ScanOptions = ScaleData

This will make your for-loop wait for the AInScan function to finish. When it has, the function will return control to the for-loop and the data can be transferred and displayed.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...