Modbus real to unsigned integer conversion

Is there any alternative way of decoding the two unsigned integer 16 bit words received through Modbus when using reals? I am using the join numbers and type cast functions; however I am not able to download the complete Modbus list to a compact RIO with 32 MB RAM as it runs out of memory.

Khalid,
Thanks for your response. However, let me tell you more about my problem:
Basically my project consists of:
1. A list of shared variables within a library that also contains modbus slave with the communication settings.
2. (5) VIs that used to convert UInt16 to Single (for inputs) and Single to UInt16 (for otputs)
3. (1) VI to display information
As I try to download into a cRIO-9002 with 32MB of RAM, the device drops the communication and goes into safe mode, blinking the STATUS light 4 times, this means "run out of memory" .
I would like to know if there is any other alternative way to overcome this problem. Join and cast is functionally correct but it uses too much RAM

Similar Messages

  • Unsigned int to integer conversion

    Hi,
    I have an unsigned integer column in my database table. If I try to retreive the value of the column using resultset.getInt() I'm getting "Numeric value overflow" error as it exceeds the INT_MAX value.
    For eg., if the column value : 4294967295, the expected value from resultset.getInt() is -1 or Numeric Value Overflow error ?
    Is it valid to retrieve the value using getInt() or should I use getLong()?.
    Kindly Clarify.
    Thanks,
    Radhika.

    use getLong

  • Php Pack/unpack unsigned integer equivalent

    I'm trying to port some PHP code into Java which contains calls to Pack and Unpack which I'm trying to use which I'm having some problems with converting.
    I realise Java doesn't have these functions but I've been fiddling around and looking around the net trying to get a solution. The php is using 'I' as its format mask which is Unsigned Integer so I've used :
    Integer.toBinaryString(toStringInt)
    which should be returning the unsigned integer but I'm having trouble trying to get it back from the binary string.
    When I stick the result of the above code into Integer.parseInt(string, int) it gives me a number format exception
    Can anyone help?
    Thanks

    ok but how do I set the lower 32 bits? And what is setting the highest bit even doing because I have no idea how the server will respond if I don't set it. As I said I'm porting this from PHP which does all of this and doesn't explain why so I don't know what it's doing it for. The PHP is
    function _encodeHeader($isFromServer, $isResonse, $sequence)
         $header = $sequence & 0x3fffffff;
         if($isFromServer)
         $header += 0x80000000;
         if($isResponse)
              $header += 0x40000000;
         return pack('I', $header);
    That is what I'm porting from so that is why I'm setting the highest bit.

  • How to return array of unsigned integer pointer from call library function node & store the data in array in labview

    I want to return array of unsigned integer from call library node.
    If anybody knows please help me
    Thanks & Regards,
    Harish. G.

    Did you take a look at the example that ships with LabVIEW that shows how to do all sorts of data passing to DLLs. I believe your situation is one of the examples listed. You can find the example VI in the "<LabVIEW install directory>\examples\dll\data passing" directory.

  • Convert 8 bit unsigned integer to binary (base 2)

    i am trying to convert an 8 bit unsigned integer to binary (base 2) representation and use 8 LED's to show this representation.
    Like for integer 10, the binary is 00001010.....so the LED' s 1 and 3 should be on...

    The LED (boolean) indicators are simply placed into an array.
    To "borrow" an example of such a display, you could have a look at the code written for the parallel port example that can be found under the Help menu:
    Help > Find Examples :  Search "parallel"  HAve a look at the 1st or 2nd example.  They have LED's wired to a U8 array  (I think..  It's been a while since I looked at the example...   )

  • Unsigned integer problem

    Hi,
    I have a problem of converting a CRand32 function from C to Java which was originally from IDA decompiler.
    There's one thing that's troubling me for quite a long time which is the lack of unsigned types, I could not do operations such as byte shifting correctly and the end result I get is sometimes a negative number or larger than 4billion.
    This CRand function should only generate 0 ~ 4billion.
    Can anyone enlighten me in this? As it's the first time I am doing such things.
    Here's the code I have from direct translation from C to Java :
        private transient long seed1, seed2, seed3; // In the code this is an unsigned int_32
        public final long CRand32__Random() {
         // assume the seed is already an unsigned long..
         seed1 = ((seed1 & 0xFFFFFFFE) << 12) ^
              (((seed1 << 13) ^ seed1) >> 19);
         seed2 = ((seed2 & 0xFFFFFFF8) << 4) ^
              (((seed2 << 2) ^ seed2) >> 25);
         seed3 = ((seed3 & 0xFFFFFFF0) << 17) ^
              (((seed3 << 3) ^ seed3) >> 11);
         return (seed1 ^ seed2 ^ seed3);
        }Thanks,
    Edited by: LightPepsi on May 30, 2010 11:40 PM
    Edited by: LightPepsi on May 30, 2010 11:40 PM

    LightPepsi wrote:
    That was the first thing which comes to my mind by changing >> to >>>, however the numbers generated are usually not within the range of an unsigned integer.
    It can be sometimes a negative number or larger than 4 billion and thus making the randomizer inaccurate.One possibility is to use ints for the internal shifts, but create a long as
    long unsignedValue = intValue & 0xFFFFFFFFL;for returning the number and possibly for any internal comparisons you need to make.
    Winston

  • Real time sample rate conversion?

    Recently upgraded all my hardware and software.. I want to record audio at 96khz - so I set my hardware to 96 and set logic to 96 in audio - no problem... except when I want to record new audio on an old project - I set the software to 96khz, and hey presto my old files recorded at 44.1 play too fast....
    The ref manual says logic will do real time sample rate conversion, but doesn't suggest how this is done.
    If I have my hardware set to 96khz but Logic to 44.1 so the old audio plays okay will my new audio still be recorded at 96?
    I could probably convert all the files individually using the sample rate converter in Factory, but I want to avoid this lengthy process as I'm talking the last 8 years of work!
    Anyone out there know anything about this?

    Just fancied recording at the best quality possible - but you are right, the difference won't be that noticable and may even sound out of place.... in any case I can record at 24 bit with no adverse effect...
    I noticed that trying to record audio at 96 when my hardware is 96 and logic at 44.1 has the effect of serious latency issues plus disk too slow errors. So forget that one.
    Someone told me recently that the difference in bit resolution is more audibly noticable as a change in audio quality than sample rate... just out of interest I wonder if anyone knows if this is true?
    BTW just recording guitars and stuff, some vocals, band kinda stuff...

  • Unsigned integer

    Hello,
    I am trying to wrap a c++ dll ,where most of the variables are (unit8,unit16,uni32 ) unsigned integers.
    Since java doesnt have usigned integer type,I am wondering what to do.
    1. Pass the usigned int value as a string to the c++ program.Convert from string to uint in the C++ code.
    would be one option.
    I am hoping that there are other options available to do this more gracefully.
    thank you very much,
    Regards

    I agree that signed and unsigned numbers differ in interpretation of the bits so one can disregard this when passing the data to/from DLL.
    When you get an uint32 from the DLL it can be stored in a Java int type:
    int i=fromDLL();but it should be converted to long when used:
    long ui=(long)i&0xffffffff;to pass "unsigned" to the DLL convert it to int:
    toDll((int)ui);You may also need to perform little/big-endian conversion.
    Dmitry Hudyakov
    Brainbench MVP

  • Writing double and unsigned integer to serial port

    Hi all
         I have a basic question.  I am trying to write a double or unsigned intger to serial port.  Is it possible to do so?  If it is he case, how do I do it?
    Thank you very much.
    Best
    Hideya

    Hideya,
    The serial port sends one text character at a time. So you must convert your numeric value to a text or string representation and then send the string.
    LabVIEW has several functions on the String palette for numeric conversions. You must decide how to represent the number as text, floating point or exponential notation, number of significant digits, and other formatting issues. These may be dependent on what will be done with the data after being sent.
    Lynn

  • Iteration a signed integer and not an unsigned integer, why?

    i was just wondering if there is a reason for keeping the iteration variable/indicator of a loop a signed 32 bit integer.
    it is never going to take a negative value.. then why signed; unsigned could have served the purpose
    Message Edited by Ujjval Shah on 07-08-2009 09:21 AM
    Solved!
    Go to Solution.

    Remember that array sizes are limited to I32 (the "size" input to initialize array is I32, the output of Array size is I32, etc), so running a FOR loop more than 2^21 times is not even possible (N is also I32).
    While loops can of course run forever, so if you need to increment a counter more than 2^31 times, you can use a shift register with U64, for example. However, don't even try to autoindex an output tunnel of such a loop, you're almost guaranteed to run out of memory before you reach the limits of I32.
    Using array indices as I32 has several advantages. For example sometimes you need an invalid index (Integers don't have NaN!), so having a negative number is very useful. For example if you use "search array" and no match is found, the output is -1.
    I suspect in the very long run these things will change. In another decade, all OSs will be 64bit or more and RAM will be mesured in TB. LabVIEW will need to evolve too to keep up. 
    LabVIEW Champion . Do more with less code and in less time .

  • Hex decimal n.o to integer conversion?

    how to convert 1 byte hex n.o in decimal form to the decimal integer of of 8 bit data .
    Solved!
    Go to Solution.

    Hi,
    You can use the Hexadecimal to Number fucntion. This is available in - Programming>String>String/Number Conversion.
    Alternatively you can search for hexadecimal to number conversion.
    Regards,
    Kanchan Bhakoo
    Applications Engineer | National Instruments

  • Byte - Integer Conversion

    I have four bytes that I want to store directly into an integer and then read back out again. I've spent forever trying bitshifts and division/modulo, but to no avail...with Java not supporting unsigned values, I can't figure it out...what I want is this:
    [00000000][00000000][00000000][00001111] (four individual bytes)
    STEP ONE: is converted to
    [00000000000000000000000000001111] (same sequence of bits in an int)
    and then some operation is performed (let's say adding one)
    [00000000000000000000000000010000] (addition on the integer)
    STEP TWO: and afterwards the integer is converted back
    [00000000][00000000][00000000][00010000] (four individual bytes)

    use parenthesis a lot until you know operator precedence
    and use 0xff & byte to get rid of sign extension
    public class ByteInt {
    public static void main(String[] args) {
      int i;
      byte b3, b2, b1, b0;  // b3 is highest order byte
      b3 = 0x12;
      b2 = 0x34;
      b1 = 0x56;
      b0 = 0x78;
      i = (0xff & b0) | ( (0xff & b1) << 8  )
                      | ( (0xff & b2) << 16 )
                      | ( (0xff & b3) << 24 );
      System.out.println(Integer.toHexString(i));
      System.out.println("");
      i = 0xf1827456;  // f1 82 74 56
      System.out.println(Integer.toHexString(i));
      System.out.println("");
      b0 = (byte)   (i & 0xff);
      b1 = (byte) ( (i & 0xff00)     >> 8  );
      b2 = (byte) ( (i & 0xff0000)   >> 16 );
      b3 = (byte) ( (i & 0xff000000) >> 24 );
      System.out.println(Integer.toHexString(b3));
      System.out.println(Integer.toHexString(b2));
      System.out.println(Integer.toHexString(b1));
      System.out.println(Integer.toHexString(b0));
      System.out.println("");
      System.out.println(Integer.toHexString(0xff & b3));
      System.out.println(Integer.toHexString(0xff & b2));
      System.out.println(Integer.toHexString(0xff & b1));
      System.out.println(Integer.toHexString(0xff & b0));
      System.out.println("");
    } // method
    } // class

  • I have doubt regarding the byte to integer conversion.

    In java card epurse application the output we see is in bytes.to convert this byte to integer which is understandable by the end-user what should be done?

    809295 wrote:
    In java card epurse application the output we see is in bytes .
    to convert this byte to integer which is understandable by the end-user what should be done?What do you mean by we ?
    How many bytes ?
    On a java card platform support for integer is optional, you may only have short.
    I assume by understandable by the end-user you mean display as a sequence of decimal digits ?
    So two bytes 0x04 0xd2 (combined to a short 0x04d2 which is 1234 decimal)
    should be presented to the user as 0x31 0x32 0x33 0x34 (ascii values for '1' '2' '3' '4').

  • Character to Integer Conversion

    hi all,
    can anyone please tell me that how to convert Charecter to Integer? i have a value in
    itab-kunnr = '0000023004'. i have to remove 0 in left side and need value only '23004'.
    KUNNR is a Charecter.
    regards saurabh.

    hi
    you can use MOVE, write or just assign it to the
    required variables.
    just have a look at the documentation for the MOVE
    hope this helps
    regards
    Aakash Banga

  • Error in Integer conversion method  equals(...)???

    Example:
    Integer I = new Integer(0);
    If (i.equals(0))
    �.
    As far as I know, equals(Object obj)�. Therefore, i.equals(0) should generate a compilation error. However, I teststed this with JCreator with the latest 1.6.0_03 jdk. It accepts it and treat the �0� as the actual value.
    Therefore, if I do:
    Integer I = new Integer(0);
    If (i.equals(0))
    �.
    i.equals(0) return true. Shouldn't it be invalid instead? If returning true is correct, your documentation should reflect so. http://java.sun.com/docs/books/tutorial/java/data/numberclasses.html.
    Input is greatly appreciated.

    That's due to autoboxing. See http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
    If you want to see something really screwy, what do you think this returns?
    Object o = true ? new Integer(1) : new Double(2.0);

Maybe you are looking for

  • How to quickly switch between straight and curly quotes?

    I've recently moved from a Windows XP machine with MS Office to a Mac Pro with Pages. For the kinds of documents I typically work on, sometimes I need to have straight quotes, and sometimes curly quotes. With MS Word, I was able to create a couple of

  • Substitution variable in javascript

    Can you use the value substitution variables like WORKSPACE_IMAGES and IMAGE_PREFIX in a javascript function? When I use the $v function to retrieve the value it returns undefined.

  • Problem w/FB2 Mac OS X Design mode

    Can not switch to design mode w/o getting this error message ""An unknown item is declared as the root of your MXML ". This msg pops up even with a new file generated by the builder wizard. This bug doesn't exist on winXP with the same file, so this

  • Connect to 32" LCD TV from Lenovo T61 with a VGA connector

    Hi, I am trying to connect to 32" LCD TV 1080P from T61 with a VGA connector. When I do (Fn+Ctrl+F7) I can see the T61's output on my TV if I set T61's display setting as 1280x768. Then If I increase the resolution on the TV the screen becomes black.

  • HT5312 how can i change my rescue email?

    How can iI change my rescue email? My original apple id email is no longer valid and I would like to change my apple id to what is currently my rescue email. I have a secondary email that I can change to my rescue email. However, because I could not