Jump to content
  • 0

Multiple analog in at the same time USB-1408FS in C#


JBOS

Question

Hello everyone,

I am trying to read and display analog input data from my USB 1408FS in a C# application but ran into a problem. I can display one channel at the time after some sorting through the sample codes but I am stuck at how I can read 2 channels for example and simply display this data in a simple C# form. 

Trying to build a simple application that reads several pressure sensors and I want to show them all on the screen, very simple to start before making it more complex. Pressure monitor will run 24/7, burst measuring is not the way to go, it just needs to stream the values to the screen.

Sample code has this line to read the input voltage on a channel:

ULStat = DaqBoard.VIn(Convert.ToInt16(nudAInChannel.Value), Range, out VInVolts, MccDaq.VInOptions.Default);

This all works fine but changing the channel reads the voltage to the same VIVolts variable that cannot be changed it seems. VInVolts0 for channel zero and VInVolts1 for channel 1 would be the solution but this does not work.

Can anybody shine some light on how to do this for me? 

Thanks in advance and best regards,

Jan

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello,

Why not make VInVolts an array that uses the channel number as the index. 

float[] VInVolts = new float[2];

ULStat = DaqBoard.VIn(Convert.ToInt16(nudAInChannel.Value), Range, out VInVolts[Convert.ToInt16(nudAInChannel.Value)], MccDaq.VInOptions.Default);

Best regards,

John

Link to comment
Share on other sites

  • 0

Hello John,

Great idea, did not know you can do this with out VInVolts, I tried many other ways but always got an error back. Let me try this and I will let you know if this works.

Thanks in advance and best regards,

Jan

 

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...