Programming Analog Input Registers for MSeries NI-6221

I am trying to understand the Preliminary M Series Register Map in order to correctly setup and acquire data from the Analog Input channels of my PCX-6221 card. I have been able to figure out the DIO locations and use them but I am having trouble understanding what I have to do to configure and acquire data using the Analog Input registers of the card. I need to program at this level for an RTX application using Microsoft Visual Studio Net 2003 and have had great success doing so with other NI Cards. I have tried looking at the examples provided by the MDDK but I haven't been able to create a environment that allows me to compile them with Chipobjects and it appears like alot of the work is hidden by the subroutines.
I wonder if someone had a high level algorithum using the Register Map it would help out alot.
Questions:
How would I create a multiple channel Scan List and load it into the card setting gain etc...
How would I configure the card to acquire continously at a specified freq (ex 1000 samples a sec)
How would I start/stop acquisition
I would guess getting the status of the FIFO and accessing the FIFO is a matter of reading the AI_STATUS_1 and AI_FIFO_DATA locations
Would looking at the Register Programming Manual for the "E" Series help me or just get me more confused?
Thanks in advance for any light you can shed on the subject.
Floyd

Hi Floyd-
Let me address your questions individually:
How would I create a multiple channel Scan List and load it into the card setting gain etc...
A multi-channel scanlist can be created as shown in the method aiConfigureChannel() from ai.cpp in the M Series MHDDK \Examples folder.  Note that the other operations leading up that point (notably, aiClearConfigurationMemory() must be performed in the order shown in the various AI examples.  aiex3.cpp is the most useful starting point for investigation, in my opinion.
How would I configure the card to acquire continously at a specified freq (ex 1000 samples a sec)
aiex3.cpp shows how to setup the device and its DMA controller (aka the "MITE") for DMA operation.  In order to configure for continuous operation you set the "continous" flag in that example to kTrue.  The effect of that setting is to program the STC-II to generate either a finite or continuous AI sample clock.  This programming is performed in the function aiNumberOfSamples() from ai.cpp and has the effect of setting the appropriate bitfield for continuous operation in the AI_Mode_1 register. 
Earlier in your post you asked if the STC Technical Reference Manual ( http://digital.ni.com/manuals.nsf/websearch/E929838D7D0EE50986256728007FEADF ) would be a good reference.  In fact, it's a great reference from the perspective of understanding the bitfield/register names and understanding the basics of how the timing hardware works (for example BC, UC and other sample counters are all functionally equivalent in the STC and STC-II).  From the perspective of actual register writes and reads, the functionality is different between E Series and M Series.  The biggest difference, as another forum user alluded, is that we map and write directly to the registers on M Series so Windowed_Mode reads and writes are no longer necessary.
Another difference between STC and STC-II is that the STC-II uses NI TIO-style counter/timers.  For that reason, the NI 660x RLP manual ( http://digital.ni.com/manuals.nsf/websearch/4CE1C778F442B01386256C870060F9F3  ) would be a good reference for M Series counter/timer operations.
How would I start/stop acquisition
Assuming you don't need an external start trigger, you only need to write to the strobe bit AI_Command_2->AI_START1_Pulse.  This will create a single start trigger pulse internally.  The differences between AI_START1 and AI_START are described in the STC Technical Reference Manual.
A finite acquisition would be stopped automatically by the AI timing engine based on the number of samples you program via the method shown in aiNumberOfSamples().  Continuous AI would be stopped by first stopping the DMA operation and then calling aiReset().
 I would guess getting the status of the FIFO and accessing the FIFO is a matter of reading the AI_STATUS_1 and AI_FIFO_DATA locations
Yes, this would work but I would strongly suggest using DMA as shown in aiex3.cpp.  If you want to use "programmed I/O" to read the FIFO data directly, that method is shown in aiex2.cpp
 Would looking at the Register Programming Manual for the "E" Series help me or just get me more confused?
In many cases it would be very helpful.  See my comments, above.
I have inherited code that works on 65xx cards which I am pretty sure uses windowed mode that I am using in this 6221 driver. I have found that I can set the PLL registers to act as DIO and I can read the Discrete inputs just fine. Makes me curious, if Windowed mode is not used doesn't that mean the addresses are relative to the BAR1 address? Why then am I able to read the DIO?
I'm not sure why this would work- it's possible that some legacy functionality is still working due to the way you access the hardware in your code.  For full functionality with M Series you must use mapped memory I/O to write and read from the device's registers.
Also starting with Clock_and_FOUT according to the example I set it for Slow_Internal_Timebase. But when I read back that Address it is always zero. According to the register map it is a "write". Does that mean I can't read it's contents? Or do I seem to have a problem because I am trying to use windowed mode with this card.
Yes, the "write" registers are write-only and the "read" registers are read-only.  The effect of data read from or written to "write" or "read" registers, respectively, is undefined.
Hopefully this helps-
Tom W
National Instruments

Similar Messages

  • Programming Analog Input Registers for MSeries NI-6280 under rtx

    I have an example of aiex1.cpp,I kown it write some bit in some register,I want to translate it into RTX.but I found some register is only wirte and I also dont kown what the default bits  in registers is,so use " *(u16*)addr_tmp|= (1 << 7);" is wrong, what can I do about writing some bits in register under RTX? please help me
    beilei
    Solved!
    Go to Solution.

    Hello Beilei,
    Yes, the _softCopy starts out at 0.  However, please remember that the _softCopy isn't always 0.  After the line you mention runs, a value is saved in newValue...after flushing newValue to the register, that value is also saved in _softCopy.  Basically, this proceedure ensures that the other bit fields in _softCopy are not modified unintentionally.
    If you have any doubts about what is happening, I would recommend stepping through the code while it is running so that you can see what is happening in that line (you may wan to break it out into multiple lines).
    ~~~~~
    Regarding the errors you are getting in RTX, please follow the readme for building the examples with this OS interface.  The Readme says that it was tested with RTX 6.1.  If you are using a later version, you may need to contend with any changes that may have happened with this operating system.  If you work through any issues, please post back to let us know what went wrong.  We welcome any feedback about this OS interface!
    Thanks,
    Steven T

  • Programmin​g Analog Input Registers for MSeries NI-6280 under rtx

    I have an example of aiex1.cpp,I kown it write some bit in some register,I want to translate it into RTX.but I found some register is only wirte and I also dont kown what the default bits  in registers is,so use " *(u16*)addr_tmp|= (1 << 7);" is wrong, what can I do about writing some bits in register under RTX? please help me
    beilei

    hello,steven! I found another question when using pxi 6280. the exampels what you give is  collect Finite point,but i want to collect Consecutive points。now I do not kown what register to control how much point I want to collect because of no pdf about pxi6280.i want to kown what regiser to keep collecting  Consecutive points。thanks!
    beilei

  • "Chassis Temperatur​e" in Analog Input Module for FPGA (cRIO-9201​)

    I have just gotten my cRIO with a analog module (9201) and a digital output module (9472).
    When I place an Analog Input Module on my block diagram and double click it, I can choose from the following inputs:
    Channel 0 through Channel 7
    AND
    Chassis Temperature
    I have tried to find any documentation for this "Chassis Temperature" but so far without success.
    If I read this input and feed it straight to an indicator, I get values in the range of 120 to 150.. Now, without more information, this number is rather useless. Does anyone know how to transfer this data to a temperature (either in the Celcius scale or the Fahrenheit scale)?
    Thank you!
    Project Engineer
    LabVIEW 2009
    Run LabVIEW on WinXP and Vista system.
    Used LabVIEW since May 2005
    Certifications: CLD and CPI certified
    Currently employed.

    I still did not find any documentation for this "feature" but I lucked out and found the following:
    in the folder: \labview 7.1\examples\FPGA\CompactRIO\cRIO-910x\
    you should have a file called:
    cRIO-910x support files.llb
    in this there is a convert to temperature vi.
    To get the raw data as a temperature, it looks like all you have to do is divide the binary data by 4 and the answer will be in Celcius.
    Project Engineer
    LabVIEW 2009
    Run LabVIEW on WinXP and Vista system.
    Used LabVIEW since May 2005
    Certifications: CLD and CPI certified
    Currently employed.

  • Connector block 16 analog input channel for 6036E

    sugesst me connector block of 16 analog input channels compatible with 6036E daq card

    Thanks for contacting National Instruments.
    You really have two choices in connector blocks: the SCB-68 and the CB-68LP. The CB-68LP is inexpensive, but unshielded. If you are concerned about introducing noise into your signal, or if you are talking small measurements (mV range), then the shielded option, the SCB-68, will be better for you.
    Regards,
    Mike G.
    National Instruments Support

  • Would anyone know how to program the Labview code for the following: Recording an analog input signal for 100msec and then repeating this 100 times in order to finally have an averaged signal (waveform)​?

    I have added a vi, but it doesn't quite work. Would be very grateful if someone could help, thanks!
    Attachments:
    Average_0411041_2.vi ‏77 KB

    The attached VI collects 100 ms of data and does a rolling average. Since your sub-VI were not included I created this from scratch. There are comments in the code. I hope this is what you need.
    Dirk
    Attachments:
    rollingaverage110x100.vi ‏47 KB

  • Pci-6251 analog input set up

    Hi all,
    Can I set the analog input of PCI-6251 in mix configuration (some in differential mode and some in single ended mode). Because in my set up the differential option is greyed out.
    Thanks
    dphan128
    Solved!
    Go to Solution.

    Yes you should be able to do that. You have 16 analog inputs. For differential you will use two of those per channel. See the DAQ M series user manual. You can program channels on an M Series device to acquire with different ground references.To enable multimode scanning in LabVIEW, use NI-DAQmx Create Virtual Channel.vi of the NI-DAQmx API. You must use a new VI for
    each channel or group of channels configured in a different input mode.
    Remeber that for a differential that you would wire for example AI 0 to the + side and AI 8 to the - side. So now you can't use the AI 8 for single ended. AI 1 is related to AI 9 etc. up to AI 7, AI 16.
    Hope this helps.
    Using LabVIEW 2010SP1 and TestStand 4.5

  • Dv video time stamp with analog input

    Hi,
    I have a dv video which I want to time stamp with a analog input.  For the video, which is dv brought into the computer with ieee1394, LabView calls up a C++ program which then stores the video.  Simultaneously, in the program which calls up the C++, an analog signal is also stored (seperately).  I know it sounds tricky as well as messy but this is the best we've been able to work out, given the uncorroperative nature of LabView with dv camera.  Does anyone have suggections for time stamping these two signals so that I know exactly where in the video the analog signal occurs?  The PCI board we use is the NI 6014, which I know is timestamp capable, but I dont know if it can stamp the video feed since it doesnt come in through the NI card.
    All thanks in advance for any help!
    Daniel

    Daniel,
    Does your DV camera have any sort of timing or triggering signals? Without these, it will be virtually impossible to correlate measurements. It is cetainly possible to accurately time an analog input with your DAQ card, but correlating these to the digital video would be extremely difficult. Is this video streaming in real time? Or are you reading it off of an already-recorded tape? If this video is streaming in real time, with an acquisition started in software, I would suggest attempting to start the software DV reading at the same time as your DAQ task. If you do have an external signal that can trigger the video acquisition, then I would suggest using that same signal to start your analog acquisition.
    Hope this helps,
    Ryan Verret
    Product Marketing Engineer
    Signal Generators
    National Instruments

  • Can you have set points for analog inputs

    if you install an analog input can you get set points that trigger either an alarm or a motor to turn on or off
    Solved!
    Go to Solution.

    In SignalExpress you can use alarms for triggering logging on and off:
    Alarms Page - LabVIEW SignalExpress Help
    As for turning motors on and off, SignalExpress is not meant for control applications.  For controls, you should use LabVIEW either entirely or use a LabVIEW VI from SignalExpress.  To do the latter, you could use a LabVIEW VI step in SignalExpress that will execute a LabVIEW VI that does the control processing and outputting that you want.  That way you could work in the SignalExpress environment for all the data acquisition, and you would only have to use LabVIEW to program the control VI (or VIs).  
    Mark E.
    National Instruments
    Schedule a Free 1-Hour online LabVIEW Tutorial with an NI Applications Engineer

  • How to use Digital output to turn on sensor for Analog Input?

    I am trying to use a digital output to turn on an array of sensors that I then wish to read on 16 analog input lines. I have a 6024E DAQ card. I am planning to take data at 10-20 hz, so not terribly fast, but I will be acquiring for long periods of time (days) so I will be streaming data to disk.
    I have a fair bit of experience in Labview basics, but can quickly get out of my depth when I try something new (like this). I have V6.01.
    It looks as though the best way might be to do the DO and then a single AI as individual events, then write to disk and continue through the loop. I am puzzled, however, how to keep this cycle on schedule given that I don't know how long it will take to sample 16 channels
    , write the data to disk and get back to the starting point... perhaps this is so fast that I don't need to worry about it? The actual timing of the samples (be it 10 or 20 hz) isn't too critical, as long as I can record at what time they were taken... it would be frustrating to find that I was several seconds off after days of data.

    Hello,
    Thank you for contacting National Instruments.
    If you are worried about the time of your acquisition being off, then you should associate each voltage measurement with a timestamp. This will allow you to know the exact time at which the sample was taken and you will never be off. You can use the Get Date/Time in Seconds.vi in our while loop with your AI code so that you can read a sample and read the time. You can than log the voltage value and the timestamp to your file.
    Regards,
    Bill B
    Applications Engineer
    National Instruments

  • Different Sampling rates for different channels in Analog Input

    Hi,
    I would like to acquire data at different sampling rates on different channels say ACH 0, ACH 1 and so on. I have a PCI 6052E board and NI DAQ 6.9.2. Also is it possible to simultaneously perform Analog output on two different channels along with the Analog input? What will be the problems/consequences as far as the system resources are concerned. I am a beginner in this area and would greatly appreciate any help/pointers for my queries.
    Thanking you in advance
    Deepak

    Search the eaxamples that ship with LV.
    Theer is one called simultaneous input and output or something like that.
    It will get you started.
    re: multiple scan rates. This is acoomplished by sampling all channels at the highest rate and throw away the expttra samples you do not need.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to enable 2 or more analog input pin in arduino uno labview simultaneo​usly for voltage analysis?

    Hi everyone,
    i am new to labview and using arduino uno board for measuring microwave analysis in my project. i want to measure the refflection coefficient by dividing two analog input received to arduino (Vref and Vin) to obtain so. problems come where i just can analyze only one analog input pin only. please, kindly helped to figure it out.i've try the others solution where i create two while loops for different analog pin. u can refer to my circuit in the attachment below.i really2 appreciate ur help, thank you.=)
    Attachments:
    reflection coefficient and Vswr.vi ‏665 KB
    front panel.PNG ‏66 KB
    block diagram.PNG ‏40 KB

    Try this if you have a POT around hook it up to the arduino than use the AnalogInSerial.pde and  load it to your arduino exit out of the arduino platform and  than try my VI see if this helps you.
    Harold Timmis
    [email protected]
    Orlando,Fl
    *Kudos always welcome
    Attachments:
    TalkToArduino.vi ‏28 KB

  • User-Selectable Analog Inputs for X-Y Graph Axis?

    Hey,
    I've done a lot of looking at demos/examples, and I'm still have some issues with this one. I'd like to have a all of my analog inputs inside a drop down box on the front panel (one box for each axis). The user would be able to select which input they wanted on a particular axis from the drop down boxes. This would all be on the fron panel of course.
    I found one good example (Signal Generation & Processing.vi) located in NI > Labview 7.1 > examples > apps, but I can't quite follow the sub-vi's. Note that I'd like the selected signals displayed on the X-Y graph to be real-time, not from logged data. Is an X-Y graph even the best plot for this? Thanks for the help ahead of time!
    -Doug

    Are you sure you want an XY graph? An XY graph will take your two inputs and plot them against each other, not against time. If this is what you want, here's a VI that has four different inputs simulating four acquired channels, and lets you select which of the four you want for both the X and Y axes.
    Robert Mortensen
    Software Engineer
    National Instruments
    Attachments:
    Selectable XY Graph.vi ‏68 KB

  • I get an 10403 error on daqpad-1200 for analog inputs

    OS: WIN2K
    NI DAQ 6.9.3
    also loaded LV6Eng.exe
    I know there are analog inputs.
    All other ports work.
    Why don't these work?
    Anything I should be looking for?

    Shawn,
    Are you receiving the following error:
    "The device is not responding to the first IRQ level"
    If so, you should examine the Verify the Interrupt Request (IRQ) Setting section in the following troubleshooting resource:
    Parallel Port DAQ Device Troubleshooting in Windows 2000
    Spencer S.

  • Analoge input not constant/ NI 6221/ DAQmx

    Dear Sir
    I use DAQmx (labview7.1).
    I would like to use NI6221 to read 32 analoge inputs by using 4 input channels (ai0-ai3). 
    Each input will read 8 signals by using digital output to select.
    I try to look my result by giving constant input voltage to A/D (ai0-ai3).I use input terminal RSE, and NRSE.
    My problems are
    (1) The reading voltage are changing (some channel is increased and some channel is decreased).
    (2) The reading voltage differ from the given value.
    How should I solve these problems?
    Best regards,
    Thongchai

    Thongchai,
    In reviewing your code, I noticed that you are setting up and clearing your DAQmx tasks with every iteration of the loop, this could be causing you some problems in a couple of ways.  First, setting up and clearing the tasks takes some time, so you could be introducing delay and getting the wrong measured values as a result of this.  Second, when you clear the digital output task in the loop, the lines will return to a default state, which will likely not be the actual values you want -- this could be causing you to measure the wrong channels.  The best practice for using DAQmx tasks inside loops is to perform the setup (DAQmx Create Channel, DAQmx Timing, and DAQmx Start) and the DAQmx Clear outside the loop -- the only functions that should be inside the loop are the DAQmx Read and DAQmx Write.  Along with this, you will need to make sure you set up the timing for continuous sampling instead of finite.  Refer to the LabVIEW example finder and look at the DAQmx examples for continuous acquisition to learn more about this.
    Next, you will want to use the Measurement and Automation Explorer (MAX) to configure a task and run a test panel on the channels using a known voltage source to verify that your hardware is working properly.  If the values are measuring properly there, then the source of the error may be within the code.
    As far as your measurements themselves, it looks like you are trying to do strain measurements of some sort, these typically can be measured more accurately using differential measurements instead of RSE or NRSE.  I will include a link to a page about the differences between the measurement types and noise considerations for analog measurements.  I will also attach some references to a few documents about strain measurement methods and principles for you review.
    Finally, I would recommend looking into an alternative for this system -- either a multifunction DAQ board with more analog input capability (like a PCI-6229, 32 analog inputs), or if you are wanting more accurate strain measurements I would recommend something in our SCXI line for the best strain measurement results.
    Field Wiring Considerations for Analog Measurements:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/01f147e156a1be15862568650057df15
    Strain Measurement References:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/04bd243edda22dd386256d75007900d5
    http://zone.ni.com/devzone/conceptd.nsf/webmain/C18F65CE920C115086256D720058325B
    http://zone.ni.com/devzone/conceptd.nsf/webmain/2d5849b3108e416b86256da2007a8e7b
    Regards,
    Erik Fogleman
    Applications Engineer

Maybe you are looking for

  • HT201210 What to do when error message "Ipad server can not be contacted"

    Trying to update ipad with current ios4 software and itunes is displaying error message of itunes server can not be contacted.  How do I get around this??

  • Why two pay roll area fields in Pay roll Driver?

    Hi experts, Can some body educate me with the significance of two pay roll areas in the pay roll driver program? One field in Payroll period block and another in Selection block. Thanks in advance. RSS.

  • Iphoto 08 and book slideshow

    I have ordered a book and it arrived and looks good but I can no longer view the book in iPhoto; some pages have only half text, others have only one of three pictures. I have tried trashed the prefs but to no avail. Any ideas? GH

  • How do I remove FBI ransomware from Safari

    How do I remove FBI ransomware from Safari

  • Quality info Record for SD

    Hi all Let me know about Quality info Record for SD (QV51, QV52, QV53). I want to know whether Info record is created or not for particular customer. I have to create a alert to QM Department.  Whenever usering create a sale order, system should chec