Encoders Scorbot

Estimados,
Tengo el siguiente problema. Estoy trabajando con un robot SCORBOT ER-III, acondicionado con un PAC CompacRIO.
Resulta que necesito guardar las señales de los enconders que me arroja el robot en un arreglo para después poder
exportarlos a algún documento (Excel por ejemplo) donde las pueda graficar y ver si las señales son coherentes. Las señales las recibo
de 1 y 0, pero aun no logro poder guardarlas.
Las señales del Encoder, segun unas pruebas realizadas, tienen una frecuencia de aproximadamente 50 [hz] por lo tanto necesito una
frecuencia de muestreo de 10 veces esta frecuencia, ósea 500[hz] o 2 milisegundos.
Estoy trabajando con LabVIEW 8.5.
Esa es mi duda, las gracias de antemano.
Jorge

Hola,
Si he entendido bien tu duda es como se puede grabar en un archivo los datos del codificador. Usted puede utilizar las funciones de file I/O guardar datos en un archivo txt.
If I understand your doubt is how you can record in a file your encoder data. You can use the file I/O functions to save data in txt file.
Saludos,
Abel
NI Brazil
Abel Souza
Engenheiro de Aplicações
National Instruments Brasil

Similar Messages

  • How to wire VI for 2 encoders using NI9401

    I have the attached vi that measures period.  My understanding is that the NI 9401 can measure period for up to 4 encoders at once.  Do I need one DAQ sequence per encoder, (e.g. the attached vi should measure period for 2 encoders simultaneously)?  I want to run up to 16 encoders, so, do I need to copy/paste this code 16 times in order to collect period data for 16 encoders simultaneously?
    I am using cDAQ9174 and NI 9401.  My understanding is that the 9401 can measure up to 4 encoder signals.  If I put a second NI 9401 into the cDAQ9174, can I measure 8, or does the cDAQ9174 limit the number of counters that can be accessed independently?  If I have to use two cDAQ9174's, plugged into one PC, does Labview recognize the eight slots as unique, e.g. 1-8, instead of two sets of 1-4 for the addressing of the channels? 
    Any generic advice on measuring many encoders (period) simultaneously is welcome.
    Thanks,
    Dave
    Solved!
    Go to Solution.
    Attachments:
    counter forum feb 13 2013.vi ‏31 KB

    -          Even if you put two NI 9401 into the cDAQ-9174, remember that the counters are in the chassis and this device just has four counters.
    -          You can run counter tasks in parallel.
    -          If you plug two cDAQ-9174, MAX recognizes two different devices.
    Regards

  • Huge latency reading quadrature encoders

    I'm using a PCI-6601 to read two quadrature encoders on a pan-tilt mechanism. The software uses the DAQmx C interface and polls the encoder positions at 200Hz. The problem is that there appears to be a huge latency on the order of ~50msec between when the encoders move and when the positions being read out reflect the movement. That can't be normal.... is it?
    I am able to get data off the DAQ at the 200Hz rate, and the values all look reasonable except that they're time delayed by the aforementioned 50ms. So I'm getting a resolution of at least 5ms, just time-shifted. The first thought was that the values were being buffered somehow, but there doesn't appear to be any buffer, at least that I can find. As I understand it quadrature input shouldn't be being buffered in the first place, and in any case a buffer should be read out with the call to DAQmxReadCounterF64 (the DAQ returns only 1 value), and indeed explicitly setting the input buffer via DAQmxCfgInputBuffer does nothing. 
    To double check the results I tested NI's sample code for reading quadrature encoders (http://zone.ni.com/devzone/cda/epd/p/id/5735) and I get the same latency (minus the ~5ms that was caused by the 200Hz timer, as the sample code polls in a tight loop.)
    Any idea of what might be going on here?
    Thanks!
    Gene

    Hi Gene,
    I just wanted to make sure you were indeed using DAQmx (since you linked the DAQmx Base example).  I might expect the DAQmx Base version of the code to take longer to execute, but re-reading your post it sounds like the problem isn't with the code keeping up but rather that the values themselves are delayed by ~50 ms.
    A buffer would only be allocated if you configure sample clock timing on your encoder task.  The example you linked doesn't do this, so I'll assume your code doesn't either.  It's probably worth noting that you can configure a hardware-timed sample clock so you can deterministically sample the count register at regular intervals, but this isn't going to help with latency.
    So taking a step back for a moment, I am now curious on how you are measuring the 50 ms latency.  To verify a 50 ms delay would require measuring the actual time difference between the start of the counter task and the first pulse of the encoder and then comparing the measured time with the time you are seeing in software (assuming ~5 ms per sample from your 200 Hz polling loop).  I would not expect a 50 ms latency in your measurement, so it's probably worth elaborating on exactly what you are seeing and how you are characterizing it.
    Best Regards,
    John Passiak

  • Configuring Encoders Counts per Revolution using a flexmotion function

    Hello,
    I am having a problem configuring a connected encoder in labview using the flexmotion function.
    The setting:
    I am building a labview vi I want to run on a computer with the connected hardware. But I may NOT have access to the machine to configure it with the "Measurement and Automation Explorer". The hardware may vary too, thus I have to detect and then configure it. I want my VI to set all necessary parameters before I start moving the hardware. I am pretty much done with this.
    The problem:
    I cannot find a way to configure the 'Encoder Counts per Revolution' as shown in picture 2. There is no function in the Motion menu as shown in picture 1. There does not seem to be a function in the FlexMotion32 library (shown in picture 3) to do this either.
    I read through the FlexMotion Software Reference Manual (http://www.ni.com/pdf/manuals/321943b.pdf) and tried to find an answer in multiple forums but was unsuccessful.
    The question:
    Does anyone have an idea about a function in the FlexMotion32.dll that I could not find? Or any other way to configure the encoders within LabView?
    I appreciate any ideas and thank you for taking your time reading this.
    Best,
    Frank.
    Attachments:
    Motion config 1.JPG ‏31 KB
    Motion config 2.JPG ‏75 KB
    Motion config 3.JPG ‏86 KB

    See attachment.
    Attachments:
    Encoder Counts.JPG ‏71 KB

  • 2 encoders 1 DAQ sync via rtsi for ellipsometer

    Hey, this is my first big project. I need to program an algorithm to find a null in light intensity by crossing two polarizers. I rotate the polarizers with flexmotion and need to syncronize encoder positions to AI over an E series board. Both encoders may move back and forth a few times before I find the null. I would like to have voltage, and two encoder positions syncronized into an array. Any recommendations?
    How should I begin to test my rtsi cable setup?

    I have found that the best way to do this is to use a 660x witht he encoders and use the e-series for the AI. Then set the encoders up for buffered position measurement. Buffered position measurment latches the value of the count everytime a pulse is recieved on the gate pin.
    This is really nice, because you can route your AI scan clock to one of the RTSI lines and then set the Gate for each counter to that RTSI line. This way everytime you scan an analog input you will get the value of both counters. In addition, the counters will be sampled at a percise time so that you can measure things like speed and acceleration.
    I am not sure what programming language you are using, but you can combine some of the LV shipping examples like ContAcq&Graph wit
    h the buffered position measurement. All you need to add is the route signal.Vi to route the scan clock to the RTSI line. I will include an example in VB.
    I hope this helps.
    Joshua
    Attachments:
    AIwBufferedEventCounting.zip ‏6 KB

  • Velocity measurement from low resolution encoders

    Hi, I have 1024 pulse/1rotation encoders. I want to calculate or estimate angular velocity from this low resolution encoders. When I use dx/dt(derivative.vi)  there are high and low readings which obviously seem wrong to me.I want to have a more smooth and accurate reading(and without much delay). Is there an efficient and accurate way of reading velocity measurements from this low resolution encoders? FOr example does Ni/Motion help? Or is there a velocity measurement .vi ?
    Thank you.

    As far as I remember (*) , the FP-QUAD will measure the velocity by counts during a fixed time slot. The maximum time is (was?) 26.??ms.
    Your resolver has 1024 pulses (I assume 2 pulse streams with 90° shift) , the QUAD will count pulse edges, so you get 4096 counts per revolution. Together with the integration time (26.??ms), you get a resolution of 38.15 counts/s (See manual of the FP-QUAD) or an error of +/- 0.559 RPM
    Of course you can read the 32bit counter of the QUAD in a user defined time periode and calculate the velocity.
    If you have real slow movements, you can measure the time between each pulse. The accuracy will depend on the quality of your resolver and the resolution of your timer, however I think this couldn't be done with the FP-QUAD.
    * My last task with FP-QUAD was 4 years ago, maybe new firmware and driver give you more choices now
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • Seeking Information on PE4 Encoding and Encoders.

    Hi.  I have spent several hours looking at forums and manuals trying to learn how to better use my stuff.  I have several questions which I have not found answers too.  If some folks could help answer some or all, it would be appreciated.
      I have several applications on my PC which have the ability to make a DVD.  They Are Arcsoft Showbiz; Arcsoft Total Media 3; ATI Catalyst Media Center and Premier Elements 4.  Can PE4 get confused and grab one of the other program's encoding programs instead of using its own.  I am assuming that PE4 has the better encoding program and hope I am using it.  I used G-Spot to see all of my "Video Codec and filters".  The only ones which showed up which were associated with Adobe were these.
    DSH    MPEG1Packet    MainConcept (Adobe2) MPEG Video Decoder    ad2mcdsmpeg.ax
    DSH    MPEG1System    MainConcept (Adobe2) MPEG Splitter    ad2mcspmpeg.ax
    -  Does that sound right?
    My video files are SD 4:3.   Using GSpot, I found out the following.
    One of my Sony DCR-TRV280 .avi files had an average bit rate of 22589 kb/sec  &  2.786 bits-pixel/frame (GSpot Quality measurement)
    One of my Sony DCR-SR220 MPEG-2 files had an average bit rate of 9100 kb/sec  &  0.879 bits-pixel/frame (GSpot Quality measurement)
    Both files, when turned into DVD by PE4 at the maximum 8MB/s setting had an average bit rat of 8813 kb/sec  &  0.851 bits-pixel/frame (GSpot Quality measurement)  The DVD size was less than 1GB.
    - The encoder used by PE4 seems to hit it's limit at 8813 kb/sec.  Is this a limitation of the encoder, or a standard set by DVD-Video?
    - If there is no defined standard bit rate upper limit for DVD-Video, are there better encoders out there which go above the PE4 8813 kb/sec capability?
    - If there are better encoders, can a person buy one and plug it into PE4 -or- export an edited file out of PE4 and have this higher level encoder convert the file?
    - I have a DVD of a youth football game made by another dad.  His camcorder was one of the best about 3 years ago and the DVD looks way better than what my camcorder can do.  GSpot says his DVD has a average bit rate of 8000 kb/sec  &  0.772 bits-pixel/frame (GSpot Quality measurement).  My DVD files have higher bit rate and bits-pixel/frame measurements than his, but his looks way better.  If the standard definition screen is 720x480 pixels, then there are a total of 345,600 pixels in a frame?  If my DCR-SR220 has 1,120,000 actual pixels at 4:3, then my camcorder should be well above the 345,600 pixels in a SD 720x480 frame?  I am sure there is more to it than this and that is what I am trying to find out.
    If anybody can enlighten me I would appreciate it.

    Kurvah,
    The DVD specs limit one to 9.8kbps bit-rate, for a combined Audio & Video. You cannot exceed that to have a fully in-spec. file. This is for the absolute high "spikes," in the encoding process.
    Depending on one's Audio bit-rate, something in the range of 8kbps is near the top. Now, there are some other considerations:
    1.) some folk have problems with set-top players not handling anything above 7, all that well.
    2.) Robert Johnson tested PE and found the ultimate quality setting was somewhere around 7.8, IIRC. Most of his finding appear in articles on Muvipix..
    There are better encoders, and Hollywood uses these. Some allow up to 20 passes to squeeze the maximum out of each file. These, however, cost upward to the GNP of many small countries, and the folk, who run them have many years of experience at that level. They do nothing but transcodes day in, and day out.
    PE is likely to not have problems with other applications on your computer, so long as none overwrites the Adobe Main Concept CODEC (no guarantees with any other application). Only hang up can be with applications, that contain packet-writing modules, that seize control of one's burner(s). Adobe programs want 100% control of these, and usually throw errors, or just cannot find the burners, if one has something like Nero's InCD, or Roxio's DLA. These should not be installed (the packet-writing module).
    Unfortunately, I cannot directly comment on PE's encoding, as I use Adobe Encore for all of my Transcoding, and usually use it to Burn the DVD's.
    As far as the quality of a similar bit of video, there are two main things to consider: the optics and the sensors, with different cameras. It is likely not an issue of the bit-rate of the two files, but the cameras, that produced the footage.
    Hunt

  • Wrong results using quadrature encoders with NI DAQCard-6036E

         Hello,
    I'm experiencing some troubles using two quadrature encoders with a NI multifunction I/O.
    The encoders are Micro-Epsilon WDS-7500-P115-CR-TTL. They are incremental encoders in TTL logic. They are connected to a HP laptop running Windows XP Professional. The connection is via the multifunction I/O NI DAQCard-6036E. Each encoder is connected to the DAQ board with four wires: +5V, DGND, track A, track B. I used the system in my office for a while and everything was fine. Then I moved it in another place and now it shows a fuzzy behaviour.
    I made the following tests:
    Test 1) I connect track A&B to analog inputs on the DAQ card. Then I use SignalExpress v2.5 to perform a DAQmx analog input acquisition. The waveforms I get are exactly as expected.
    Test 2) I connect track A to the counter source and I leave track B disconnected. I use SignalExpress v2.5 to set a DAQmx edge counter, with the "Count up" option enabled. Also this test is fine. When I pull the encoder cable I get +N counts and when I release the cable it goes back to zero position, giving other +N counts.
    Test 3) I connect track A to the counter source and track B to P0.6 (or P0.7 for the second encoder), which is the pin used to control the count direction. I use SignalExpress v2.5 to set a DAQmx edge counter, with "Count up". In this way the DAQ should ignore track B and count always up. Actually it does, but the count rate in one direction is double with respect to the count rate in the other direction. This means that when I pull the encoder cable I get +N counts and when I put it back to initial position I get other +2N counts. In this way the counter indicates +3N at the end, while it should be +2N.
    Test 4) I connect track A to the counter source and track B to P0.6 (or P0.7 for the second encoder). I use SignalExpress v2.5 to set an "Externally controlled" DAQmx edge counter. Now I get +N counts when I pull the encoder and -2N counts when I put it back to zero position. In this way the counter indicates -N  at the end, while it should be zero.
    Test 5) I repeat test 4 using LabWindows/CVI v8.1 and I get the same result.
    Test 6) I swap lines A&B. Now track B is connected to the counter source and track A goes to P0.6 (or P0.7 for the second encoder). Using SignalExpress to perform an "External controlled" count, I get +2N counts when I pull the encoder and -N counts when I put it back to zero. So, at the end the counter indicates +N, but it should be zero.
    Do you have any idea on how to solve the problem? Thank you very much in advance.

    A few things:
    1. I'm not from NI and won't try to speak for them.  But I don't believe these forums are meant as a primary means of support, probably not an *official* means of support at all.  Most of the folks here (like me) are NI's more-or-less satisfied customers, not employees.   If you buy a service contract, you can get instant phone support.  If you rely on free support from the forums, I think you'll get good help most of the time, but there's just no guarantee. 
    2. "I just got a [email] reply from MicroEpsilon.  The encoders work fine."   Um.  Based on what, exactly?  Of *course* they will expect their own stuff to be just fine, and in fact I very much suspect they're right.  But NI will expect their board to be just fine, and I expect they're right too.  Or at least it was fine *before* you hooked things up.  Leading us to #3.
    3.  Part of the app note on Quad Encoders on E-series boards warns against connecting differential encoder outputs directly to your board.  I think it mentions that a 24V differential (for example) can damage the board.  But even a low-voltage differential signal isn't electrically *compatible* with your counter inputs.  Your first posting claimed that the encoders produced TTL.  Your June 30 post referred to inverted A and B signals for rejecting common mode noise over long transmission lines.  These are classic code words that scream "differential output", *not* TTL.  So now we can start addressing some specific tech issues.
    4. Your E-series board is not inherently capable of handling true quadrature, as the app note says.  (The newer M-series multifunction boards *do* have the capability.)  You can get kinda sorta close, but you'll be at risk of count errors due to direction changes or during vibrations when otherwise stationary.
    5. You will also need some type of differential to TTL conversion on your (A, /A) and (B, /B) pairs.
    6. You will need a common "ground" reference for all your digital signals (probably not a true earth ground).  So the ground for your conversion circuit and its TTL outputs must be tied to your DAQ board digital ground.  Also the return terminal from any related external power supply.  Sounds like failure to do this had been an issue with a past implementation of yours so perhaps it's an additional factor at play this time too?
    7.  What are you trying to measure?  For what purpose?  What decision is made from the data?  How much do you care about its accuracy?  These are leading questions, but I'm suggesting that meeting schedule with an unreliable app that produces untrustworthy data just might not be the best goal to strive for right now.  If you care to maintain accurate position count despite direction changes or vibrations, you *need* something more than your E-series board.  If you want reliable edge counting operation with *any* DAQ board, you *need* electrically compatible signals.
    -Kevin P.

  • Error in java code for controlling scorbot

    Hello,
    I work with the educatonal model robot scorbot er III and recently found an interface written in java for controlling it. When executing the code as "java Remote" in my Windows Xp operational system, I receive the foolowing error
    Exception in thread "main" java.lang.NullPointerException: Canvas3D: null GraphicsConfiguration
    at javax.media.j3d.Canvas3D.checkForValidGraphicsConfig(Canvas3D.java:954)
    at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:997)
    at RemoteCanvas3D.<init>(RemoteCanvas3D.java:50)
    at Remote.<init>(Remote.java:371)
    at Remote.main(Remote.java:282)
    Since I am not very familiar with Java, could anyone explain me how to get over this problem?
    Thank you in advance
    Theodoros

    I had this same error in a 3D game I was making.
    The code needs something like this when initializing the Canvas3D, most likely in a constructor.
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    Canvas3D canvas3D = new Canvas3D(config);
    hope that helps

  • Can I (and if so, how would I) connect two encoders (one linear and one angular) to the same chassis (NI 9401) and get their respective NI MAX tasks to run as simultaneously as possible?

    Sorry, but I am still rather new to LabVIEW and NI MAX. I connected both devices (a linear probe and an angular encoder) to my NI 9401 chassis. I figured out how to create tasks for each and get continous samples readings from each. When trying to run both in LabVIEW, I get the error saying that I cannot run multiple tasks at once. It suggests the Control Task VI, but I did not see any help in that. Any advice?
    Here is some general information, whatever it is worth: Both encoders are operating off of the same clock source, PFI4, which to my knowledge corresponds to CTR 1 A, where the angular encoder's A signal is wired in. The linear's physical channel is ctr0 and the angular's is ctr1.
    Thank you very much for taking the time to look at this and help me out!
    Solved!
    Go to Solution.

    So if I go the Edge Counter route, is there any way for the task to figure out direction of the encoders? It looks like my options are always counting up or always counting down whenever the encoder is read... For my application, I need it to read when the linear encoder goes in and when it goes out... Am I doing something incorrectly with it?
    I am using a probe to measure the contour of a part, and using a motor to spin the part, with one encoder measuring the angle of the motor and the other measuring the displacement of the probe.
    Also I am still not seeing a way to simultaneously read both devices in NI MAX... I cannot use two counter inputs from the same device at once in the same task it seems.

  • Adding image encoders in 1.4?

    I've started using the ImageIO API in Java 1.4 to write images to files (in jpg and png formats)...I'd like to be able to save files as gifs, bmps and tifs as well...In the documentation and elsewhere, I've read that you can plug in your own encoders to be able to save in other formats...Can anyone tell me how to go about doing this?

    Anybody done any work with this yet?
    I have encoders that extend ImageWriter, and I have an ImageWriterSpi for each format that I register with the IIORegistry...During runtime, it finds the right encoder through the IIORegistry, but when I try to save the image it doesn't go into my encoder's write(RenderedImage img) method, and, thus, doesn't call the encoders other methods needed to encode the image...
    Anybody have any suggestions?

  • Encoders for analog camera

    hi experts should i use encoder (CIVS-SG1BECOD-FE
    )to connect analog camera with my existing surveillance media server, or should i use decoder (CIVS-SG1BDCOD-FE
    )to analog camera with my exiisting ip surveillance media server network.

    You can use encoder for analog camera. Camera feeds originate from both IP-based and analog cameras attached to stand-alone encoders or analog gateways.
    http://www.cisco.com/en/US/prod/collateral/vpndevc/ps6918/ps6921/ps6936/product_data_sheet0900aecd804a3e6d.html

  • Measure Angular Position using quadrature encoders

    Hi I’m new to LabView and NI and would like to know whether the angular position, measured using two quadrature encoders can be measured (and interfaced with LabView) using the following National Instruments hardware:
    NI cRIO-9014 (CompactRIO Real-Time Controller)
    NI-9403
    NI-9215
    NI-9263
    If it can be done I would really appreciate some pointers or suggestions of how to start either setting the hardware up or writing the LabView program.
    Many Thanks
    Alex

    Hi Alex
    Welcome to the world of LabVIEW and NI. You're off to a great start with the hardware and software that you already have. It sounds like you just need a bit of extra knowledge to get you started. A great place to look for help is in the LabVIEW  Find Examples.. This can be found on the LabVIEW splash screen pictured in the attached image.
    For your specific set up I would also suggest navigating to the following links:
    NI CompactRIO Starter Kit and Hardware Setup Wizard Frequently Asked Questions (FAQ)
    It may well be an idea for you to attend one of our customer education courses which would really give you a headstart in your application. Information regarding this can be found here:
    LabVIEW Real-Time training
    I hope this information is of some help to get you started.
    Kind regards,
    Daniel T
    Applications Engineer
    National Instruments UK & Ireland
    Attachments:
    Find examples.PNG ‏253 KB

  • Error -10401 appears when I try to read in my Encoders (TTL-Signa​l) via a LabView-"n​uDrive 2SX-411" and Motion Controller Card

    Hy there.
    Im using two "Haidenhain ERN 420" Encoders with TTL-Output Signal
    A NI-Motion Controller 7334 with an NI-"nuDrive 2SX-411"
    When I try to Read the Encoders Position (with ex.-Programm/Source) the Message: "Error -10401 occurred at AI Group Config ... the specified device is not a NI-product" appears
    Can anybody help me to initiallize/Use the Encoders in Labview 6.01?
    thanks, phil.

    Phil,
    It looks to me according to the error that you were trying to use DAQ functions to access the Motion controller. The Motion controller uses its own functions. There are two for reading position:
    Functions Palette >> Motion & Vision >> Flexmotion >> Trajectory Control >> Read Position.
    Functions Palette >> Motion & Vision >> Flexmotion >> Analog & Digital I/O >> Read Encoder Position.
    You may find a useful example in:
    C:\Program Files\National Instruments\LabVIEW 6.1\examples\Motion\FlexMotion\One Axis.llb\One Axis Move with Position Monitor.vi
    Make sure that you have configured and initialized your board properly in MAX.
    I would suggest that you post your question on the Motion Control section and not in the LabVIEW section. Also, check the Dev
    elopment Library section of the NI Developer Zone for the Motion Control section with tutorials and example code.
    Good luck!
    Nestor.
    Nestor
    National Instruments

  • Genral How do I get syncronize​d encoders to work with a PCI-6602

    I am new to the DAQmx and need some general help writting VB code that works.
    I can get some things to work, but others don't work at all and I don't have enough knowledge of these drivers to get up the learnign curve hump.
    I wanted to post this as a follow-up
    to the thread:
    http://forums.ni.com/ni/board/message?board.id=40&​message.id=5430&query.id=215100#M5430
    But I couldn’t figure out how.  
    Anyway, my problem is that I will
    eventually have to do much the same thing as the above thread with two encoders in
    sync.
    I have a pci-6602 card, and my code
    snippet is at the bottom  The 6602 doesn't have the analog in to syncronize to like the thread above
      (yes, it is in Visual basic
    6)
    I can’t figure out the
    DAQmxCfgSampClkTiming.   Why do I want to have a sample clock at all?   (okay,
    when I have two channels synced I do – but this sample I want to get working and
    I don’t see why)?
    Can’t I just get a new counter value
    with each quadrature input change?   (That’s what the DEV/PFI39 is, the same as
    encoder channel A )
    Okay, so hopefully you tell me how
    to get that to work.
    Next question:  What can I use for
    the DAQmxCfgSampClkTiming when I am doing two channels in sync?  Nothing seems
    to work, and I have tried a bunch of things.
    Brynn
    Rogers
    DeltaTech
    Controls
    952-403-7400
    x431
    //// code that doesn't really work.   "Dev1/PFI39" is the channel A encoder input, I just want new data whenever the encoder changes (for now)
        ' DAQmx Configure
    Code
        DAQmxErrChk
    DAQmxCreateTask("count", TaskHandle)
        TaskIsRunning =
    True
        DAQmxErrChk
    DAQmxCreateCIAngEncoderChan(TaskHandle, "Dev1/ctr0", "",
    DAQmx_Val_EncoderType2_X4, 0, 0#, DAQmx_Val_EncoderZIndexPhase1_AHighBHigh,
    DAQmx_Val_AngleUnits2_Ticks, 500, 0#, "")
        DAQmxErrChk
    DAQmxCfgSampClkTiming(TaskHandle, "Dev1/PFI39", 1, DAQmx_Val_Rising,
    DAQmx_Val_AcquisitionType_FiniteSamps, samples)
        'DAQmx Start
    Code
        DAQmxErrChk
    DAQmxStartTask(TaskHandle)
        ' DAQmx Read
    Code
        DAQmxErrChk
    DAQmxReadCounterF64(TaskHandle, -1, 0.05 * samples, data(0), samples, ReadCount,
    ByVal 0&)
        ' All done!
    StopTask
        'DAQmxErrChk
    DAQmxStopTask(TaskHandle)
        'Stop task isn't needed because
    Clear Task also stops task
        DAQmxErrChk
    DAQmxClearTask(TaskHandle)
    Solved!
    Go to Solution.

    Okay,   Here is the working routine to get syncronous data from two encoders, and it seems to work okay.
       I have this working with my two 2000 CPR encoders, we'll see how it works when I get the 500,000 CPR encoders later.
    The three big problems that caused it to not work were:  
    1)   Theduty cycle argument for the createCOpulsechanfreq task needed to be between 0 and 1.  I had '50.0' before, it works when it is '0.5'
    2)   The sample timebase that I used (ctr7) needed to be started before either of my two angle encoder tasks were created
    3)   The "dev/PFI8" string needed to be changed to "/dev/PFI8".   I don't really understand why, but that was what seemed to fix it all.
    So this question has been answered...      Now I have a different problem while reading 8 PWM values at once with the Semiperiodcounter,  which I will post in a new a different thread.
    Thanks!
    ''''''''''''''''''   Working code here
    Public Sub Aquireposition(samples As Long, data0() As Double, data1() As Double)
    Dim BaseTaskHandle    As Long
    Dim encoder0TaskHandle    As Long
    Dim encoder1TaskHandle    As Long
    Dim TaskIsRunning As Boolean
    Dim ReadCount As Long
    Dim strCounterString As String
       On Error GoTo ErrorHandler
        DAQmxErrChk DAQmxCreateTask("base", BaseTaskHandle)
        DAQmxErrChk DAQmxCreateCOPulseChanFreq(BaseTaskHandle, "/Dev1/ctr7", "base", DAQmx_Val_FrequencyUnits2_Hz, DAQmx_Val_Level1_Low, 0#, 200#, 0.5)
    'Specify continuous timing
        DAQmxErrChk DAQmxCfgImplicitTiming(BaseTaskHandle, DAQmx_Val_AcquisitionType_ContSamps, 200)
         'DAQmx Start Code
        DAQmxErrChk DAQmxStartTask(BaseTaskHandle)
    ' DAQmx Configure Code
        DAQmxErrChk DAQmxCreateTask("encoder", encoder0TaskHandle)
        TaskIsRunning = True
        DAQmxErrChk DAQmxCreateCIAngEncoderChan(encoder0TaskHandle, "/Dev1/ctr0", "", DAQmx_Val_EncoderType2_X4, 0, 0#, DAQmx_Val_EncoderZIndexPhase1_AHighBHigh, DAQmx_Val_AngleUnits2_Degrees, 500, 0#, "")
        DAQmxErrChk DAQmxCfgSampClkTiming(encoder0TaskHandle, "/Dev1/PFI8", 1, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_FiniteSamps, samples)
        ' second encoder
        DAQmxErrChk DAQmxCreateTask("encoder1", encoder1TaskHandle)
        TaskIsRunning = True
        DAQmxErrChk DAQmxCreateCIAngEncoderChan(encoder1TaskHandle, "/Dev1/ctr1", "", DAQmx_Val_EncoderType2_X4, 0, 0#, DAQmx_Val_EncoderZIndexPhase1_AHighBHigh, DAQmx_Val_AngleUnits2_Degrees, 500, 0#, "")
        DAQmxErrChk DAQmxCfgSampClkTiming(encoder1TaskHandle, "/Dev1/PFI8", 1, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_FiniteSamps, samples)
        'DAQmx Start Code
        DAQmxErrChk DAQmxStartTask(encoder0TaskHandle)
        DAQmxErrChk DAQmxStartTask(encoder1TaskHandle)
        ' DAQmx Read Code
        DAQmxErrChk DAQmxReadCounterF64(encoder0TaskHandle, -1, 0.05 * samples, data0(0), samples, ReadCount, ByVal 0&)
        DAQmxErrChk DAQmxReadCounterF64(encoder1TaskHandle, -1, 0.05 * samples, data1(0), samples, ReadCount, ByVal 0&)
        ' All done! StopTask
        'DAQmxErrChk DAQmxStopTask(TaskHandle)
        'Stop task isn't needed because Clear Task also stops task
        DAQmxErrChk DAQmxClearTask(encoder0TaskHandle)
        DAQmxErrChk DAQmxClearTask(encoder1TaskHandle)
        DAQmxErrChk DAQmxClearTask(BaseTaskHandle)
        Exit Sub
    ErrorHandler:
    '   MsgBox "Error: " & Err.Number & " " & Err.Description, , "Error"
    '    mlngPWM_ErrorCount(lngChannel) = mlngPWM_ErrorCount(lngChannel) + 1
        'MainForm.PWMErrorCount = "Errors(" & lngChannel & "): " & mlngPWM_ErrorCount(lngChannel)
        Resume Next
    End Sub

Maybe you are looking for

  • I need to move 1000 photos from one library to another. How do I do that and keep the ratings and dates they were created?

    I need to move 1000 photos from one library to another. How do I do that and keep the ratings and dates they were created? I tried exporting them, but it loses all info. Also, how do I move the quicktime movies from one iphoto library to another? The

  • String index out of range: -1

    I am making a program which takes screenshots and uploads them to imageshack.us, I have got the following code. import java.awt.image.BufferedImage; import java.awt.*; import java.io.*; import java.net.*; import javax.imageio.ImageIO; public class Sc

  • Inter-VRF Route leakage

    Hi Guyz, I have 3 VRF's on VSS core. 1) VRF A 2) VRF B 3) Global VRF. I have Firewall in L3 mode between these VRFs. Traffic between A & B have to cross firewall.  i can use BGP or EVN to leak routes between VRFs,  but they leak only routes tht are p

  • Automatic conversion from XDP file fo PDF file

    Hello! I have an application that creates an XDP file with a certain report. I can open the XDP file in Designer 7.0 and then save it as PDF, but I would like to know, how can I automatically produce PDF file from XDP file. Is it possible? Thanks for

  • I need to run internet explorer how do i begin?

    i have been fooling around trying to get this military website to work properly with no luck. after contact the help line for the website they told me it is only compatible with internet explorer. researching boot camp i purchased an external hardriv