Problem first time round with DAQmxWriteDigitalLines

Hello,
Please can any one help with the code below?
(start task)
(create channel)
DAQmxWriteDigitalLines(m_taskHandle, 1, 1, -1#, DAQmx_Val_GroupByChannel, m_writeArray(0), m_sampsPerChanWritten, 0)
(stop task)
m_writeArray is 2 bytes long.
When I first run the task I get a buffer overflow error. When I run it a second time it works fine? The DAQmxGetWriteDigitalLinesBytesPerChan always gives 2 bytes per channel (strange? or expected?) - I tired increasing the m_writeArray size but it size exhibits the same behaviour. Anyone know?
Cheers,
Daniel

Thanks Jeff,
I tried your code in C and it worked as you said. First time around, no problems. I'm calling these functions with VBA (from within Excel,) and for some reason first time round I still get an error. It's curious, and I don't understand it. The problem is runtime error 6, "overflow." Interestingly enough if I step through the code, and pause for a second or so between making the channel and calling the write lines function I don't have a problem. I really dont understand since the C program works well. I've included the class I used to control the lines below, any ideas?
Best Regards,
Daniel
Option Explicit
Private m_sampsPerChanWritten As Long
Private m_TaskHandle As Long
Private m_writeArray(0 To 3) As Byte
Private m_bytesPerWriteDigitalLines As Long
Private Const c_digitalLineHIGH As Long = 1
Private Const c_digitalLineLOW As Long = 0
Private Const c_terminalAddress As String = "Dev1/port0/line0:1"
Private Sub Class_Initialize()
' Create the DAQmx task.
DAQmxErrChk DAQmxCreateTask("", m_TaskHandle)
' Add a digital output channel to the task.
DAQmxErrChk DAQmxCreateDOChan(m_TaskHandle, c_terminalAddress, "", DAQmx_Val_ChanForAllLines)
'Check the number of bytes per channel
DAQmxErrChk DAQmxGetWriteDigitalLinesBytesPerChan(m_TaskHandle, m_bytesPerWriteDigitalLines)
If m_bytesPerWriteDigitalLines <> 2 Then
MsgBox ("Error. Expecting 2 bytes per channel.")
End If
'Verify the task
'DAQmxErrChk DAQmxTaskControl(m_taskHandle, DAQmx_Val_Task_Verify)
'Reserve and Commit the resources for the task
'DAQmxErrChk DAQmxTaskControl(m_taskHandle, DAQmx_Val_Task_Commit)
'Start the task
DAQmxErrChk DAQmxStartTask(m_TaskHandle)
End Sub
Private Sub Class_Terminate()
'stop the task
DAQmxErrChk DAQmxStopTask(m_TaskHandle)
' terminate the task
DAQmxErrChk DAQmxClearTask(m_TaskHandle)
End Sub
Public Sub Inflate()
m_writeArray(0) = c_digitalLineLOW
m_writeArray(1) = c_digitalLineHIGH
'write the array to the digital lines
DAQmxErrChk DAQmxWriteDigitalLines(m_TaskHandle, 1, 1, -1#, DAQmx_Val_GroupByChannel, m_writeArray(0), m_sampsPerChanWritten, 0)
End Sub
Public Sub Deflate()
m_writeArray(0) = c_digitalLineHIGH
m_writeArray(1) = c_digitalLineLOW
'write the array to the digital lines
DAQmxErrChk DAQmxWriteDigitalLines(m_TaskHandle, 1, 1, -1#, DAQmx_Val_GroupByChannel, m_writeArray(0), m_sampsPerChanWritten, 0)
End Sub
Public Sub StopAir()
m_writeArray(0) = c_digitalLineLOW
m_writeArray(1) = c_digitalLineLOW
'write the array to the digital lines
DAQmxErrChk DAQmxWriteDigitalLines(m_TaskHandle, 1, 1, -1#, DAQmx_Val_GroupByChannel, m_writeArray(0), m_sampsPerChanWritten, 0)
End Sub

Similar Messages

  • HT204053 Our family has several apple devices, iPad, touch, and now iMac, our original iTunes are all under a different apple id.  do we keep our own accounts even in cloud? do we all have access to each others media? (First time out with all this..)

    Our family has several apple devices, iPad, touch, and now iMac, our original iTunes are all under a different apple id.  do we keep our own accounts even in cloud? do we all have access to each others media? (First time out with all this..)

    There is no problem about using one ID for iTunes, iTunes in the Cloud and iTunes Match, and another for iCloud and its email and syncing facilities. This way you can all use the same iTunes account but have separate emails and calendars etc.

  • How do I sync my new ipad mini with my old ipad 2, without losing any apps or data in notes?  I need step by step instructions for first-time sync with ipad mini.  Thanks.

    How do I sync my new ipad mini with my old ipad 2, without losing any apps or data in notes?  I need step by step instructions for first-time sync with ipad mini.  Thanks.

    If you synced it many times, you have to have a backup. It's just a question of how old that backup is now. When did you last sync?
    First of all launch iTunes on your computer and go to Edit>Preferences>Devices. Do you see any backups for you iPad in that window? If so, how new is the newest backup? That will be the backup that you will want to use. But remember that if you use that backup and it is one month old, you can only restore from that date back in time. Anything that you did on the iPad in the past month will not be in that backup.
    Turn on the new iPad Minin and start activating OTA via WiFi. You will get to a certain point in the process where you will be given the choice to Set up as new, Restore from iCloud - or Restore from iTunes. You will want to select Restore from iTunes.
    That is the short and sweet version. There are step by step instructions in this article. This applies to the mini as well as the iPad 4 or the iPad 3 for that matter.
    http://www.everythingicafe.com/how-to-set-up-new-ipad/2012/03/16/

  • First time working with fcpx

    first time working with fcpx; how to get my drives ( internal & external) visable in libraries?

    RudolfC wrote:
    first time working with fcpx; how to get my drives ( internal & external) visable in libraries?
    may I throw in some really 'Evangelistic' thought?
    Stop thinking in 'drives' (folders/files)!
    .. or any other 'manually' organizing structure. FCPX is first-of-all a database; tagging, keywording, smart-list - all faster, better, more flexible and much more convenient than any 'drawer based scheme'.
    ... ok, that was a bit pathetic, and for sure, you should know how to utilize external drives...-
    But when you keep starring on the Finder, you'll soon will be surprised, how FCPX manages to store 10Gigs on a 5GB-drive! (keyword 'hard/sym links')...
    ... no more 'drives'! Just Libs!

  • First time dealing with Greenshift/Gamma problem in Quicktime/Safari

    I've been editing video on a Mac and in Final Cut Pro since version 2  (I am transitioning to Adobe Premiere Pro so don't judge )and this is the first time I've had a huge problem with a shift in color from what I see on the canvas to what is exported - and the first time I've noticed that that problem/shift only happens when the footage is viewed in an Apple program (Quicktime or Safari when uploaded to Vimeo). Opening the footage in VLC or viewing the upload on Firefox? Looks gorgeous. But on Safari or Quicktime? Colors are muted and have a greenish cast.
    In doing some research, especially on various Adobe forums, I've learned that this is a scarily widespread problem (and learned the term 'QuiRktime') so I'm suprised I haven't had this problem before - it may be due to the lovely taupe/grey outfits, skin tones, etc that I got to shoot.
    The footage is for website/computer usage so looking at it on my monitor should be a good indicator. And I've had others look at the Vimeo upload and some have commented on the green cast (so are probably Mac people too...).
    So I'm not sure what to do - how best to give it to the client.
    Workflow: footage is ProRes HQ, shot in 1080, shrunk to 720 to make 'artificial second cam close-up' (don't ask...). Edited in Final Cut Pro, but I've been going back and forth with it in Adobe Premiere Pro to try and tweak the picture color and contrast, as I've been liking the filters in Premiere better than FCP lately, but had some pre-built items I needed to use in FCP as I haven't gotten around to re-building replacements in After Effects.
    I've exported it as ProRes and used Adobe Media Encoder to compress (been using both the Vimeo 720 preset - and tried upping the bitrate, setting quality to max rendering - and the Broadcast 720 preset).
    Only time I've gotten it to look good when opening on Quicktime is when I export it as Animation versus ProRes, but the resulting file is 12X (and thus 12GB) so too large to upload or burn on disc (and compressing it for web usage from that file gives identical results to simply compressing the ProRes file in the first place or exporting directly from Premiere Pro to h.264)
    So my question is...what is the best way to export this footage to get the right color cast in Quicktime based computers and non-Quicktime using computers.
    I've uploaded a screenshot of the footage opened in Safari and Quicktime (left side) and Firefox and VLC (right side) to Flikr
    http://www.flickr.com/photos/44843717@N04/8300689101/
    Thanks for any help  you can give

    The footage is for website/computer usage so looking at it on my monitor should be a good indicator.
    It actually doesn't matter where the footage will end up.  The idea is to see the image accurately while grading, and for that you will need a calibrated, external TV.  You just can't use a normal computer monitor or software media players for this.

  • First time ever with this problem, importing an mp3 album...

    Greetings
    I encountered a problem last night, and it's the first time ever that I see this happening.
    I bought Sigur Ros' latest album from their website, as 320kbps mp3s, but for some reason, iTunes completely refuses to import or play it. No error messages, nothing happens at all.
    WMP still plays it fine. I tried stripping all the ID tag info, renaming the tracks, to no avail.
    I did email them telling of my problem but got no answer yet, so I thought I'd ask here in case someone has ever had the same issue...
    I have more than 1050 albums, all either downloaded from sources like iTunes and eMusic or ripped from my own CDs... Never had this particular problem before!
    Thanks

    Hello!
    I ran into this problem as well and it's driving me crazy. Glad to hear the you've contacted them and they're aware.
    Here's how I solved it. It's totally lame tho... They have to fix the files!
    - Load each file in Quicktime Pro.
    - Save as a flat movie.
    - Import the saved movie in iTunes.
    As I said, totally lame but it worked and the saved movie even kept the tags intact (so I didn't have to re-enter all these funky track names).
    The weird thing is that iTunes doesn't appear to be confused about this not being a movie file. Maybe it's because the movie is flat (its resolution is 0 x 0) so it just treats it like it would any MP3.
    Anyhow, very frustrating to do the right thing and buy straight from the artist only to not have it load in my music library! As soon as those files are fixed, I plan on re-downloading.
    Cheers!
    Michel

  • Problem using Time Machine with Seagate BackUp Plus Pls HELP!!

    I have a late 2006 iMac (running OS 10.5.8) & am trying to back up using Time Machine with a new Seagate BackUp Plus drive. When I select the Seagate drive in Time Machine it tells me I msut first erase the (Seagate) disk. When I hit ERASE, I get a Time Machine error : COULD NOT UNMOUNT DISK. I see from various posts that 10,5 & 10,6 have issues with some external drives so want to upgrade to Mavericks (to get around this incompatibility issue): HOwever apparently my iMac is too old (by 1 year) to allow this. Can anyone give me any advice on how to get my iMac content backed up via Time Machine using the Seagate BackUP PLus drive I  bought (becasue it is supposedly "compatible with PCs & Macs".
    Thank you!!
    Wendy

    Your Seagate drive should work just fine. If it doesn't have any important data on it, try re-formatting it with Disk Utility to blank it out. Or run the Disk verify/repair and see if you can get it to fix any problems.
    I have a Drobo FS too. You probably need a firmware update, they issued one a while back to fix problems with Time Machine. Use the Dashboard or download it from their support site, http://www.drobo.com/support/updates.php
    Just curious how long you let it run after it "stalled". If it is a big file it could just be taking a while to copy over, do you see activity lights on the USB drive? The first time you use time machine let it run overnight, it's going to take a while, after that it will update quickly.
    While you're at it, you might want to verify your start-up disk too with Disk Utility.

  • First time recording with digital drum kit in GB. Just got weak sound

    Hi first timer here. Just bought a usb midi interface from Roland (umg-1g). It has midi in and midi out. My drum kit is Roland td3. My problem is that i get a weird sound that doesnt sound like my drums sounds like for me when playing. It sounds weak and empty with no real punch to it. Do any one have any idea of what I should do.
    thnx !

    Sebastianp wrote:
    ut looks like GB has only one rock kit?
    correct
    Is there expansion kit for drums one have to buy ?
    the rhythm section pack has several more kits:
    http://www.bulletsandbones.com/GB/PluginsApplesJamPacks.html

  • First time working with 802.11n, not working properly?

    Hello,
    This is the first time I use 802.11n in my network there is only one AP1141 but the clients don't connect at 802.11n rates, instead they connect at data rates as low as 11 Mbps. At the begining they connect at 144 Mbps but immidiatly it decreases to 11 or 12.
    Many of our wireless clients in the company are Intel(R) WiFi Link 5100 AGN.
    Any comments?
    AIR-AP1141N-A-K9  
    AIR-WLC2106-K9
    6.0.182.0
    Let me know if more info needed?
    Thanks

    Hi George,
    So you suggest to keep only WPA2/AES?
    Regarding the coverage area keep in mind this is a really small 4 floor building with an AP floor floor, I installed only one AP1141 in my floor and kept the AP1131 in the other 3 floors, I might reduce the power to half since I don't need them working at full power unless I need coverage in the stairs in order to enforce roaming to IPPhones. Also, I don't want to bond channels on 2.4 because I read that as a recomendation in a Cisco's document (anyways I did not find how to do it in 2.4, wuld be a nice tip if you tell me how just in case) so 144 Mbps would be great as long as it works properly. I did not experienced these rate hoping until I enabled this AP1141.
    And yes most of the clients that reported issues are Intel (engineering team, haven't checked the rest yet).
    Regards!

  • HT201412 First time sync with PC fail

    I have tried to sync my new Ipad with my PC and it wont do it. It says it needs a system restore and when I click that to do it, it says restore fail. Its showing a picture of a USB cable with an arrow pointing upwards to an itunes symbol as if to say I need to connect. But when I do it wont connect with itunes. I have disabled my security and reinstalled itunes and still nothing. I have only had it about 7 weeks and this is the first time I have plugged it into my PC. Any thoughts please'

    Thanks, I have tried that a number of times and it brings up errors -1, 14 and one other, cant remember what that was, it just wont do it. I have been using it overseas with a NZ sim card in it and have taken that out to see if that made a difference, just wont recover. Bit of a worry. Any other thoughts

  • Curve 8330 first time synch with data loaded into smartphone

    With other smartphones, when I would perform my FIRST synch,  if I did not take certain precautions (preset synch software to specific settings) I would wipe out all data on smartphone . Is this true for the Curve 8330? Are there specific settings so when I synch my phone for the first time with data I already loaded, I do not wipe it clean?

    Hey TomPortua,
    Welcome to the BlackBerry Support Community Forums.
    The first synchronization does not erase the data on the BlackBerry Smartphone unless synchronization options are configured to "Replace all data in the target application", by default this is not selected if it is configured for Two way sync.
    Have a look at this article for more information no configuring the Desktop software for Synchronization:
    http://www.blackberry.com/btsc/KB23681
    I hope this helps, cheers!
    -HB
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • First time installation with WRT54GX2 and having problems...

    Attempting to setup my wireless network and used the setup disk and that a wireless broadband g router is not found, make sure power is on and all connections are correct.  After confirming this I download the easylink and it says that wired lan needs to be enabled.  Check status and it is.  Try to access web based utility, 192.168.1.1, it asks for username and password.  put it the default admin in password and it attempt to load the web utility with no success.  It let attempt for about 20 minutes or so with the windows icon in the top right hand corner waving.  I'm using a different router from my previous setup that I had in another apartment.  I was using the befw11s4 with the cox high speed internet with no problem.  Moved in new place with bellsouth dsl (according to website dynamic ip) with router wrt54gx2 and can't get it setup.  I have 2 desktops, PS3, and Nintendo Wii that I want sharing internet connection.  I need some advice.

    Make sure all your devices are wired correctly then with a WIRED pc connected to the router open your browser.  Then when your browser is open type in http://192.168.1.1 and enter your password if you changed it.  That will get you into the routers set up page.  Since you have a DSL connection set the router to use PPPoE and enter the user name and password provided by your ISP and save settings.  Also you may want to set the Keep Alive setting to 30 seconds.  Then go to the wireless tab and configure your SSID to something you can identify has your wireless network and set the rest of the settings as your network requires. You may need to open your ports if needed for your PS3 and Wii.
    Richard Aichner (Ikester)

  • First time poster with a Stringy problem (new line "\n" not working...)

    Hello,
    I am having a bit of troble with making a string appear in multiple lines.
    I have the following code:
    String scores = ("1st Place "+ highInit1 + " " + highScore1 + " points\n");
    scores = scores +"2nd Place "+ highInit2 + " " + highScore2 + " points\n";
    With this string I am using swing and the following code:
    g.drawString(xxx,xxx,blah.getScores());
    When I have been doing this it always displays on a single line. I have tried positioning the "\n" in different places with no luck aswell. Any ideas what is going on here?
    Thanks

    I would suppose that drawString doesn't honor newline characters to do that. There's nothing magical about a \n character. It's just a character. It is up to the thing rendering it how it is going to treat that character. I would also suppose that's what the xxx, yyy parameters are for - to tell it where to place the text. Looks like you need two separate drawString calls.

  • I have a 27" imac (intel) my hard drive failed and I installed a new one. This is my first time dealing with this so I am having trouble re-installing the OS. Install disc spits out and ? mark with folder appears what am I missing?

    Like the title says. My 1 TB drive failed and unfortunately my computer isn't covered on the replacement program even though my hard drive is the one they are claiming to replace. So that is not a solution just to get that out of the way. So I replaced the hard drive. What I am having trouble with is re-installing my OS. I have 10.6. When I load it and restart it just spits it out and I get the question mark folder. What am I doing wrong is there a step I'm missing? I did do a back up to my Time Machine before the crash. Can I plug it into it and reload format? I'm new to this so any help would be appreciated.
    Thanks!

    Well, let's hope that nothing was jiggled out of place when you were installing the new hard drive. Your optical drive may just be out of alignment or the disc you have is "dirty." Get a lint-free cloth and some rubbing alcohol, then clean the disc as thoroughly as you can starting from the center and working outward in a concentric circlular motion. See if that helps. In particular clean the inner portion well.
    If this does not help, then you have a problem. You have opened the computer yourself. That action voids all support from Apple. If you take the computer in for service the store may refuse to service the computer. This is not related to your now expired warranty.

  • HT4681 Problem exporting time lapse with FCPX 10.0.6

    I have been trying to export my time lapse and it processes for a bit, then this message comes up:
    The operation couldn’t be completed. (com.apple.Compressor.CompressorKit.ErrorDomain error -1.)
    Before updating to version 6, I had no problems exporting dozens of time lapses.  As far as I know, I'm not doing anything differently than my previous ones. This is not even the biggest file I've processed.
    I have Compressor 4, and that fails as well. 
    Thanks for any help

    See if it will export with other settings, like Master File, Pro Res. If it does, you can then do your h.264 encode in Compressor.
    Whether that works or not, try the usual troubleshooting steps of trashing preferences and repairing permissions.
    (I'm also assuming that you followed Tom's advice to make sure both FCP and Compressor were updated to their latest versions.)
    Russ

Maybe you are looking for

  • Error Message when Trying to Sync to MS Outlook 2010, "No Available Message Stores"

    Hi, I am trying to Sync My blackberry 8330 Phone with MS Outlook 2010 Beta. I can not Sync to any part of MS Outlook (Calendar, E-Mail, etc)  I always get the same error message "No available Message Stores".  Does anyone know what is causing this or

  • Fillable PDF to Access Database or Excel SS

    I am using Livecycle Designer to create the form. I need to distribute via a web page and once the form is completed, I need it to submit(populate) to an Access Database or an Excel Spreadsheet. How can i do this? If LiveCycle is not enough what othe

  • WPA or WPA2 on Vista?

    I got a Linksys WRT54GL router, and it supports WPA and WPA2.  I have a PC60G installed in a 32-bit Vista machine.  I configured the router for WPA2, and the Vista machine would not connect to it.  Then I configured the router for WPA, and the Vista

  • Problem in tiff file Printing

    hello, I am trying to print tiff image using JAI(Java advanced imaging). I am able to perform all the required operations for that including zoom in, zoom out etc. But I am facing problems while printing the same. These files I am getting from the by

  • Compass what is it good for?

    Not an expert on looking up adresses or location via coordinates, what can I use this for practically speaking? I heard future apps could improve Maps or combined with a preloaded map app?