How to use pci-6230 as position measure

Can i use the following method to realiate position measure function?
*  gpct_ex7.cpp
*  Quadrature encoding
*  Read a quadrature encoder using counter 0.  The counter is configured for X4 mode
*  The initial value is loaded into the counter from the Load A register.
*  Attach the quadrature encoder's A signal to pin 2 (PFI 39) and the B signal to
*  pin 40 (PFI 37).
*  $DateTime: 2006/07/27 23:51:45 $
#include "stdio.h"
#include "osiBus.h"
#include "tTIO.h"
void test(iBus *bus);
void initMite(iBus *bus);
int main()
 iBus* bus;
 bus = acquireBoard("PXI0::0::INSTR");
 if(bus == NULL){
  printf("Error accessing the PCI device.  Exiting.\n");
  return 1;
 //Intitialise Mite Chip.
 initMite(bus);
 //Calling test function
 test(bus);
 releaseBoard(bus);
 return 0;
//Tell the MITE to link the  BAR1 address to the DAQ Board
//You must initialize the MITE before you write to the rest of the PCI board
void initMite(iBus *bus)
  tAddressSpace  bar0;
 u32 physicalBar1;
 //Skip MITE initialization for PCMCIA boards
 //(which do not have a MITE DMA controller)
 if(!bus->get(kIsPciPxiBus,0)) return;
 bar0 = bus->createAddressSpace(kPCI_BAR0);
 //Get the physical address of the DAQ board
 physicalBar1 = bus->get(kBusAddressPhysical,kPCI_BAR1);
 //Tell the MITE to enable BAR1, where the rest of the board's registers are
 bar0.write32(0xC0, (physicalBar1 & 0xffffff00L) | 0x80);
    //bar1 = bus->createAddressSpace(kPCI_BAR1);
 bus->destroyAddressSpace(bar0);
void test(iBus *bus)
 tAddressSpace  cardSpace;
 tTIO *board;
 cardSpace = bus->createAddressSpace(kPCI_BAR1);
 board = new tTIO(cardSpace);
 //Reset
 board->G01_Joint_Reset_Register.writeG0_Reset(1);
 //Disarm
 board->G0_Command_Register.writeG0_Disarm(1);
 //load initial value of 0
 board->G0_Load_A_Registers.writeG0_Load_A(0x00000000);
 board->G0_Command_Register.writeG0_Load(1);
 //set the counting mode to quadrature encoding X4
 board->G0_Counting_Mode_Register.setG0_Encoder_Counting_Mode(3);
 board->G0_Counting_Mode_Register.writeG0_Index_Phase(3);
 //set source to the internal timebase (20 MHz)
 board->G0_Input_Select_Register.writeG0_Source_Select(0);
 //set gate
 board->G0_Input_Select_Register.writeG0_Gate_Select(2);
 board->G0_Mode_Register.writeG0_Gate_Polarity(0);
 board->G0_Mode_Register.writeG0_Gating_Mode(2);
 board->G0_Mode_Register.writeG0_Trigger_Mode_For_Edge_Gate(3);
 //set counting direction to Gate IO connector
 board->G0_Command_Register.writeG0_Up_Down(2);
 //arm counter
 printf("counter value is 0x%08lx\n",
   board->G0_Save_Registers.readRegister());
 board->G0_Command_Register.writeG0_Arm(1);
 //delay long enough for the quadrature encoder to turn a few times
  long int i,j;
  printf("waiting...\n");
  for(i=0;i<1000000;i++)
   for(j=0;j<3000;j++)
 //read counter value
 //Use this method to read the value of an armed counter
 //during non-buffered counting.  Since the value of the counter may
 //change during the read, we make sure that the value is stable.
 unsigned long counterValue1, counterValue2;
 counterValue1 = board->G0_Save_Registers.readRegister();
 counterValue2 = board->G0_Save_Registers.readRegister();
 if(counterValue1 != counterValue2)
  counterValue1 = board->G0_Save_Registers.readRegister();
 printf("counter value is now 0x%08lx\n",counterValue1);
 //Disarm
 board->G0_Command_Register.writeG0_Disarm(1);
 delete board;
 bus->destroyAddressSpace(cardSpace);
when this sentence  "board->G0_Load_A_Registers.writeG0_Load_A(0x00000000);" is excute i cannt use AO function again,can anybody tell me why? and there is another question

This used to be a problem with Excel 2003 though I thought it had been fixed with the more recent versions. I've only seen this issue when using named sets in a calculated measure and not when the set is defined within the calculated measure and that's corrected
by declaring EXISTING before the named set reference as below.
SET [Member Descendants] AS
[Calendar].[By Year - Quarter - Month].CurrentMember.CHILDREN
MEMBER [Measures].[Estimate] AS
IIF(
ISLEAF([Calendar].[By Year - Quarter - Month].currentmember),
IIF(
1=1, // Simplified for examples sake
[Measures].[Actual],
[Measures].[Budget]
SUM(
EXISTING [Member Descendants],
[Measures].[Estimate]
EXISTING will force the named set to be evaluated with the context of each cell evaluation.
Martin Mason Wordpress Blog

Similar Messages

  • How to use pci 6229 to generate a sine wave?

    Dear friends,
    I want to use pci 6229 to continuously generate a sine wave by 5000 sampling rate to output to drive a loudspeaker.
    Does any one can post an example so that I can learn from it?
    Many Thanks
    Probiee

    Dear Denis,
    Thank you for your reply. I have done with this following vi. please see the attachment.
    please give me some feedback with my vi.
    Many Thanks
    Probiee
    Attachments:
    danforum.JPG ‏119 KB

  • How to use dynamic set in calculated measure

    Hi, 
    I have this calculated measure in my cube:
    member [Measures].[Estimate]
    as 
    iif(
    isleaf([Calendar].[By Year - Quarter - Month].currentmember),
    iif(
    1=1, // Simplified for examples sake
    [Measures].[Actual],
    [Measures].[Budget]
    sum(
    [Calendar].[By Year - Quarter - Month].currentmember.children,
    [Measures].[Estimate]
    It works fine, however when the user filters on the calendar hierarchy, the totals does not seem to react. As far as I can read, this is related the use of sub cubes when filtering in Excel, and this can be fixed by using a dynamic set, but how? I am unsure
    how one would use it with this measure.
    Thanks in advance

    This used to be a problem with Excel 2003 though I thought it had been fixed with the more recent versions. I've only seen this issue when using named sets in a calculated measure and not when the set is defined within the calculated measure and that's corrected
    by declaring EXISTING before the named set reference as below.
    SET [Member Descendants] AS
    [Calendar].[By Year - Quarter - Month].CurrentMember.CHILDREN
    MEMBER [Measures].[Estimate] AS
    IIF(
    ISLEAF([Calendar].[By Year - Quarter - Month].currentmember),
    IIF(
    1=1, // Simplified for examples sake
    [Measures].[Actual],
    [Measures].[Budget]
    SUM(
    EXISTING [Member Descendants],
    [Measures].[Estimate]
    EXISTING will force the named set to be evaluated with the context of each cell evaluation.
    Martin Mason Wordpress Blog

  • How to use a photogate for frequency measurement using a NI USB-6211

    Hello, I am extremely new to LabView and am having trouble using the counter feature (or if this is even what I should be doing). I am trying to use a photogate as a frequency counter when a voltage spike is created by blocking the sensor. This will then be put into RPM and used to evaluate a small motor dyno I am creating. If anyone has any help or previous vi's they dont mind sharing it would be greatly appreciated. The photogate specifications are for an optek opb930l55. Thanks 

    Configuring a counter input task will be a little different depending on the type of DAQ card that you are using to read the digital pulses.  You just need to wire the voltage from the photogate to one of the counter pins on the card.  Then follow one of the many examples for measuring the frequency of pulses.  If your card allows it, I would suggest choosing the Counter Input >> Frequency measurement from the DAQmx Create Channel VI.  If you have questions about how to do this with your specific DAQ device, please provide more information
    Zach C.
    Field Engineer
    Greater Los Angeles

  • How to use phone (GPS?) to measure points

    Hi
    If I had my phone such as an iphone and I wanted to measure the length of something I could put it at one end of the item, click something and put it at the other end of the thing I want measured and it would tell me the length of that object.
    Is there a way I could do this using actionscript.
    I was thinking gps but it that not preside enough?
    Any Ideas
    Thanks

    If you're looking for precision then no, GPS will definitely not be enough.
    I'd suggest considering some alternatives but even those are going to be quite difficult.
    You have the method your own mouse uses which is snapping a low resolution picture of a surface as you move over it analyzing the picture to see how far you've moved frame to frame (requires some fairly sophisticated image analysis).
    Otherwise possibly some means of snapping a photo from multiple angles while analyzing them for perspective differences which can tell you distance, but isn't user friendly and won't work unless you're close to the object (a bridge far away will barely move when you do, won't work).
    Accelerometer still isn't up to snuff (you can read why in many places) but things are getting better.

  • How to use NI DLLs without installing Measurement and Automaton Explorer?

    Hi,
    I am developing an application using the NI DAQ M Series Card. The Application is being developed in VC++.
    Using the APIs provided by NI, I have a user application wrapped around it which computes the data obtained from Analog and Digital Ports.
    I used the Install Shield to create a setup for the same and linked the NI DLLS to the application. But the application exits when clicked with exception. But if I install the services of Measurement and Automaton Explorer the application works fine.
    I do not want the Measurement and Automaton installations to be done on the client PC and would like to send only the setup. Can you please let me know which all DLLs I need to include (or registry settings I need to do) to overcome this problem.
    Regs,
    Sudhi
    Honeywell Technology Solutions Lab

    Hi Sudhi-
    It sounds like you're running DAQmx calls in your application and looking for a way to avoid actually running the installer.
    This capability is not currently supported, but the option to run a silent installer and to disable specific components is always a great alternative. This KB explains how to perform a silent install with only the options you specify for your application. For instance, you may want to disable Traditional DAQ and shipping examples if you do not want to install these components seperately.
    I hope this helps!
    Thanks-
    Tom W
    National Instruments

  • How to use PCI-CAN LS (low speed can bus card) with hi speed devices

    I'm having problems connecting the low speed card to the hi speed devices: I've setup the bus with 120 ohms resistors terminating it. The devices seem to be working fine but the can card doesn´t seem to receive or send anything. It has rth and rtl of 510ohms. The card and devices are at 125kbps. I ran the card diagnostics and it passed them. Is it really possible to use this low speed card with a hi speed bus? Don't I have to do something special for it to work on hi speed bus? Any sugestion is highly appreciated! thank you

    Hello Danut,
    I was able to set up a Low Speed CAN card to talk to a High speed port on another computer( simulating a high speed device). I did not have any termination resistors on the cable. Initially, I saw the same Comm errors you mentioned and this was because the cable I was using was internally terminated. So please check that the cables are not terminated. Also , verify that the high speed device itself is not terminated ( measure the resistance between CAN_H and CAN_L, with the cable connected and without the cable).
    Let me know if you were able to get the system up and running. Also do you have any low speed devices that can be used to test teh CAN card with?

  • How to use PCI-6534 High speed DIO to count the no.of pulses aquired

    HI All
    I have PCI-6534 high speed DIO card. My requirement is to count the no.of pulses coming. Here i have an energy meter which generates pulses with frequency of around 8MHz. i need to cunt the no. of pulses coming in, here i am attaching the VI i am using. I could not really count all pulses coming in. right now i am using single line, but the requirement is to develop for 7 lines. I do not know where i am going wrong. Can any of you help me in this regards.
    Thanks
    Anil Punnam
    Attachments:
    Read Dig Chan-Change Detection_stop.vi ‏120 KB

    Sorry, not near a LV PC so can't look at your vi now.  Are you limited to using only the 6534?  If all you need to know is the count of pulses from each of the 7 ~8MHz sources, it seems like the amount of data storage required with a 6534 is terribly inefficient.  Since the 7 sources are unlikely to be synchronized in any way and they are each at ~8MHz, you're looking at about 100+ million transitions per second with change detection.  I don't think the hw can keep up with that.  Even using a constant sampling rate of 20 MHz (which just barely satisfies the Nyquist minimum of 2x 8MHz), it's questionable whether you can keep up with that rate for several minutes.  Even supposing the hw and your PCI bus and software can keep up, there's still a TON of processing to do.  20 MB/sec for 20 minutes = 24 GB! 
    On the other hand, consider the 6602 counter timer board.  Here you would simply set up 7 edge counting tasks, probably without any buffering at all.  At any leisurely pace you want, you can software query the counts of the # of pulses on each of the 7 channels and have an instant answer.  The only issue to deal with is that the counts will rollover when you reach 2**32.  At 8 MHz, this will happen about every 9 minutes.  However, DAQmx provides a nice way to handle this.  There's a property you can query that will tell you if a rollover has occurred.  It automatically resets itself to False after you read it so it's ready to detect the next rollover 9 minutes later.  See my first post in this thread for example.  (Last I knew, only DAQmx does the automatic reset, not traditional NI-DAQ).
    If you can possibly buy a 6602, I'd highly recommend it.
    -Kevin P.

  • Angular position measurement

    how to used encoders to angular position measurement of rotating shafts 
    Attachments:
    IRC305.pdf ‏303 KB

    Hi Sabry,
    what is your question? Good starting point is to open LabVIEW Example Finder and check code examples located in Hardware Input and output » DAQmx » Counter Input section. You can also try to search at NI Developer Community web. This table shows Default NI-DAQmx Counter Terminals on your C-Series module NI 9401 - http://zone.ni.com/reference/en-XX/help/370466W-01/device_pinouts/9401cdaqpinout/
    I also recommend you to read this White Paper which can give you good outlook on Encoder Measurements.
    Regads,
    Ondřej K.
    NIEE AE

  • Position Measurement with PCIe-6321

    Hi,
    I have PCIe-6321 card and I want to use it for linear position measurement. I have an interpolation device that provides A and B channels that I`m going to put in the counter inputs of the card. Are there any examples of using the position information with LabView (Graphing the position, using it for control purposes etc.) There are some examples in the example library of LabView but in most of the, PCI6321 isn´t on the compatible cards list although most PCI62xx cards are. Can I still use these examples? Thank you in advance.

    Hi
    You can try it with this examples, but there is another easy way. Please do not forget that you need at least the DAQmx 9.0 driver.
    1. Open the MAX and create a task  for your linear position measurement with the PCIe-6321
    2. There you can see all the connections you need and you can set all parameters fot the acquisition
    3. Save the Task
    4. Close MAX and open LabVIEW
    5. In the block diagram go to  Measurement I/O >> NI-DAQmx >> insert Task Const (DAQmx Task Name)
    6. Right click on the task constant and choose  >> Generate Code >> Configuration and Example
    7. Run your VI and have fun
    Kind regards
    Beat
    NI Germany

  • How to use IMPEDANCE ANALYZER to measure input $ output impedance of BJT circuit

    Am currently doing experiments by using NI ELVIS IMPEDANCE ANALYZER but am now suffering a problem on how I can connect it so as to measure input and output impedance of a BJT circuit.
    My circuit is as shown in my attachment.
    Attachments:
    ni.docx ‏46 KB

    I see that you already posted on another thread. Please refer to it here:
    http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/HOW-TO-USE-ELVIS-IMPEDANCE-ANALYZER-TO-MEASUR...
    Regards,
    Nathan S.
    Applications Engineer
    National Instruments

  • Counter using PCI-6602 for multi output

    Hi guys,
    currently I tried to control a linearmotor using PCI-6052E and PCI-6602.
    The questions is, how to use PCI-6602 to be a counter which will be converted to several output (multioutput):
    (1) converted to position >> 1count = ...[mm] --> position measurement
    (2) converted to voltage >> 1count = ...[mV] or [V] --> voltage measurement
    (3) converted to current >> 1count = ...[mA] or [A] --> current measurement
    (4) converted to velocity >> 1count = ...[mm/s] --> velocity measurement
    (5) converted to acceleration >> 1count = ...[mm/s^2] --> acceleration measurement
    (6) converted to force >> 1count = ...[N] or [kg.mm/s^2] --> force/load measurement
    (7) converted to frequency >> 1count=...[Hz] --> frequency measurement
    (i) Please assist me how to connect the driver's encoder (Ch. A A/ B B/ Z Z/) with PCI-6602, so I can get all informations above (7 measurements). What/which port of PCI-6602 connect to where from the driver.
    (ii) Please assist me how to connect the feedback signal to the PC. What/which port of PCI-6602 connect to PC.
    (iii) How to test those 7 measurements above using Measuremant and Automation Explorer (MAX) ver.4.4.1?
    Thank you for your kindly help and assistance.
    Best wishes,
    hendro

    Dear Jochen,
    (1) Principally, I'd like to use PCI-6602 to be a motion encoder also be a counter (Is it possible? Due to the manual, it is possible). I expect to have all information, such as position, time, velocity, etc. from that motion encoder (or at least the position and time). It is also expected of using PCI-6602 to do all measurements that I mentioned before . My meaning is, after having a signal from the counter, that 'count' will be converted to desire units under other programs. So, in this case, PCI-6602 is only used to get the 'count'.
    Simplified, the voltage command will send to the system (linear motor) through PCI-6052E (-10V to 10V). The actual position or other actual information will be catched (read) by using PCI-6602 (as a motion encoder, also as a counter). Then, this actual position will be used as a feedback, that will be compared to desired position.
    Is that also possible to use PCI-6602 be a motion controller + a counter + a frequency measurement in a same time parallely?
    I don't decide yet (I don't know) which acquisition rate will be needed/required, higher is better.
    (2) I'd like to apply an adaptive robust controller (yes, it is a closed loop system) under matlab with their feature called Real-Time-Workshop instead of using LV.
    (3) Power drive for the linear system will be driven by AC servo drive.
    Thanks for your help before,
    Warmly regards,
    hendro

  • Using PCI-7344 with matlab

    Dear all,
    I want to use a motion controller card NI PCI-7344 integrated into matlab R2007a (Version 7.4.0.287) to build up my system, and just want to develop several simple control methods to my system, such as PID, sliding-mode, etc using manual command, AND/OR using SIMULINK, AND/OR using xPC-target of Matlab. My problem is, this NI PCI 7344 is not supported by matlab (not compatible). Does anyone have the solution? is there anyone here can help me? How to use PCI-7344 into matlab? Thanks for your advices, kind help and attention before.
    regards,
    matlabers
    - hnd -

    Hi hendro,
    In C++ you can do this by including the nimotion.lib and FlexMS32.lib when compiling and including the neccessary *.h files at the beginning of the program. (For example, at the top of the program, you'd type #include "Flexmotn.h" if you were using the function flex_load_rpm).
    In Visual Basic you would include the line Private Declare Sub nimotion Lib "Location of dll" if you wanted to include a dll.
    You would likely need a similar command in MatLab. Unfortunately, since this is a forum for National Instruments products, I do not know what that is.  

  • Noise in thermocouple measurement using PCI-6024E DAQ card

    I am using a PCI-6024E DAQ card for thermocouple(TC) measurement. The
    TC is installed in the mold cavity of an injection molding (IM)
    machine. The leads from the TC are connected to the DAQ card using a
    CB-68LP board. I made a  temperature mesurment task in LabView 7.0
    with the two leads from TC as differential inputs and used CJC value of
    25 deg C.
    The problem is that when the IM machine is OFF, I get a reasonable temp
    reading with some slight noise but as soon as I turn ON the IM machine,
    the temp readings go wild with a lot of variations around the mean
    value. The temp values also don't go to higher values when the TC is in
    contact with the molten plastic in the IM machine.
    Do I need to ground something here or put a resistor in the I/O board?
    BTW the IM machine is grounded and the TC give correct temp values when
    connected to a hand-held temp reader.
    Any help will be highly appreciated.

    Hello  Aftab,
    Looks like you need to use bias resistors to reduce the noise. Check out the following tutorial for more information about how to use bias resistors.

  • Using a Counter(PC-TIO-10) to Perform Quadrature Encoder Buffered Position Measurement in Visual C++

    I have Driver Ni-Daq 6.9 and Using a Counter to Perform Quadrature Encoder Buffered Position Measurement in Visual C++ 6.0
    (I think Ni-Daq not support PC-TIO-10 because card not support pulg&play, you can hint me driver for support this card. ) and i want example program for read counter. i use Visual C++ for run,i don't use Measurement Studio.

    NI-DAQ 6.9 supports the PC-TIO-10.
    I attached an example that will show you how to do it in CVI (ANSI C).
    Attachments:
    Cviencod.zip ‏19 KB

Maybe you are looking for

  • Report for list of good receipt document against advance document

    Dear all, Good Morning. I want list of pending purchase order in which advace document is created but good receipt document is not created. Like. I have create one purchase order & also create down payment request with F-47. Payment also done by f-48

  • Font size on g mail page became 4x larger, how do i reduce it back to normal?

    G Mail screen - suddenly enlarged to circa 4 x normal size. Frames resized. Fonts 4 x larger than normal. How do I return the screen to normal size. I can find no means of achieveing thei.

  • What are nested Internal tables

    Hi Guru's, I am new to ABAP ...just trying to learn things.Can you please explain me what are nested internal tables and what is the purpose of nested internal table?where can it be used and why a header line is not written in a Nested Internal table

  • WS-* support

    I was wondering, what the support is on WS-* standards in the various JBI components? I have tried to use WS-Addressing combined with the XSLT SE and HTTP BC for message transformation, but I can't seem to get WS-Addressing to work good. Using glassf

  • I need help centering a div!

    Hi! So i'm attempting to set up all the body content in my website so that it is always in the center of my webpage dispite the size of the browser. I had it going fine for a while, but then something happened and I lost it. What did I do wrong? Help