8 bit Array onto 10 bit Array

Hi
   I am trying to convert a array of U8 into a 10 bits array (take the first 8 bits then add the next 2 bits of the next byte then the remaning 6 bits with the next 4 bits and so on). The ram we are using is 8bit but the
CCD image it actually 10 bit, i have attached a couple of jpegs to show what i have done and i was wandering weather there is a expert around to say if this is the most efficient way of doing this. I have a large
arrray to convert and would like to make it as quick as possible.
Thanks for any help Gary
Attachments:
Front Panel.jpg ‏57 KB
Block Diagram.jpg ‏56 KB

Gary,
Reshaping an array of bits is quite easy and (imho) the block diagram code is much easier to understand.
For arrays of a different size you will just have to calculate the first dimension for the resize operation. 
Regards
Anke 
Message Edited by AnkeS on 11-19-2008 10:16 AM
Attachments:
8to10.png ‏4 KB

Similar Messages

  • WinXP-64 bit corrupts existing RAID array

    I've got an MSI K8N Neo2 Platinum motherboard running Win XP Pro SP2 on two 36 gig SATA Raptors.  Everything was working fine, but I wanted to try the 64 bit version of XP.  Grabbed an old 80 gig PATA drive and threw that in the case.  Unplugged the SATA drives so as not to risk messing with the existing working OS.  Installed the latest 1218 x64 beta and it worked well.
      The problem was that when I shut down and reconnected my old RAID array, windows wouldn't boot from it.  I lost everything and had to rebuild Windows from scratch.  So now I know to never unplug the SATA drives   
      Rebuilt WinXP on the RAID array and then tried rebooting with the PATA drive with the 64 bit OS.  Came up with the "drive needs checking" screen, and proceeds to "fix" the RAID array while ignoring my frantic pounding on the Logitech USB keyboard to stop.  Rebooted and yes, the new install was nuked.  Okay, since it's gone anyway, reboot to the 64 bit OS and make sure it's got the 64 bit RAID drivers installed.
      Reinstall WinXP on the RAID array, reboot to the 64 bit OS on the other drive and the same old scandisk comes and nukes it AGAIN!
      So now the PATA drive is sitting on the shelf again, unless someone here can suggest what is causing this problem.
    System Specs
    Athlon64 3500
    gig of PQI 3200 at 2-2-2-5 2.6
    2x36 gig Raptors on ports 3-4
    Plextor PX-716a DVD+_RW
    Visiontek X800 Pro.

    The first time you re-installed Win 32 on the raid that was a bit drastic. A repair ought to have done the job.
    The problem was probably that you disconnected the array but that's where the boot.ini was and that file needed to be modified to add the path to the Win64 install.
    Since you took out the array the Win64 install created a new boot.ini on the PATA drive. Even when you tell BIOS to boot off the array, Windows has a bad habit of looking at the IDE channels & using the boot.ini if it finds one there - but the file it found didn't point to the array of course.
    So basically if you already have Win32 on the array I would leave that array connected normally when installing Win64 on the PATA drive and all should be well.
    I've installed Win64 on the same array as my Win32 install and they co-exist happily. I reckon that's the most efficient way to do it. The main thing is to make separate partitions for Win32, Win64 and data files when you install Win32 in the first place. The two OSs can share the same data files, incuding stuff like email.

  • How do I convert an array of BYTES (where each BYTE represents a bit) into a single Hex number?

    I am reading a signal from a USB-8451. This signal is stored as an array where each element represents a bit in the signal, but is stored in the array as a byte. How do I convert this array into a single Hex number. I attatched what I have so far, there are a few extra things to help me see what ia going on. One code uses Queue and the other uses arrays, let me know if you can help.
    Attachments:
    845x_EEPROMarrays.vi ‏27 KB
    845x_EEPROM.vi ‏26 KB

    mkssnwbrd wrote:
    ... so we can't introduce any other forms of signals or power into the circuit other than what the circuit already has. Trithfully I don't really know how I2C devices work, but my mentor here says that we can't use an I2C method becuase it will introduce voltage into the circuit and may damage out TCON chip.
    That makes absolutely no sense. What do you think is happening when you write the digital lines? You're setting a pin high. That voltage is being generated by the 8451x. I think you're not understanding what your mentor is saying. If it's an I2C device then you should be able to use the I2C function to simply talk to it. You still have not indicated what the device is, so there's little more I can say about that aspect of it.
    As far as the conversion is concerned, you basically need loop through your array of "bits", taking 16 at time since you said you have 16-bit values. It's not clear from your code whether your eventual goal is to get a numeric value or a string. This does not appear to be a subVI, so a simply numeric indicator formatted to display in hex format should be quite adequate. The array you are generating is an array of rings, whose datatype is I32, but they will have values of 0 or 1. You can use the example just posted, or you can use the attached variation.
    Attachments:
    Bits to Hex 2.vi ‏17 KB

  • How to add 16 bit message sequential number to the byte array

    hi
    iam trying to implement socket programming over UDP. Iam writing for the server side now.I need to send an image file from server to a client via a gateway so basically ive to do hand-shaking with the gateway first and then ive to send image data in a sequence of small messages with a payload of 1 KB.The data message should also include a header of 16 bit sequential number and a bit to indicate end of file.
    Iam able to complete registration process(Iam not sure yet).I dnt know how to include sequential number and a bit to indicate end of file.
    I would like to have your valuable ideas about how to proceed further
    package udp;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Sender  {
        protected BufferedReader in = null;
        protected FileInputStream image=null;
        protected static boolean end_of_file=true;
    /** pass arguments hostname,port,filename
    * @param args
    * @throws IOException
       public static void main(String[] args) throws IOException{
            DatagramSocket socket = new DatagramSocket(Integer.parseInt(args[1]));
            boolean more_messages = true;
              String str1=null;
                * gateway registration
                try{
                     //send string to emulator
                    String str="%%%GatewayRegistration SENDER test delay 10 drop 0 dupl 0 bandwidth 1000000";
                    byte[] buff=str.getBytes();
                    InetAddress emulator_address = InetAddress.getByName(args[0]);
                    DatagramPacket packet = new DatagramPacket(buff, buff.length,emulator_address,Integer.parseInt(args[0]));
                    socket.send(packet);
                        // figure out response
                    byte[] buf = new byte[1024];
                    DatagramPacket recpack=new DatagramPacket(buf,buf.length);
                    socket.receive(recpack);
                   // socket.setSoTimeout(10000);
                    String str2=str1.valueOf(new String(recpack.getData()));
                    if(socket.equals(null))
                         System.out.println("no acknowledgement from the emulator");
                        socket.close();
                    else if(str2=="%%%GatewayConfirmation")
                    //     String str1=null;
                         System.out.println("rec message"+str2);
                    else
                         System.out.println("not a valid message from emulator");
                         socket.close();
                catch (IOException e) {
                    e.printStackTrace();
                      end_of_file = false;
         /**create a packet with a payload of 1     KB and header of 16 bit sequential number and a bit to indicate end of file
      while(end_of_file!=false)
          String ack="y";
          String seqnum=
           File file = new File(args[2]);                               
                    InputStream is = new FileInputStream(file);                 
            socket.close();
      private byte[] byteArray(InputStream in) throws IOException {
             byte[] readBytes = new byte[1024]; // make a byte array with a length equal to the number of bytes in the stream
          try{
             in.read(readBytes);  // dump all the bytes in the stream into the array
            catch(IOException e)
                 e.printStackTrace();
            return readBytes;
      

    HI Rolf.k.
    Thank you for the small program it was helpfull.
    You got right about that proberly there  will be conflict with some spurios data, I can already detect that when writing the data to a spreadsheet file.
    I writes the data in such a way, that in each line there will be a date, a timestamp, a tab and a timestamp at the end. That means two columns.
    When i set given samplerate up, that controls the rate of the data outflow from the device, (1,56 Hz - 200 Hz),   the data file that i write to , looks unorderet.
     i get more than one timestamp and severel datavalues in every line and so on down the spreadsheet file.
    Now the question is: Could it be that the function that writes the data to the file,  can't handle the speed of the dataflow in such a way that the time stamp cant follow with the data flowspeed. so i'm trying to set the timestamp to be  with fractions of the seconds by adding the unit (<digit>) in the timestamp icon but its not working. Meaby when i take the fractions off a second within the timestamp i can get every timestamp with its right data value. Am i in deeb water or what do You mean!??
    AAttached Pics part of program and a logfile over data written to file
    regards
    Zamzam
    HFZ
    Attachments:
    DataFlowWR.JPG ‏159 KB
    Datalogfile.JPG ‏386 KB

  • DSC - Write Trace - Bit Array or Logical

    Hi,
    we are trying to write digital signals to a citadel database. The polymorphic function "Write Trace.vi" has the types logical and bit array.
    First of all I have created a new database and tried to write 10 digital signals of type boolean to the database. Unfortunately I get an error: "SPW_WriteBool.vi:2". I only can write the data into the citadel database if I convert the boolean to 0 and 1 values and write them via the numeric type. But this causes an overhead of factor 32.
    Is there a sample vi of using the "Write Trace.vi" function of type Logical or Bit Array. I've noticed that the trace which I have created is a analog one of type double. In another database of our company I've found a discrete trace of type double. Is this the problem?
    Kind Regards
    Joachim

    Many thanks for your help. MAX would be a nice and easy way to view the data, by the way, I try to view them with the Mixed Signal Graph. I am very new to LabVIEW and I am fighting now in correct reading of my data. I have 32 digital channels - each value of them is packed in an U32. When making a loop of my example 2 times for each channel should contain 2 values. But how can I program that the first boolean of the U32 is part of digital channel 1 - second boolean is part of digital channel 2 and so on? I've read that I can only transpose 2D arrays. Enclosed I've programmed the visualization of 2 digital channels containing 32 datapoints. But the result should be 32 channels with 2 datapoints.
    Kind Regards,
    Joachim
    Attachments:
    read from citadel - bit array.png ‏8 KB

  • Using conversion to array to add 16 bit grayscale images

    Dear all,
    Usual disclaimers, first post, tried to search using a variety of terms, no luck, so posting a new question!
    I am trying to perform a running a verage of a 16 bit grayscale image. I do not have access to the Vision development module.  My 'workaround' is to grab the image, convert to array and then, using a shift register, to add this array to that acquired at the previous loop iteration. The problem I am having is that the shift register, despite being fed data in a 16 bit unsigned word formatt, returns 8 bit data. The add function is then trying to add 16 bit to 8 bit data and returns an empty array.
    Can anyone help? Surely it must be possible to use shift registers with arrays of 16 bit data?
    Any help appreciated!

    Shift registers work with all datatypes. Can you show us your code?
    LabVIEW Champion . Do more with less code and in less time .

  • How to chnage number of bits in every packet of a byte array

    Hi I have an array of byte array of 1 and 0s. I would like to make sure every pack of 1 or 0s contains 8 number
    I can use this example to explain it better. Lets say I have this array
    111111110000000111111100000000
    As can be first pack of 0s and the second pack of 1s contain 7 bits. I would like to programaticaaly change it to 8 so the result should be
    11111111000000001111111100000000 
    As can be seen now evey pack of 1s or 0s contains 8 element . Could you please help me on this.A sample code would be great
    Many thanks

    Reshape array is your friend.Nevermind.  I just realized what you were going for.  Will need to rethink...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    8x bits long.png ‏21 KB

  • Save 16 bit array as image

    Hello,
    I am a new labview user. I am trying to save an image which is being
    correctly displayed on the front panel of my program as an intensity
    graph. I  am able to get a 2D array of the pixel values (using the
    variant to data function, the camera I use has an Active X interface
    with labview). The camera allows 16 bit or 12 bit digitization options.
    I would like to save the image pizel values as a 16 bit BMP or TIFF
    file. However, from what I understand, the flatten pixmap option in
    labview does not support 16 bit images. How do I go about saving my
    images? Any feedback would be extremely useful.
    Thanks,
    Sanhita

    Hello,
    have a look at this example and tell me if it works as you expect
    hope this helps
    Message Edité par TiTou le 07-07-2006 12:33 PM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    image.vi ‏106 KB

  • Managing bit flags in an array of bytes

    In my program, I have a large array of bytes. Some arbitrarily long groups of bytes in this array act as groups of bit flags. I need to be able to retrieve and manipulate these bit flags. I read that the best way to do this is with bitwise operations; something I have never learned before. I wrote methods that seem to work, but because I have never done anything like this before, can someone check my work?
    Here is an example program, where the only contents of the byte array is a single two-byte grouping of 16 bit flags:
    public class test
        static byte[] bytes = new byte[2];
        static byte[] pow2 = {1, 2, 4, 8, 16, 32, 64, -128};
        static byte[] pow2i = {-2, -3, -5, -9, -17, -33, -65, 127};
        public static void main(String[] args) throws Exception
            writeBitFlag(0, 6, true);
            for (int i = 0; i < 16; i++)   
                System.out.println("Flag " + i + ": " + getBitFlag(0, i));
            System.out.println();
            writeBitFlag(0, 12, true);
            invertBitFlag(0, 0);
            invertBitFlag(0, 0); 
            invertBitFlag(0, 1);
            for (int i = 0; i < 16; i++)   
                System.out.println("Flag " + i + ": " + getBitFlag(0, i));  
        }//end main
        public static boolean getBitFlag(int startAddress, int flag)
            return (bytes[startAddress + flag / 8] & pow2[flag %= 8]) == pow2[flag];
        }//end getBitFlag
        public static void invertBitFlag(int startAddress, int flag)
            bytes[startAddress + flag / 8] ^= pow2[flag % 8];
        }//end invertBitFlag
        public static void writeBitFlag(int startAddress, int flag, boolean flagVal)
            if (flagVal)
                bytes[startAddress + flag / 8] |= pow2[flag % 8];
            else
                bytes[startAddress + flag / 8] &= pow2i[flag % 8];
        }//end writeBitFlag      
    }//end class testDoes this look like the right way to do what I am trying to do?

    You could try BitSet which provides these function for you.
    public class test { 
        public static void main(String[] args) throws Exception {   
            byte[] bytes = new byte[2];
            writeBitFlag(bytes, 6, true);
            for (int i = 0; i < bytes.length*8; i++)   
                System.out.println("Flag " + i + ": " + getBitFlag(bytes, i));
            System.out.println();
            writeBitFlag(bytes, 12, true);
            invertBitFlag(bytes, 0);
            invertBitFlag(bytes, 0); 
            invertBitFlag(bytes, 1);
            for (int i = 0; i < bytes.length*8; i++)   
                System.out.println("Flag " + i + ": " + getBitFlag(bytes, i));  
        }//end main
        public static boolean getBitFlag(byte[] bytes, int flag) {
            return ((bytes[flag >> 3] >> flag) & 1) != 0;
        public static void invertBitFlag(byte[] bytes, int flag) {
            bytes[flag >> 3] ^= (1 << (flag & 7));
        public static void writeBitFlag(byte[] bytes, int flag, boolean flagVal) {
            if (flagVal)
                bytes[flag >> 3] |= (1 << (flag & 7));
            else
                bytes[flag >> 3] &= ~(1 << (flag & 7));
    }//end class test

  • I have a small production client looking to run 1 workstation running Mac Lion 10.7.3 and two work stations running Windows7 64 bit. They will all be talking to the same storage array through 8Gb FC. What is there most cost effective way to do this?

    I have a small production client looking to run 1 workstation running Mac Lion 10.7.3 and two work stations running Windows7 64 bit. They will all be talking to the same storage array through 8Gb FC. What is there most cost effective way to do this?

    Thank you for your help.
    The client has already made the jump to 8Gb including HBA's, switch and RAID Storage.
    The other question will be if they need a seperate Mac Server to run the Meta Data or are they able to use the current Mac they are running to do this?
    The Mac is a 201073 model they say with 12 Dual Core 2.66Mhz processors and 16 GB of Memory. This system is currently doing rendering. It has the XSAN Client but I understand for the solution to work they need to also run XSAN Server on a MDC.

  • Read an excel file and convert to a 1-D array of long, 32-bit integer?

    My vi right now reads an column of numbers as a 1-D array, but I need to input the numbers manually, and for what I'm trying to do, there could be anywhere between 100 to 500 numbers to input. I want the vi to be able to read the excel file and use that column of numbers for the rest, which the data type is long (32-bit integer).
    I have an example vi that is able to get excel values, but the output data type is double (64-bit real).
    I need to either be able to convert double(64-bit real) data to long (32-bit integer), or find another way to get the values from the excel file.

    Just to expand on what GerdW is saying.  There are many programs that hold exclusive access to a file.  So if a file is opened in Excel, the LabVIEW cannot access the file.
    What is the exact error code?  Different error codes will point to different issues.
    Make sure the csv file is exactly where you think it is and LabVIEW is pointing to the right place.  (I'm just going through stupid things I have done)
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • What is the max number of bits a boolean array can have?

    Hello,
       What is the maximum number of bit that a boolean array can have?
    Regards,
      Kaspar
    Regards,
    Kaspar

    There is no real size limit. (except for the natural limits of arrays because the size is a 32bit integer, etc.)
    ... of course if you ever plan to convert it back to an integer using "boolean array to number", you better stay below 64 bits.
    Can you explain what you want to do in a bit more detail?
    Message Edited by altenbach on 05-23-2007 02:51 PM
    LabVIEW Champion . Do more with less code and in less time .

  • IMAQ Array to Image Bit Shift?

    Hi,
    I've been working with some 12 bit images from a camera and saving the results as 16 bit TIFFs using some of the Vision VIs.  I can save and read back in the TIFFs and all of the data stays intact, but if I try to open the saved TIFFs in another reader (e.g. MATLAB), the returned data is incorrect.  Opening the raw TIFF files and looking at the image data (little endian) in bytes, numbers like 234 001 [490] end up becoming 234 129 [33258].  From the attached VI, it becomes clear there's a problem when you simply put in zeros to the array and try to open up the resultant TIFF in MATLAB (0 goes to 2^15) and yet LabView reads in the TIFF just fine.  While I can work around this problem, I only know I that need to work around it if I know a priori that the TIFF is from LabView.  Is there some resolution to this problem?  I'm thinking some kind of bit shifting to the data in LabView before converting the array to an image.  Thanks.
    Attachments:
    array_to_tiff.vi ‏49 KB

    Hello,
    Maybe you are looking for the functions "swap byte" and "swap words"
    Hope this helps
    Message Edité par TiTou le 06-29-2007 02:00 PM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    swap.png ‏409 KB

  • 32 Bit Image to Image Array

    I am attempting to get an image array from a 32 Bit image.  I
    attempted to use IMAQ ImageToArray.  This did not work when
    passing in a 32bit RGB image.  It works fine after I convert the
    image to 8 or 16 bit image, but this is a step I am attempting to
    remove.  So, my main questions is there a way to get an Array of
    an image directly from a 32 Bit Image?

    In the Color Utilities there is a function called IMAQ Color Image to
    Array.  That is the one you want to use.  Hopefully you have the Vision
    Development module or you may not have access to this vi.
    Randall Pursley

  • Change 1D array of 32 bit integer to 1D array of BV tag

    i just want to change 1D array of 32 bit data type to 1D array of BV tag to display this in Historical trend viewer
    an urgent reply wud b highly appreciable
    VINO

    What you are asking for is not really clear for me... I assume you want your array of numeric values to be replaced by a boolean array.
    Also, I was not sure about what numeric value has to correspond with TRUE or FALSE...
    Here is a possibility to do this :
    I hope this will help you...
    Message Edité par TiTou le 03-29-200609:07 AM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    QH.png ‏6 KB

Maybe you are looking for

  • Exit button not working in Safari

    Has anyone run into this, specifically with Safari? I created a module in Captivate 8, that has a close button on the skin. The module has been uploaded to my clients LMS and it closes no problem on all other browsers except Safari. I tried creating

  • Updates not functioning correctly

    Whenever I try to download system updates from the APP Store, here are the screens I get: I've rebuilt the OS because I'm also having trouble with Mail.  Is this a known problem or am I on my own. Also, I get the notification that iMovie fails to dow

  • Embedding an iCal calendar in an iWeb page

    I'm designing a website to accompany the chemistry classes I teach. I *would like to embed the class calendar I made using iCal into one of the pages on my site. Is there a way to do this?*

  • How to put Oracle form to intranet

    Hi, I am trying to put some Oracle forms to the company's intranet and have several questions. 1) I was told that the company installed the Oracle web server in one of the NT machine. But the person who set it up already left without leaving any docu

  • BEST PRACTICES - BOM

    Hy Experts Does anybody know with is the best practicies that I need to use in order to activate the 'Bill of Material' (BOM) Thich function module contain this? Thank you in advance