Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How acquire scaled and unscaled data with .net ?

Hello,

I acquire continuous data with asynchronous method BeginReadMultiSample. I initialize a new Task and a new AIChannel with method CreateVoltageChannel.
Actually, I acquire unscaled data but I would like to scale this data. I've read than it exists Scale class.
How do I use this class ? With a task ? With a channel ?
I've read than it exists CreateVoltageChannel constructor with scale argument.

Must I create two channels ?

Code:
public class acquisition {

public acquisition (){
// New Task
m_AITask = new Task(nameTask);
                    // Création du canal Analog Input
                    m_AITask.AIChannels.CreateVoltageChannel("Dev1/ai0",
                                                            "",
                                                            AITerminalConfiguration.Differential,
                                                            -10.0, 10.0,
                                                            AIVoltageUnits.Volts);

                    // Configuration de l'échantillonage
                    m_AITask.Timing.ConfigureSampleClock("",
                                                    1000,
                                                    SampleClockActiveEdge.Rising,
                                                    SampleQuantityMode.ContinuousSamples,
                                                    1000);

                    // Vérification de la tâche crée
                    m_AITask.Control(TaskAction.Verify);

                    // Déclaration du type de lecture
                    m_Reader = new AnalogMultiChannelReader(m_AITask.Stream);

                    // Synchronisation (nécessaire qu'avec .NET 2.0)
                    m_Reader.SynchronizeCallbacks = true;
}

public void ReadMultiData()
        {
            if (m_TaskRunning)
            {
                try
                {
                    // begin an asynchronous analog input operation
                    m_Reader.BeginReadMultiSample(m_AcquiParametre.SamplesPerChannel,
                                            new AsyncCallback(ReadCallBack), null);
                }
                catch (DaqException ex)
                {
                    m_TaskRunning = false;
                    m_AITask.Dispose();
                    Console.WriteLine("Erreur");
                }
            }
        }

Thanks.
0 Kudos
Message 1 of 5
(3,557 Views)

Hi,

 

Please precise me what you mean by "unscaled data". Do you get an integer instead of a float? Or do you get your value in volts instead of volts?

If you want to retrieve the values in a physical unit instead if volts, then you can create a new scale from "Measurement & Automation Explorer" and specify this scale in the CreateVoltageChannel() method.

 

Regards,

0 Kudos
Message 2 of 5
(3,530 Views)
Term "unscaled data" means "data in Volts".

I would like to acquire data in Volts and scaled data.

Thanks
0 Kudos
Message 3 of 5
(3,512 Views)
Sorry for the delay, but i suppose that you have found by yourself that you can set the units in volts when you create a scale in MAX.
0 Kudos
Message 4 of 5
(3,435 Views)
Bonjour,

je fais de l'acquisition de données avec NiDAQmx. Les données lues sont en Volts. Je dois mettre à l'échelle ces données et j'aurais aimé utiliser le PolynomeScale. Comment puis-je faire pour obtenir les données en Volts et les données mises à l'échelle ?

Merci d'avance.
Zoax

Message Edité par zoaax le 10-11-2006 10:31 AM

0 Kudos
Message 5 of 5
(3,338 Views)