How to convert double to unsigned long integer for cRIO analog output?

All,
Having issues sending out my arbitrary waveform to my cRIO analog output. My values are doubles and by the time I send them out, they have been converted to U32 values and are all turning out as zeroes. This led me to assume two things: 1) That cRIO analog output can only output integers since the values need to be deployed in the memory first and 2) that I'm missing a step in the conversion process. My values range from 0-8, therefore I don't expect that the simple conversion tool in labview should make everything into zeroes.
Any help?

Since we are using the cRIO's FPGA interface, you really should be doing most of this inside of the FPGA.  Use DMA FIFOs to pass your data between your RT and the FPGA (and visa versa).
On your FPGA, you can have a loop that just reads the analog inputs at whatever loop rate you want.  You just send the data to the RT using a DMA.
Similarly, use a DMA to send your analog output values to the FPGA.  The FPGA can have another loop that reads the DMA and writes the value to the analog output.  This should be done in the FPGA since you can have the FPGA send out the values at a given (and deterministic) loop rate.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Converting jlong to unsigned long

    Hi Everyone,
    I am calling a interface from a dll file which need a unsigned long or long as a parameter. In the C program side, how can I convert the jlong to unsigned long or long and then call the interface from the dll file? Also, how can I convert the long back to jlong and return back to Java side? Thank you.
    Jacky

    Straight cast - BigInteger would be overkill.

  • How to specify in TS unsigned long? unsigned short?

    Hi,
    I'm lusing a c/c++ step type from TestStand.
    I need to use a structure whose fields according to the h file of the dll are:
    unsigned char
    unsigned long
    unsigned short
    Now, when I define a container in TestStand (to interface with the dll structure) my options are:
    integer
    unsigned integer
    etc...
    What am I supposed to do ?  what is the appropriate numeric format? 
    Thanks

    Hi Doug,
    I'm given the dll and load of h files.  The definitions you mentioned are not shown...
    Suppose I want to creat in TS a container to match variable FCPortConfig.  This variable structure is given here....
    typedef struct tagFCPortConfig
     unsigned char  ucTopology;    /* For Point-To-Point use TOPOLOGY_PT_2_PT
                  and for LOOP Topology use TOPOLOGY_LOOP */
     unsigned char  ucSpeed;     /* SPEED_1GHZ, SPEED_2GHZ       */
     unsigned char  ucDisableTimer;  /* (Not Currently Used) enable or disable
                  timeout timer          */
     unsigned long  ulRRDYGap;    /* (Not Currently Used) up to a 27-bit val */
     unsigned long  ulRRDYGapRandomEnable;/* (Not Currently Used)enable/disable   */
     unsigned long  ulRRDYGapSeed;   /* (Not Currently Used) If random set;
                  a 27-bit val          */
     unsigned long  ulRRDYGapMin;   /* (Not Currently Used) If random set;
                  a 27-bit val          */
     unsigned long  ulRRDYGapMax;   /* (Not Currently Used) If random set;
                  a 27-bit val          */
     unsigned char  ucAutoNegotiate;  /* (Not Currently Used) enable or disable
                  auto negotiation         */
     unsigned short uiBBCreditConfigRx; /* BB_credit this port will advertise   */
     unsigned char  ucStatsMode;   /* Determines weather or not to retrieve
                                              the extended stats counters, use
                                              STATS_MODE_NORMAL & STATS_MODE_EXTENDED */
     unsigned char  ucReserved[15];  /* Reserved */
    } FCPortConfig;
    1) Is there a way to find out how they define unsigned char, unsigned short and unsigned long?
    2) Can I still use the TS default numeric type?
    Thanks
    Rafi

  • Converting doubles to unsigned shorts for grayscale BufferedImages

    I'm generating a slightly random array of doubles for use in defining pixel shades in grayscale BufferedImages, so I need to cast each double into a short so that my future DataBuffer can treat them as unsigned shorts. Right now the double values greater than 2^15 are becoming negative when casted, so how do I store it as unsigned?

    Thanks for the reply DrLaszloJamf. I need a Gaussian distribution of pixel shades, and the only Gaussian distribution generation functions I can find return doubles. Unfortunately I don't have time to write my own function to do the same with short values, but as implied by your second remark, I think the DataBuffer is doing with the shorts what I need it to. Thanks very much also for your answer to another post that showed me how to generate a grayscale BufferedImage using a DataBufferUShort in the first place!

  • How to convert Works doc no longer having Works?

    I have been sent a large Works document. No longer having Works, I am trying to figure out how to convert it into .rtf of some other form that is readable.

    Since you've posted in the AppleWorks forum, by "Works" I assume you mean AppleWorks. There are a few options to get to the contents of that file.
    The easiest & most reliable option other than using AppleWorks or Pages 4 or earlier would be to open the file with LibreOffice. It's a free, open source, Office clone that does a very good job of opening AppleWorks & ClarisWorks files. You can then save them as RTF or Word.
    Second would be to open the file with TextEdit that comes with OS X. You will get a lot of "garbage" formatting text before & after the actual text. That formatting can be many pages long.
    Third would be to look at the options available from Panergy Software. They do have demo software to try.

  • How to convert clob column to long

    Hi,
    Is there any way to convert clob column to long.
    Here below is my scenario..
    Instead of using substr function
    CREATE OR REPLACE PROCEDURE proc AS
    sql2 clob := '';
    sqlstring1 LONG;
    sqlstring2 LONG;
    sqlstring3 LONG;
    sqlstring4 LONG;
    sqlstring5 LONG;
    sqlstring6 LONG;
    sqlstring7 LONG;
    sqlstring8 LONG;
    sqlstring9 LONG;
    sqlstring10 LONG;
    BEGIN
    FOR sql1 IN (SELECT info FROM emp)
    LOOP
    sql2 := sql1.sql_string;
    sqlString1 := dbms_lob.SUBSTR(sql2, 8000, 1);
    sqlString2 := dbms_lob.SUBSTR(sql2, 8000, 8001);
    sqlString3 := dbms_lob.SUBSTR(sql2, 8000, 16001);
    sqlString4 := dbms_lob.SUBSTR(sql2, 8000, 24001);
    sqlString5 := dbms_lob.SUBSTR(sql2, 8000, 32001);
    sqlString6 := dbms_lob.SUBSTR(sql2, 8000, 40001);
    sqlString7 := dbms_lob.SUBSTR(sql2, 8000, 48001);
    sqlString8 := dbms_lob.SUBSTR(sql2, 8000, 56001);
    sqlString9 := dbms_lob.SUBSTR(sql2, 8000, 64001);
    sqlString10 := dbms_lob.SUBSTR(sql2, 8000, 72001);
    EXECUTE IMMEDIATE sqlString1 || sqlString2 || sqlString3 ||
    sqlString4 || sqlString5 || sqlString6 ||
    sqlString7 || sqlString8 || sqlstring9 ||
    sqlstring10;
    END LOOP;
    COMMIT;
    END proc;
    Any help really appreciated
    Thanks

    We cannot execute clob dynamically.That's what I said: execute immediate doesn't support CLOB!
    But you can concatenate two long's:
    SQL> DECLARE
       l_stmt1   LONG;
       l_stmt2   LONG;
    BEGIN
       l_stmt1 := RPAD ('BEGIN ', 32500, ' ');
       l_stmt2 :=
           RPAD ('  dbms_output.put_line(''Hello World'');', 32500, ' ')
           || 'END;';
       DBMS_OUTPUT.put_line ('Length of statement: '
                             || LENGTH (l_stmt1 || l_stmt2)
       EXECUTE IMMEDIATE (l_stmt1 || l_stmt2);
    END;
    Length of statement: 65004
    Hello World
    PL/SQL procedure successfully completed.So if you strip some extra spaces or try to compact your statement somehow, you might be able use above method.

  • I need a formula to convert a date into an integer (for use in Lookout)

    I have a DATA logger with the following:
    40001 = 4 (2004)
    40002 = 2 (February)
    40003 = 5 (5th)
    40004 = 13 (1:00pm)
    40005 = 12 (12 minutes)
    Lookout requires a date that it understands (eg. January 1, 1900).
    All I need is a basic formula to convert the date and time.
    This formula does not need to be specifically written for Lookout. Just a basic formula that I can do on paper or a calculator.
    I can integrate that formula into the Lookout software myself.

    Hello Smigman,
    First of all, I apologize in advance for not giving you "just the formula." And for the lengthy explanation (had to wait till after work hours), which you are very likely aware of already. I am writing this response in much detail so that it may benefit others.. hopefully And so that we understand the underlying principle involved, which will hopefully help us in building the formula the best way that suits us.
    As you have figured out, the data and time in Lookout is represented as a real number. This real number's integer portion represents days, and the decimal portion denotes time. The integer portion is basically the number of days since 01/01/1900. And the decimal portion is the number of seconds since midnight.
    So, for instance, if you insert the today() Expression in Lookout, you'll get a integer 38022 (which corresponds to today, Feb. 5th, 2004). In other words, today is the 38022nd day since 01/01/1900. Tomorrow, Feb. 6th 2004, will be 38023 and so on.
    The decimal part denotes time. A day has 24*60*60 = 86400 seconds, obviously. So, 1/86400 = 1.15741E-5 roughly represents one second. For instance, 38022.00001157 will give 02/05/2004 00:00:01.
    Coming to the formula now, for Time, first convert it to total seconds from midnight. E.g., 5:15:07pm would be (17*60*60) + (15*60) + 7 = 62107 seconds total since midnight. To get the Lookout's decimal part, divide this by 86400.
    62107/86400 = 0.71883102
    Therefore, 38022.71883102 would now give 02/05/2004 17:15:07. Computing Time is relatively easy.
    For the Date -- which is more complicated-- you could keep track of the total number of days either from 01/01/1900, or better still, a more recent day, like say 12/31/2003, which corresponds to 37986. To this reference you will keep adding 1 for each additional day to get the number for the current day. Note, you will have to accomodate leap years (Feb. 29th of this year, for instance).
    It's very helpful to have the reference day as the last day of the past year. That can be derived by counting the number of days since 01/01/1900 as follows:
    104 years * 365 days = 37960;
    + 1 day for each leap year
    A leap year is a year divisible by 4 (and 400 if the year ends with two zeros). There were 26 leap years from 1900 till 2003.
    So, 37960 + 26 = 37986. 12/31/2003 is thus represented by 37986.
    To get the integer for the Current Date we would first find what day of the year it is. Then add it to the reference day. Feb 5th, is the 36th day of the year. Adding this to 37986, gets us 38022.
    In your case you will have to come up with the correct day of the year using registers 40002 and 40003. Not sure if this helped or confused you more.
    I tried
    Khalid

  • How to convert real media files to quicktime for iPod

    I want to know how to convert a real media file into a format that is recognizable by my iPod. Do I need to convert it into a Quicktime movie? And if I already have quick time movies on my computer, will they play on my iPod without any need of conversion?
    Thanks

    MP4 is the format you need. You will need a third party program to convert it for viewing on your ipod. See this link
    http://forums.ilounge.com/showthread.php?s=&threadid=123067
    There are many freeware programs out there for convertering. Beware of people that will direct you to a site where you have to pay for the program. There are many Spammers on this forum that will try to have you buy a particular program. Do a search for free conversion programs and you will find many.

  • How to convert java class to dll file for using in Microsoft Technology(.n)

    hey hemmj !!!!!!
    nice replying , first of all i d like to say thanks for response me so frequently..... i like such type of guy... i d never forget ur online support.
    hey buddy, i ve a problem with applet application...
    i m working on java chat server build on swing applet. As it is chat server, it is divided into two parts, one is server application and other is client application. I want to run this server app on the client server and the basic thing with this site is that it is running on .net platform(Microsoft). and the other app ll running on the client machine or end user. Now the problem is that this site would run only if the server app ll be run on server. This server app ll open the socket of server, which ll listen the request of the user...... So, the requirement is to convert this java sever class file into dll file and register this dll file with the IIS server.So, It run and stop with the IIS server.
    I ve already search the way to convert the java class file into dll file. This is possible in such way........... below code is for the java class file...
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class chatServer
    public static void main(String args[]) throws Exception
                        ServerSocket sersoc=new ServerSocket(1234);// Any port number above 1000 should do
    // as most ports below 1000 are used by system
    Vector socvec=new Vector();
    String data="";int i,j=0;
    BufferedReader in;
    //System.out.println("Listening of port " + sersoc.getLocalPort());
    //System.out.println("Waiting for connections...");
    while(true)
    Socket soc=sersoc.accept();
    socvec.addElement(soc);
    chatServerReadThread csrt=new chatServerReadThread(socvec, soc);
    in=new BufferedReader(new InputStreamReader(soc.getInputStream()));
    PrintStream out=new PrintStream(soc.getOutputStream());
    out.println("Connected to chat server");
    out.flush();
    data= in.readLine();
    for(i=0;i<socvec.size();i++)
    soc=(Socket)socvec.elementAt(i);
    out=new PrintStream(soc.getOutputStream());
    out.println(data + " connected");
    out.flush();
    //System.out.println(data + " connected");
    csrt.start(); // error is comming from here..... plz help me.
    class chatServerReadThread extends Thread
    Vector socvec;
    PrintStream out;
    chatServerReadThread(Vector socvec, Socket soc)
    this.socvec=socvec;
    try
    out=new PrintStream(soc.getOutputStream());
    }catch(Exception e){}
    public void run()
    try
    String data;
    Socket soc;
    BufferedReader in;
    while(true)
    for(int i=0;i<socvec.size();i++)
    soc=(Socket)socvec.elementAt(i);
    in=new BufferedReader(new InputStreamReader(soc.getInputStream()));
    if(in.ready())
    try
    data=in.readLine();
    if(data.charAt(0) == ']')
    data = in.readLine() + " exited";
    //System.out.println(data);
    socvec.removeElement(soc);
    for(int e=0;e<socvec.size();e++)
    soc=(Socket)socvec.elementAt(e);
    out=new PrintStream(soc.getOutputStream());
    out.println(data);
    out.flush();
    else
    for(int e=0;e<socvec.size();e++)
    soc=(Socket)socvec.elementAt(e);
    out=new PrintStream(soc.getOutputStream());
    out.println(data);
    out.flush();
    }catch(Exception e){socvec.removeElement(soc);}
    }catch(Exception e){e.printStackTrace();}
    first i ve made the jar file of this class
    jar cvf chatServer.jar chatServer.classafter getting the jar chatServer.jar. I ve opened the .net dos prompt and
    type this command which ll make dll file automatically....
    > jbimp /t:library chatServer.jar
    And you'll see the following output:
    Microsoft (R) Java-language bytecode to MSIL converter version 1.1.4322.0
    for Microsoft (R) .NET Framework version 1.1.4322
    Copyright (C) Microsoft Corp 2000-2002. All rights reserved.
    Created chatServer.dll
    I cant get the problem origin from where it is comming, when i tried to convert it into .dll file it shown an error that, it did not recongnized the method in first class
    public static void chatServerReadThread.start() method
    is not recognized by .net dos prompt commnad. But when i omit this method it gets created the .dll file. This start method is basically the default method of thread class that run the thread from the same class..
    By vewing the code u can visulize the thing,, i ve marked the code from where the error is comming.
    Plz do it as soon as possible, i ll waiting for ur reply......
    I ll be really thanking u for that....
    Thanx and regards
    Niraj Kumar Singh

    I wonder if this will work:
    jbimp /t:exe chatServer.jar
    Your chatServer is an application that can be started from the commandline.
    A dll is a library to be used in com, com+, other executables or ....

  • Trouble converting "double like" string to integer

    Hi everyone,
    I have a trouble here. Let's say I have a string which its value is "314.12345667". the value is "like a double". How do i convert it into an integer where the integer only takes the value of da string before the decimal point (as in the value of string = 314 only)? Thanks for helping.

    hi xamule,
    tey this..
    String s="314.123876"
    double d=Double.parseDouble(s);
    int x=d.intValue();
    hope it may help u..
    bye bye,
    Pramod

  • How to convert string date to long (or Unix date)?

    I'm having difficulty in converting a user supplied date in the format mm/dd/yyyy to a long format such as 1035462807000. Since it's being entered by the user I can't just use the current system date. Any suggestions? Thanks!
    Dave

    Hi man, tsith Gave a good beggining, why dont you try the next code
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.text.ParseException;
    import java.util.Date;
    public class DateToUnix{
        public static void main(String args[]){
            getDateAsLong();
        public static void getDateAsLong(){
            String sStartDate = "12/01/2002";
            Date theDate;
            DateFormat sdf= new SimpleDateFormat("MM/DD/yyyy" );
            try {
                theDate = sdf.parse( sStartDate );
            }catch(ParseException e ){
                theDate = new Date();
            System.out.println( "Converted Start Date:" + theDate.getTime());
    }No mather how you get a Date object, the value you are looking for is a long, and you can get it from such object with the getTime() method.
    Take a look at the Java API @ [http://java.sun.com/j2se/1.4.1/docs/api/java/util/Date.html#getTime()]

  • How to convert a character into an integer!!

    I'm a bigginer in Java Programming...
    my problem is that I want to conver the word (red) into a real integer VALUE to be used in a switch case!!
    here's a part of the code which make a problem to me
    String s=c1.getSelectedItem();
                   switch (s)
                        case "red";
                        l1.setBackground(Color.red);
                        break;
                        case "yellow";
                        l1.setBackground(Color.yellow);
                        break;
                        case "green";
                        l1.setBackground(Color.green);
                        break;
    It didn't work, so I need a value like 1 to be assigned to the word (red) and another value like 2 to be assigned to the word (green)...etc
    HOW?.........ANY HELP?

    first of all, there has to be a better way than this, but since you're only using red yellow and green, you could put it inside a char like this
    char r = ((String) c1.getSelectedItem).charAt(0);
    switch (s)
        case 'r':
            l1.setBackground(Color.red);
            break;
        case 'y'
            l1.setBackground(Color.yellow);
            break;
        case 'g':
            l1.setBackground(Color.green);
            break;
    }also I noticed you use ; instead of :
    a case expects a : after case value, and not a ;
    secondary, you could also work with getSelectedIndex Id think, but i'm not sure since I do not know what you're asking a selection from.
    if it's a JList with strings representing colors, you could design a specialisation class of Color with a custom toString (used by the default ListCellRenderer) and then have it return the color object (getselectedItem returns an Object value, so you can cast that into your custom color and assign that to your background, you wouldnt even need a switch case, but I have to agree it's not very simple if you're new to java)
    anyways I hope this helped, i'd first try it with : instead of ; tho, i do not know if switch case support strings since strings are objects and not primitives. so if that doesnt work try to work with the char, if you get duplicates i'd work with getSelectedIndex() which returns an int (you can work with a Color object array with similar running indices where index 0 in the color array is in index 0 of your list array, once again removing the need for a switch case
    well I think i'm done now ;)
    PS: you can use the forums [ code ] and [ code ] tags to make your copy/pasted code much clearer to see. (use them without the spaces, I had to add those or it was not visible)

  • UDF: How to convert string with sign into integer

    Hi
    I have a number e.g 123456 (xsd:string) and sign - or + (xsd:string) and both are concatenated and fed into UDF. I want this string to be converted into Integer. If I use the below kind of statement it is not working and throwing the below error.
    int BilledAmount  = Integer.parseInt(b[0]);
    Exception:
    RuntimeException in Message-Mapping transformation: Exception:[java.lang.NumberFormatException: For input string: "+000000000006684"]
    Any guess on this issue ??
    Regards
    Kumar

    Hey buddy,
    Hope you are doing gr8, I'm getting ready leaving this friday..:-)
    Aamir b[0] doesn't correspond to the first character of the string. He has multiple input values, hence he is using Context. See my structure and UDF I mentioned above, actually the above is his requirement I believe.
    Yes, If you have + symbol in front of String and if you try to conver to Integer object it will throw an exception. Coz it doesn't make sense to add + symbol at all. if you don't have any sign in front it implies it's positive, am I right? But in case of negative, you need to explicitly include - symbol in front.
    This is the reason that java couldn't able to convert the string that has + symbol in front, but it can in case it has - symbol in front.
    I hope it clears a bit..
    raj.

  • How to convert short timestamp to long time stamp.?

    Can anybody help on converting a short time stamp into long timestamp?
    Regards
    Nitin

    Hi,
    CONVERT: DATE p_date TIME p_time INTO TIMESTAMP l_timestamp TIME ZONE sy-zonlo.
    thanks\
    Mahesh

  • LS9 Notation How to convert double flat to natural.

    In trying out Notation for the first time and working in D flat key signature with a midi A3 note it shows in the score as a B double flat.
    How do I get it to show in the score as an A natural, but leave the midi at A3?

    You can use String.valueOf() or you can use java.text.DecimalFormat it you want to control the format:
    String s1 = String.valueOf(doubleValue);
    //or, with DecimaFormat
    NumberFormat nf    = new DecimalFormat(" 0000.E00");
    String s2 = nf.format(doubleValue);Iulian

Maybe you are looking for

  • Urgent - ABAP subroutines - Proxy method

    I am coding a proxy method. I had to code a BDC call transaction. For this I have defined 2 sub-routines. One BDC_DYNPRO (for screen chnage) and BDC_Insert(for inserting the fields). When compile the code, it is giving an error in the line just above

  • Zen Vision M : 60GB sound issue solv

    Hello, yesterday, i?we bought a ZEN Vision M:60GB player and a after playing few tracks, i was looking for a reason of sound hissing a scratching. In this forum i found an answer why,but i cannot find if it was patched or repaired in next firmware Fo

  • Enable RDA for customized datasource

    Hi Please let me know step by step process how to enable RDA for customized datasource ( generic extraction by FM) and how tio enable for standard datasource

  • Is there a SIM lock for iPad 3G? Can we use other than AT

    Can we use other data SIM to operate iPad 2 bought in US?

  • Creating an icon box with a website template

    Hey fellow dreamweavers,      I want to add a social media icon set(facebook,twitter,etc,) in the corner of my website, the thing is i am using a premade template that didn't come with one how can i create a box to add the icons. thanks, vx