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

Similar Messages

  • I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio

    I purchased Adobe Acrobat x Pro recently and installed it, I have compatibility issues vision 2013. The adobe pdf converter  plug in stays inactive despite all my efforts to activate it, I need help with this? How can i get the plug in to work with Visio 2013?

    For MS Visio (any version) only the appropriate version of Acrobat *PRO* provides PDFMaker for Visio.
    For Visio 2013 specifically you must have Acrobat XI Pro (updated to at least 11.0.1).
    See: 
    http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html  
    Be well...

  • How to i get an itrack solo to work with pro audio x?

    how to i get an itrack solo to work with pro audio x?

    Long shot perhaps, but...
    how about...
    following  instructions in  manuals?
    http://help.apple.com/logicpro/mac/10/#lgcpebe92ce0

  • How do I get my mms text to work with net10? Cellular data network is not visible on my iPhone 4.

    How do I get my mms text to work with net10? Cellular data network is not visible on my iPhone 4.

    After hours restoring phone and resetting all my accounts and settings the Bluetooth is back on. Not sure how long this will last. In regards to AirPlay taking over, I had to drive far enough from our wifi signal to allow the Bluetooth to take back the audio. Its working for now.

  • How do I get my Jawbone Era to work with my Ipad 2

    How do I get my Jawbone Era to work with my Ipad 2?  The Ipad shows the Jawbone as synced, however, when I play a video it does not play through the Jawbone, only the Ipad speaker.

    You need to pair the iPad with the bluetooth keyboard. I don't understand how you could have used it even once without doing this process (unless whoever sold the iPad and keyboard to you did this for you?) but perhaps it has somehow become unpaired. There should be instructions with the bluetooth keyboard on how to pair it with an iOS device like your iPad, but the general process is pretty straightforward as described here:
    iOS: Third-party Bluetooth accessories
    If you can't find the pairing instructions/user guide that came with the keyboard then look on the manufacturer's website, they'll almost certainly have downloadable User Guides containing the info on pairing.

  • How do i get my ipad 2 to work with another micro sim

    how do i get my ipad 2 to work with another micro sim

    Follow the instructions here >  iOS: Syncing with iTunes

  • How do I get the new iPod to work with iTunes

    I recently purchased a new iPod--I think it's the "Shuffle," whichever one retails for $150. When I plugged it into my iMac, it said I needed to install iTunes 10 to run it. When I checked for updates, it said that iTunes 9.xyz (whatever came after the 9) was the latest version.
    How do I get this new iPod to work. As you can tell, I am not much of a gadget junkie, and I'm a bit of a technology incompetent, which is why I purchased the Mac to begin with. I have an iMac, have no idea what operating system I am using--whatever came with it when I purchased it in November, 2008.
    TIA!

    Okay, I just looked and I do have 10.411. How do I upgrade to get the new iPod to work, and how much does the new operating system cost?

  • How do I get my i phone to work with my security camera  while on vacation, I have a wansview NCB547W

    I cannot seem to get my WANSVIEW NCB541W to work with my I phone.

    Hello JaeRoc48,
    I understand that the sound is not working.
    Go to start.
    Type Sound.
    Select sound.
    Select speakers as default.
    Click OK.
    Let me know how everything goes.

  • How do I get Photoshop CS2 to resume working with Lion upgrade?

    How do I get Photoshop CS2 to resume working now that I have installed Lion upgrade?
    Can I uninstall Lion and get back to a working system?

    RoaringApps Mac OS X Lion Application Compatibility
    Lion App Compatibility Table - RoaringApps
    Using Cloning as a Backup Strategy
    Clone X 4.0
    Carbon Copy Cloner 3.4.1
    How to prepare your Mac for OS X 10.7 Lion
    Upgrading to Mac OS X Lion Protocol

  • How can we get the web cam to work with sykpe or any out going calls

    can get the web cam to work with skype

    Hey there,
    What model laptop is this? Are you using the built-in webcam or is this a external web cam? Also what operating system are you using?
    Thanks!
    Sean
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • How can I get my Canon A620 to work with Windows 7

    Just signed up here, ot the brightest with tech stuff. I'm trying to get my Powershot A620 to work with Windows 7. I'm guessing there's drivers I need to down load ? Will they be on the Canon website or on this help site ? 
    I'll keep looking around. 
    Steve

    If you need photo software and don't have any you can download Canon software here.
    http://www.usa.canon.com/cusa/support/consumer/digital_cameras/powershot_a_series/powershot_a620#Dri...
    But if you already have software you use there is nothing special you need. Ether connect the camera using a USB cable or remove the SD card from the camera and use a card reader (either an external one or the computer may already have one built in.)
    If  you decide to connect the camera via USB you don't need a driver; its built into W7.
    John Hoffman
    Conway, NH
    1D Mark IV, Rebel T5i, Pixma PRO-100, MX472

  • How do i get my surround sound to work with my laptop while using a hdmi cable for the video

    I have a Sony surround sound  system hooked up that works great. My X-Box 360 works with it and I can get my HP G60 to play audio files through the surround sound system with a red and white audio jack plugged into the back of my surround sound receiver, the red and white audio cord goes to a 3.5mm headphone jack that i plug into the headphone plug on the front of my computer. The problem occurs when I hook my HDMI cable into my computer and connect it to my Samsung Flat screen, the HDMI sound takes over and wont allow the sound to go through the headphone jack. My tv does not have any audio output plugs, and my suround sound reciever doesnt have an HDMI input. Is there a setting on the computer that will allow me to over ride the HDMI sound and direct the sound through the head phones? or is there an app or tool that will allow my laptop to recognize my suround sound system plugged into my laptop? I have been to best buy, walmart, radio shack and even my local car audio store to ask about this issue and everyone has a different solution, and so far none of them have worked???????? sincerley frustrated! please help!?!?!?!?!?!?!?!?

    Hello JaeRoc48,
    I understand that the sound is not working.
    Go to start.
    Type Sound.
    Select sound.
    Select speakers as default.
    Click OK.
    Let me know how everything goes.

  • How do i get a scanjet 5200c to work with windows 7?

    I have a Scanjet 5200c that worked well with Windows XP.  When I went to Windows 7, it stopped working.  HP support said they did not support this machine with a driver for Windows 7.  Why not?  How can I get this perfectly good scanner up and running again?

    BSLund, welcome to the forum.
    I do not work for HP, but I have experience with driver development.  Once printers/scanners get older, it becomes too difficult to continue updating the driver.  There are newer printer/scanners that have to be supported.  Drivers are difficult to develop and maintain.  It is not as simple as going to the code and changing the model or OS version.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • How can I get i phone 4s to work with a tom tom car kit

    I upgraded to an i phone 4s from an I phone 3gs.  My tom tom app worked perfectly with the tom tom car kit on my old phone but now I have managed to get it to charge when plugged into the car kit but there is only poor gps reception showing, any Ideas on how to get my beloved sat nav back

    hi, I've got the same problem, cant get it to even charge so behind you on that. have looked on the tomtom site and see that they only stipulate that it will work with 3, 3s and 4 ..... miss out 4s! presumably there is an upgrade on the way!

  • How can I get my new camcorder to work with iMovie?

    Hey
    I just bought the new Panasonic SDR-SW20 and it doesn't work with a Mac.
    At least that is what I read at amazon.com.
    The file types it records in are .MOD files. Can these be converted?
    And if they can, how do I do that and what program do I need?
    Could someone maybe explain to me how I can get it to work with iMovie?
    Thanks.
    Bye Sandra

    Hi Sandy,
    Yes, you bought the wrong format of cam for working easily with iMovie HD6. Your cam records in MPEG2, which will need to be converted to DV for use in iMovie. You might want to read what the following page says about that cam's format.
    http://www.camcorderinfo.com/content/Panasonic-SDR-SW20-Camcorder-Review-35018/F ormat.htm
    It doesn't give a good review of the video quality and that will only get worse with the conversion necessary to work with it in HD6. If returning the cam for something more suitable is possible, unless you have bought this solely for its underwater capabilities, that might be your best bet. The best cam for use with iMovie HD versions is a miniDV cam using firewire, to capture to your Mac.
    If you want to persue the workarounds, you will need to get MPEGStreamclip (free-Google it) and the Apple QuickTime MPEG2 plug-in (cost $20.00), available at the Apple downloads site.
    Hope this helps you.
    Forest

Maybe you are looking for

  • PDF files will not open in Safari

    When clicking on a link to a pdf file (example: <a href = 'xxx.pdf'> I get a blank window. Have Acrobat, latest version installed. Is there a special process to install it in Safari?

  • On comcast and will not let me into e mail circle keep downloading

    I downloaded firefox 6.0 after my old version crashed. but I do get all my bookmarks etc. and when I try to go to my e mail it just keep going around and never comes in. can you help? thanks Sid...

  • Message IW437

    Hi, there is one message IW437 for defining that the date used in order as basic start or finish date is a working day or not. the setting is maintained in factory calender. Can we change the message control i.e now it is coming as warning message ,

  • Problem after hide the "Alternate File" field

    Hi all, Before I hide the "Alternate File" field in check-in form. I created a content item with a customize Content Type and then viewed it's content information. At the Web Location property like that:        Web Location:      http://tuyennt-lapto

  • Digital Audio in Game

    Hi guys, have a question: Have "big" difference within Digital and ****ogic Audio in game? (I know that the differece is impressi've in the movie but i dont know in gaming)