NI PCI-6542: Creating Dynamic Waveforms Using the HSDIO Library

Hello!
I am having problems understanding how to create waveforms using the HSDIO library to run on my PCI-6542 board. I need to create a program that turns one channel on for 12.5 microseconds, waits a set amount of time(i.e. 100 samples),  and turns another channel on for 12.5 microseconds.
This program is to be used in a phased array ultrasonic system.
Below is the Dynamic Generation example program that turns channels 0 - 2 on for 1024 samples.
* Example Program:
* DynamicGeneration.c
* Description:
* Generates a simple pattern on specified channels.
* Pin Connection Information:
* None.
/* Includes */
#include <stdio.h>
#include <limits.h>
#include "niHSDIO.h"
/* Defines */
#define WAVEFORM_SIZE 1024
int main(void)
ViRsrc deviceID = "Dev1";
ViConstString channelList = "0-2";
ViReal64 sampleClockRate = 50.0e6;
ViInt32 dataWidth = 4;
ViUInt32 waveformDataU32[WAVEFORM_SIZE];
ViConstString waveformName = "myWfm";
ViInt32 timeout = 10000; /* milliseconds */
ViSession vi = VI_NULL;
ViStatus error = VI_SUCCESS;
ViChar errDesc[1024];
ViInt32 i;
/* Initialize generation session */
checkErr(niHSDIO_InitGenerationSession(
deviceID, VI_FALSE, VI_FALSE, VI_NULL, &vi));
/* Assign channels for dynamic generation */
checkErr(niHSDIO_AssignDynamicChannels (vi, channelList));
/* Configure sample clock parameters */
checkErr(niHSDIO_ConfigureSampleClock(
vi, NIHSDIO_VAL_ON_BOARD_CLOCK_STR, sampleClockRate));
/* Query the Data Width Attribute */
checkErr(niHSDIO_GetAttributeViInt32(
vi, VI_NULL, NIHSDIO_ATTR_DATA_WIDTH, &dataWidth));
/* Populate waveform with ramp data */
for (i = 0; i < WAVEFORM_SIZE; i++)
waveformDataU32[i] = i;
checkErr(niHSDIO_WriteNamedWaveformU32(
vi, waveformName, WAVEFORM_SIZE, waveformDataU32));
/* Initiate generation */
checkErr(niHSDIO_Initiate(vi));
/* Wait for generation to complete */
checkErr(niHSDIO_WaitUntilDone(vi, timeout));
Error:
if (error == VI_SUCCESS)
/* print result */
printf("Done without error.\n");
else
/* Get error description and print */
niHSDIO_GetError(vi, &error, sizeof(errDesc)/sizeof(ViChar), errDesc);
printf("\nError encountered\n===================\n%s\n", errDesc);
/* close the session */
niHSDIO_close(vi);
/* prompt to exit (for pop-up console windows) */
printf("\nHit <Enter> to continue...\n");
getchar();
return error;
Questions:
How can I change the values in waveformDataU32 to create off and on states(instead of just always on)?
How do I select the channel that waveformDataU32 is applied to?
Thanks!
Zachary Geier
Solved!
Go to Solution.

The waveformDataU32 array is an array of 32 bit integers. Each bit corresponds to a line on the device.  So on the first clock cycle, this program outputs:
0000 0000 0000 0000 0000 0000 0000 0000
Then it outputs the following, changing on each clock pulse:
0000 0000 0000 0000 0000 0000 0000 0001,
0000 0000 0000 0000 0000 0000 0000 0010,
and so on all the way up to 1023:
0000 0000 0000 0000 00000011 1111 1111
In the example you include at the bottom, you are setting the least significant bit (LSB) to zero and one, effectively only changing one line on the output. To change all of the lines, you should use 4,294,967,295 or 0xFFFFFFFF instead:
for (i = 0; i < WAVEFORM_SIZE; i++){
if(i < 200){ //If sample number is less than 200
waveformDataU32[i] = 0; //Turn off channels 0-2
else{
waveformDataU32[i] = 4,294,967,295; //Else turn on all channels for 800 samples
-Jim B
Applications Engineer, National Instruments
CLD, CTD

Similar Messages

  • Is it possible to create dynamic reports using iReports in netbeans ?

    Hi
    I want to know that is it possible to create dynamic reports using netbeans? Dynamic reports means based on user selection(for eg. say by selecting values from combo boxes) some query will be genatated and fetch the query result from data base and displayed results in iReports only my problem is i am working on Netbeans IDE and i have installed iReports as plugins in netbeans IDE. and i am not able to find any tutorial that show me how to work with iReports under netbeans IDE. and how to create dynamic reports in iReports. If u know any such tutorial then can you send me link plz...!
    Thanks

    What do you mean by "in Start Menu"? Do you mean Live tile? See https://msdn.microsoft.com/en-us/library/windows/apps/hh465403.aspx
    https://msdn.microsoft.com/en-us/library/windows/apps/dn468032.aspx
    Best Regards,
    Please remember to mark the replies as answers if they help

  • How to create a partition using the free space of an existing[SOLVED]

    Hi Guys,
    Since I could not install fifa 09 using wine on linux, I need to create a partition where I can install windows first in order to install fifa 09 on it. How can I create a partition using the rest free space of my , for example, /home partition?How can I do it in a secure way (meaning without doing something to my existing archlinux installation files and system files) ?
    Thanks.
    Please see this post:
    https://bbs.archlinux.org/viewtopic.php?id=109402
    Last edited by Archie_Enthusiasm (2010-12-08 19:23:46)

    Use Parted Magic. But you *should* backup any important files just in case, regardless of method you use. You never know. Someone could unplug your computer, a power surge might happen, etc. A cousin of mine actually did something similar while I was gaming, the extension cord has a red button which he "accidentally" pressed. I would've cracked his skull had he done it while resizing a partition.
    Anyway, the partitioning scheme should be the first thing you do when you decide go this route (dual booting). I remember about a year ago I forced myself to use Linux by formatting the entire drive to ext4, except for the 2 GB + 20 GB ntfs partitions. It was what kick-started me on this path. Here's my partitioning scheme for both computers, maybe you'll get an idea and do something similar:
    Older computer:
    2 GB ntfs - MicroXP
    8 GB ext4 - Arch Linux + Home dir (to keep the dot files organized in one place)
    20 GB ntfs - games partition
    Rest is for media, formatted as ext3 with inode 128 (so it can be loaded as Read-Only in Windows too via Ext2fsd so they won't be affected in case of a virus infection)
    New computer:
    20 GB Windows 7
    10 GB Arch Linux + home dir
    50 GB games partition
    Rest of the space is ext4 mounted to /media
    Note that they're all primary partitions for remembering easier (sda1, sda2, sda3, sda4) instead of a combination of primary and extended which would probably look like sda1, sda5, sda6, sda7, etc.
    Last edited by DSpider (2010-12-03 13:02:26)

  • I am creating a video using the green screen option- I imported a picture for the background of the project and videotaped someone using a green screen. Is it possible to move the video of the person around so it is not blocking the picture behind it?

    I am creating a video using the green screen option in iMovie.   I imported a picture for the background of the project and videotaped someone using a green screen. Is it possible to move the video of the person around so it is not blocking the picture behind it?

    To enable this right you need Acrobat, not the free Reader.
    However, starting from Reader X it is possible to add simple markups to any file, unless it has been specifically disallowed by the creator of the file.

  • HT5071 Can I create a book using the IBooks Author word processing software, save it as a PDF, then have it professionally printed by an offset press to sale in brick and mortar stores? If so, is this procedure free me from any IBooks restrictions?

    Can I create a book using the IBooks Author word processing software, save it as a PDF, then have it professionally printed on an offset press to sale in brick and mortar stores? If so, is this procedure free from any IBooks restrictions?

    It's your content, under your control.
    If you output as an .ibooks file, and you want to sell it, the store is the only outlet, otherwise, you can do as you wish.

  • I want to create a book using the photos in the order I have them in the album I created, but book has them all mixed up

    I want to create a book using the photos in the order I have them in the album I created, but book has them all mixed up

    the only reported way is to redo the dates in the album and then start the book since books use date order
    LN

  • Will indesign allow me to create a calendar using the lunar cycle?

    I need to be able to create a calendar using the lunar cycle instead of the standard gregorian cycle. Does Indesign's calendar wizard/software allow me to do this or would I have to create it manually through something like photoshp/illustrator?

    InDesign does not come with a Calender Wizard script, so you probably downloaded this elsewhere. you'll have to ask where you got it from.
    (If this "lunar cycle" thing is not in the feature list of that script, chances are it's not hidden in there somewhere either. If I included such a feature, I'd make sure to advertise it. If it isn't available, you can probably contact the author and see if s/he is willing to add it.)

  • I am trying to create mobile pages using the steps file new new document page from sample mobile starters jquery mobile (cdn).  When "page from sample" is selected, the subsequent options are not available.  This seems like a silly question, but how do I

    I am trying to create mobile pages using the steps file>new>new document>page from sample>mobile starters>jquery mobile (cdn).  When "page from sample" is selected, the subsequent options are not available.  This seems like a silly question, but how do I acquire these options?

    You can get the latest jQuery Mobile Themes directly from jQuery Mobile's web site.
    https://demos.jquerymobile.com/1.1.0/docs/api/themes.html
    Or roll your own with ThemeRoller
    http://themeroller.jquerymobile.com/
    Nancy O.

  • I am creating a request for proposal form and I need to add a commission structure field.  I created a table using the ranking field and now I need to delete the "dots/buttons" and turn them into text fields, is this possible?

      I created a table using the ranking field and now I need to delete the "dots/buttons" and turn them into text fields, is this possible?

    It sounds like what you are trying to do is edit the choices in a likert field to something other than the default radio button. This is not something that you can do in Formscentral at this time.
    Andrew

  • Broken link- Creating WebLogic Domains Using the CW

    Hello!
    Create domains The Configuration Wizard guides you through the process of creating or
    extending a domain for your target environment. See Creating WebLogic
    Domains Using the Configuration Wizard.
    That link doesn't works... any idea where I could find the info?

    Check this one --- > http://download.oracle.com/docs/cd/E13179_01/common/docs102/confgwiz/index.html
    http://download.oracle.com/docs/cd/E13179_01/common/docs102/confgwiz/newdom.html#wp1080587
    Edited by: Renjan Thomas on Oct 15, 2009 1:36 AM

  • Cannot create a server using the selected type

    Hi,
    I'm trying to integrate tomcat 6.0 with Eclipse. But when I try to add Tomcatv6.0 Server,
    it is sowing an error message " Cannot create a server using the selected type ".
    Can anyone tell me why?
    Thanks in advance

    In order to solve the problem you need to
    * close eclipse
    * go to ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings
    * remove the files org.eclipse.wst.server.core.prefs and org.eclipse.jst.server.tomcat.core.prefs
    * solve the problem with the permissions of the policy files or the personal instance of tomcat6
    * start eclipse
    In order to be able to use the tomcat6 server the proper solution is to have a personal instance of the tomcat6 server as described in the section "Advanced Configuration - Multiple Tomcat Instances" of the file RUNNING.txt (and the problems that have been reported about this ;-) )
    My configuration: Debian/Sid, Eclipse 3.4.1. Ganymede
    george

  • Creating a mapping using the API

    Hi Brian, I am curious about this use case - what's the reason you are looking to do it using the API? You can create several objects using the API and the most typical use case we have observed is where mapping developers create a pattern or what we call as a "template" - which is a mapping with various properties parameterized. For example you can create a mapping with the filter parameterized, or define a very generic mapping with source, target and the field map between those all parameterized. Once you do that, you can create a "task" for this mapping (known as Mapping Configuration Task) - that can be done using our UI or using our REST API. If you choose the latter, you can pass on parameter values as part of the API request. Suggest you to take a look at our new Developer Portal, and specifically at the sections Templates and REST API there. Feel free to post any further questions here. If you sign up to the developer program there, you will get much more direct help.https://community.informatica.com/community/technology_partner_network Amol

    I was wondering about creating a mapping using the API. It clearly states in the Dev guide that this is possible, but when I perform a get mapping request, I don't see all the information given for a certain object.  For example, I don't see an expression in the mapping object (although one exists when I view the object in Cloud).   Has anyone else done this? Is it easy to create objects via the API?  Thanks!

  • Help/Example needed for creating JMSQueues/JMSTopics using the MBean API

    I am trying to create JMSQueues programmatically using the MBean API. When
    I use MBeanHome.createAdminMBean(), a queue appears in the root of the
    config file. This is progress, but the queue is in the wrong place! I need
    the queues to be part of my JMS server's "destinations" as seen on the
    console.
    So now I am trying to use createConfigurationMBean() instead, but I can't
    figure out what the "parent" parameter should be- no documentation! My
    first guess was that the parent might be the JMSServer, but that doesn't
    work.
    Anyone have example code to insert JMSQueues and JMSTopics into a specific
    JMS server's destinations?
    Here is the code I tried... All goes well until the final
    createConfigurationMBean call, where it throws a MBeanCreationException:
    // Get the MBeanHome bean
    Object obj = jndiContext.lookup("weblogic.management.adminhome");
    MBeanHome mbeanhome = (MBeanHome) javax.rmi.PortableRemoteObject.narrow
    (obj, MBeanHome.class);
    // Get the server MBean
    JMSServerMBean jmsServerMB =
    (JMSServerMBean)mbeanhome.getMBean("examplesJMSServer",
    JMSServerMBean.class);
    // Create the new Queue
    JMSQueueMBean jmsQMB = (JMSQueueMBean)mbeanhome.createConfigurationMBean
    ("weblogic.examples.jms.fooQueue", "JMSQueue", jmsServerMB);

    Ok, I still don't see how I can do it differently with the admin tool. If
    you want to see the commands I'm using, I can post them, but the basic one
    is shown below in the previous message. We're trying to set up a script so
    that developers can just run it and properly configure WebLogic with the
    right components.
    Thanks,
    Michelle
    "Michelle Baxter" <[email protected]> wrote in message
    news:[email protected]...
    I am using the weblogic.Admin tool, not doing this in code. I will attempt
    to translate your advice when I get time again.
    My commands look like this:
    java weblogic.Admin -url 127.0.0.1:7001 -username system -passwordweblogic
    CREATE -mbean "mydomain:Type=JMSQueue,Name=MyJMSQueue"
    I create this, I create the JMSServer MBean, then do and INVOKE (insteadof
    CREATE) and call the addDestination method, adding the JMS Queue MBeanthat
    I created previously, using the same naming scheme as in the above CREATE.
    "Viresh Garg" <[email protected]> wrote in message
    news:[email protected]...
    Daron Cole wrote:
    You can use createConfigurationMBean with JMSQueueConfig but in the
    end
    I used
    the code below to create a topic.The code that you posted is the right way to create queus/topics. alwayscreate admin mbeans to admin
    server and let admin server internally create config Mbeans on the
    managed
    server as per the
    location/targets that you set in admin Mbeans.
    Queue's are the same, just replace the word
    Topic with Queue and it should work. It should show up in the console
    app.
    MBeanHome home = (MBeanHome)ctx.lookup(MBeanHome.JNDI_NAME+".myserver");
    ServerMBean myserver =(ServerMBean)home.getMBean("myserver",ServerMBean.class);
    String topicName = "MyNewTopic";
    JMSServerMBean jmsServerMB =(JMSServerMBean)home.getMBean("JMSServer","JMSServer","mydomain");
    JMSTopicMBean jmsTopicMB =(JMSTopicMBean)home.createAdminMBean(topicName,"JMSTopic","mydomain");
    jmsTopicMB.setJNDIName(topicName);
    jmsServerMB.addDestination(jmsTopicMB);
    Viresh Garg
    Principal Developer Relations Engineer
    BEA Systems
    "Michelle Baxter" <[email protected]> wrote:
    There is no JMSQueueConfigMBean. What do you mean?
    "Daron Cole" <[email protected]> wrote in message
    news:[email protected]...
    Try JMSQueueConfig instead of JMSQueue.
    "Michelle Baxter" <[email protected]> wrote:
    Me too! I'm trying to use the weblogic.Admin class to set up
    queues
    and
    topics and the JMS server. The same results in the config file:
    the
    queues
    and topic were set up at the root, the JMS server was added, but
    no
    destinations, even though I invoked the addDestination method withthe
    created MBean queues and topic as arguments. No exceptions, just
    no
    destinations on the JMS server resulted. What's the right order ofexecution
    for this stuff??
    Thanks,
    Michelle
    "Jude DeMeis" <[email protected]> wrote in message
    news:[email protected]...
    I am trying to create JMSQueues programmatically using the MBean
    API.
    When
    I use MBeanHome.createAdminMBean(), a queue appears in the root
    of
    the
    config file. This is progress, but the queue is in the wrong
    place!
    I
    need
    the queues to be part of my JMS server's "destinations" as seen
    on
    the
    console.
    So now I am trying to use createConfigurationMBean() instead,
    but
    I
    can't
    figure out what the "parent" parameter should be- no
    documentation!
    My
    first guess was that the parent might be the JMSServer, but that
    doesn't
    work.
    Anyone have example code to insert JMSQueues and JMSTopics intoa
    specific
    JMS server's destinations?
    Here is the code I tried... All goes well until the final
    createConfigurationMBean call, where it throws aMBeanCreationException:
    // Get the MBeanHome bean
    Object obj =
    jndiContext.lookup("weblogic.management.adminhome");
    MBeanHome mbeanhome = (MBeanHome)javax.rmi.PortableRemoteObject.narrow
    (obj, MBeanHome.class);
    // Get the server MBean
    JMSServerMBean jmsServerMB =
    (JMSServerMBean)mbeanhome.getMBean("examplesJMSServer",
    JMSServerMBean.class);
    // Create the new Queue
    JMSQueueMBean jmsQMB =(JMSQueueMBean)mbeanhome.createConfigurationMBean
    ("weblogic.examples.jms.fooQueue", "JMSQueue", jmsServerMB);

  • Creating Workbench Templates Using the Workbook.

    Hi Guys,
    I am currently in the process of creating Workbench templates using the workbook. However, I am unsure how to define the order the channels will appear in the wb_page_configs tab. Currently these are the available fields in this tab,
    CHANNEL_EXTERNAL_ID          STRING_TYPE               
    PAGE_EXTERNAL_ID                STRING_TYPE     .          
    CFG_NAME_RESC                CUSTOM                    
    COL_POS                                      INTEGER_TYPE                    
    IS_REQUIRED                BOOLEAN_TYPE                     
    IS_FIXEDPARAMS                BOOLEAN_TYPE                     
    IS_USE_CHANNEL_PARAM       BOOLEAN_TYPE                    
    PARAMS                                      CUSTOM
    Which of these fields defines which column the channel is being put in (Column 1 or Column 2) also, how do you define that in the workbook?
    Which of these fields defines the order in the column (For example, At the top of Column 1, or the second channel in column 2) also, how do you define that in the workbook?
    any help is appreciated, any templates of workbench configs done via workbook will also be greatly appreciated. Not sure if I am looking @ the wrong workbook tab in order to define these parameters, but it seems that this is the sheet that I should be looking.
    Thanks.

    Hi,
    Let me try and explain it via an example.
    You should first look to define the Template in the wb_pages tab. You can use the standard one which is: workbench.default_buyer_template. This is the Default Buy-Side Template.
    Now coming to the wb_page_configs tab. Suppose you want to add the Contract Search channel in the Workbench view. For this your values would be:
    CHANNEL_EXTERNAL_ID: channel.contract_search
    PAGE_EXTERNAL_ID: workbench.default_buyer_template
    CFG_NAME_RESC: Leave blank
    COL_POS: 1
    IS_REQUIRED: FALSE
    IS_FIXEDPARAMS: FALSE
    IS_USE_CHANNEL_PARAMS: TRUE
    PARAMS: Leave Blank
    Similarly, if you want the To Do List to appear in the right hand channel, the only difference would be that the Col_POS would need to be set to value = 2.
    Hope this helps,
    Vikram Shukla
    Edited by: Vikram Shukla on Feb 1, 2012 7:42 PM

  • The new ibook app and ibook update is designed for iPhone 5 operating system.   When my iPhone4 recently updated the ibook app, it created many problems using the ibook to download and read my books.    Can I get the previous ibook app back on my phone.

    The new ibook app and ibook update is designed for iPhone 5 operating system.   When my iPhone4 recently updated the ibook app, it created many problems using the ibook to download and read my books.    Can I get the previous ibook app back on my phone.

    Check your trash can on the desktop. The old version is automatically moved to the trashcan. You should be able to move it from the trashcan back to the Apps folder within the iTunes folder. The update that was pushed out was for iBooks to work with iOS 7 not iPhone 5. iOS 7 was released today.

Maybe you are looking for