sending data and reading

Well guys, I have a problem sending data here.

When I did which is left in a loop, it works!

But when I did what is the Chief while loop, I received a large number of values of fools.

Could someone help me on this?

The second loop, I had only a few simple calculations for the example. So don't you worry with math or anything so.

In the logic... the good is that I receive the correct value in table annexed bouth. The only thing that will change is 3 last numbers!

If anyane can help me on this, I'll be happy!

EduU wrote:

Well guys, I have a problem sending data here.

When I did which is left in a loop, it works!

But when I did what is the Chief while loop, I received a large number of values of fools.

This is because you have a status of critical competition due to your use of local variables. In the second loop, the instance of the local variable is read before you actually wrote the new value of the indicator. You can browse this thread.

Tags: NI Software

Similar Questions

  • Sending data and downloading a file using as3.

    Hello

    I have a job application form where I users basic info such as name, email, phone not with this I'm asking him to download his CV (file doc ang)

    How can I publish all the data on one subject. I use PHP on the backend.

    I can send data and download file separately. ISIT possible to download the file and submit data at a time.

    Can I send additional variables with the file reference object.

    Hi guys

    I found the solution to

    http://www.flepstudio.org/Forum/flepstudio-utilities/2265-email-form-pictures-Flash-CS3-pH p.html

    Take a peek inside.

    Thank you

  • Send data and receive commands by VBAI of VB or c#

    Hi, anyone has examples on how to send VBAI data and receive commands by VBAI of VB or c#.

    I intend to hand over command to the VBAI on and outside, get the image and stop start.

    For the data to be send are the result of the calculation of the calculator function. The data send each time to do the math.

    I have search the forum and I know that this can be done by using labVIEW. However, due to the requirement of the question, I can't do it using labVIEW.

    Thank you.

    Yen

    Hi Yen,

    "" "You're almost there. '" Here are the steps for this example works.

    Once you open the inspection in Vision Builder, go to tools > Communication Device Manager...

    You must create a Modbus master device, which corresponds to your communication of VB with Vision Builder application.

    Click on the new device. Give it a name, say "VB program".

    Select Modbus TCP for the Protocol.

    Click OK.

    On the Modbus server line, click Start Server. This starts the background task which is listening on port 502 for incoming Modbus messages.

    Click OK to exit the dialog box.

    Now, a couple of things to understand about Modbus: the Protocol specifies how a device Modbus master can read and write registers located on a slave device. Vision Builder has 4 64 k save tables:

    -Coils (read/write binary, by the master).

    -Tor inputs (binary, not read by the master).

    -Entrance to the registers (16 bits, not read by the master).

    -Holding Registers (16-bit, read/write by the master).

    The tolerances of the inspection reading read minimum and maximum intensity in Modbus 0 x 0 and 0 x 1 operating records.

    If you want your VB application to write these values.

    Here's the Modbus function codes. You can get the full list by downloading the specification to Modbus.org Modbus.

    0 x 01 reading reels

    0x02 read discrete inputs

    0 x 03 playback record keeping

    0x04 read input registers

    0x05 write single coil

    0 x 06 write single register

    0x0F write multiple coils

    0x10 write multiple registers

    To use your example Modbus program to read and write registers Vision Builder, first enter the IP where Vision Builder is running:

    127.0.0.1 (localhost)

    For this example, use the function Code 6 to write a single business registration.

    The Modbus data must be formatted as follows: the first 2 bytes are the starting address, the following 2 bytes are the value (U16) you want to write to the registry. So to write the value 1 at 0 (corresponding to the intensity of the min), the data value Modbus 00000001. Click on send.

    Now, to set the maximum intensity at 50. Set the data to 00010050. Click on send.

    Step write data written minimum intensity of step to check the presence of CAP in the Modbus 0 x 0 registry entry and the status of the step in discreet entrance 0 x 0.

    To read the intensity Minimum written by VBAI, the value of the function 4 Code (enter reading registry). For the Modbus data, the first 2 bytes represent the address, 2 bytes, the number of registers to read. The value of data Modbus 00000001 to read a single registry entry to address 0. Click on send. The response data can be for example 0x1E, which corresponds to 30 decimal places.

    To read the status of the step, set the function Code 2 to read discrete inputs. The value data 00000001, to read the first register of the discreet entry table located at address 0. The response data is 0 or 1 (success or failure).

    I hope this helps. Let me know if you need other information. But this should help you get started.

    Best regards

    -Christophe

  • The most effective way to log data and read simultaneously (DAQmx, PDM) high data rates

    Hello
     
    I want to acquire the data of several Modules cDAQ using several chassis to
    high data rates (100 k samples per second if possible). Let's say the measurement time is 10 minutes and we got a large number of channels (40 for example). The measured data is written to a PDM file. I guess, the memory or the HARD disk speed is the limits. For the user, there must be a possibility to view the selection of channels in a graph during the measurement.

    My question: what is the best and most effective way to save and read data at the same time?

    First of all, I use an architecture of producer-consumer and I don't want to write and display the data in the same loop. I expect two possibilities:

    [1] to use the 'DAQmx configure logging.vi' with the operation 'journal and read' to write the data to a PDM file. To display the data in a second loop, I would create a DVR samples documented and 'sent' the DVR for the second loop, where the data will be displayed in a graph (data value reference). This method has the disadvantage that the data of all channels is copied into memory. Correct me if I'm wrong.

    [2] use 'DAQmx configure logging.vi', but only with the "journal" operation to write the data to a PDM file. To view the selected data, I had read a number of samples of the TDMS file in the second loop (I'm currently writing the TDMS file). In this case, I have only one copy data from the selected channels (not), but there will be more HARD drive accesses necessary.

    What is the most effective and efficient solution in this case?

    Are there ways to connect and read data with high frequencies of sampling?

    Thank you for your help.

    You say that the measurement time is 10 minutes. If you have 40 channels and you enjoy all CHs at 100 kHz, it is quite a number of values.

    In this case, I always try to approach under the conditions of use. If a measure is only 10 minutes, I just connect all PDM data and create a graphic module that could be in the same loop of consumers where connect you the data. You can always work on the raw data files big offline afterwards, the extraction of all the information you need (have a look at the product called NI DIAdem: http://www.ni.com/diadem/)

    The main issue is that the user needs to see in the graph (or perhaps a chart can be useful too). Lets say that the graph is 1024 pixels wide. It makes no sense to show multiple data to 1024 points, Yes? Every second will produce you 100 data points k per channel. What is the useful information, which should see your username? It depends on the application. In similar cases, I usually use some kind of data reduction method: I use a moving average (Point by point Mean.VI for example) with a size of the interval of 100. This way you get 100 data points of 1000 per channel every second. If you feed your graph every second with these average values, it will be able to data points in 1024 of the store (as a default) by channel (curve), which is a little more than 10 minutes, so that the user will see the entire measurement.

    So it depends on the frequency at which you send data to the consumer. For example, collect you values 1024 by iteration of the producer and send it to the consumer. Here you can make a normal means calc or a bearing (according to your needs) and he draw a graphic. This way your chart will display only the values of the last 10 seconds...

    Once I programmed some kind of module where I use a chart and not a graph, and the user can specify the interval of the absolute timestamp that is traced. If the data size is larger than the size of the chart in pixels, the module performs an average calculation in order to reduce the number of data points. Of course, if you need to see the raw data, you can specify an interval that is small. It all depends on how you program zoom functions, etc... In my case I hade a rate of 1 Hz, so I just kept all data in RAM limiting the berries to keep 24 hours of data, so that technicians could monitor the system. In your case, given the enormous amount of data, only a file read/write approach can work, if you really need access to all of the RAW data on the fly. But I hope that the values of working capital means will be enough?

  • How to synchronize two timers that send data?

    Hi, I have a problem:

    I have a thread in which I have two timers with timerTask. two of them will send data on the server. the first 5 sec every one and the all other the 1 sec the problem is that when I run the defective computer application (disconnection with an IOException error) after 3-4 sec, I think it's probalby because in an instant, both of them are trying to send data and can only be in one second. I tried to create both a dataOutputStreams but this is not enough. Here is my code:

    //in my thread, run method:
    
    public void run(){
    
     synchronized(_firstTimer){
    
    //send data every 5 sec
    _firstTimer.scheduleAtFixedRate(new TimerTask(){
    
     public void run(){
       sendData(_data1);
    }
    },0, 5000);
    }
    
    while(true){
    
      synchronized(_secondTimer){
    
    //send data every second
      _secondTimer.scheduleAtFixedRate(newTimerTask(){
    
            public void run(){
    
         sendData(_data2);
    }
    
    }, 0, 1000);
    }
    
    }//end of while
    
    }//end of run()
    
    //and sendData() method:
    
         public boolean sendData(byte[] _b){
                int length = _b.length;
    
                try{
                    _os.write(_b, 0, length);
                    _os.flush();
    
                    return true;
                } catch(Exception e){   return false;   }
    
            }//end of sendData method
    
    //where before in the code i've got:
    SocketConnection _s = (SocketConnection)Connector.open(_address);
    _os = _s.openDataOutputStream();
    

    can someone please provide all my advice how to fix this?

    Kind regards

    a solution would be a 'executable queue", a vector that contains objects that implement the runnable interface and executes one by one.
    the two timertasks add their treatment to the queue (synchronized) and directs the queue.

    It is a lot of material on threads synchronization available on the net because it is one of the most basic problems of treatment / distributed computing.
    I'm sure you can find detailed examples to sun.com and many other java sites.

  • you want to send data using labVIEW to arduino using write visa and the process and to take action using arduino. A

    I want to send data using labVIEW to arduino using write visa and the process and to take action using arduino. After that, I want to arduino to send out necessary via a serial port to labVIEW which should be read using visa read and store in a chain. While I am able to write or read both individually, I can't do it consecutively. I used advanced read and write vi for checking my code, but nothing is helping. The wrong bed 'time delay before execution. " Please let me know where I can go wrong. Also is it possible to write code for hx711 using labVIEW

    1. you need not "\n" on your orders println().  This command adds an end of line character already in the message.

    2. you get the error because you have a loop around your reading.  After the first reading (well technically, the second because of you add an extra line end character), there is nothing left in the port.  As a result, you will get the timeout.

    3. you should really consider using a Structure of the event.  This way you just don't write and read when you press the Write button and you can also use the structure of the event to make the loop to stop.  I also go up to close the port inside the stop-> value Change event.

  • several images capture and read their path to send the byte array to the web service

    Hello

    Have a problem when the image capture, the requirement is to open the camera and capture multiple images, and once done it should send the array of bytes to the web service, wrote the class with reader and Video Control of the code and then using the saved file to store image API, but when the user capture multiple images it replaces previous if I keep the path to say dynamic by using the date and time then how I just know what images are recently captured and their path, one time I know that the path of recently captured using new fileconnection images can read the image byte array.

    Hi Nishant,

    find the attached code. In this demo, you will find:

    (1) the use of the listner log file system

    (2) how to move data from one folder to another.

    (3) how to read file system byteArray.

  • I recently updated my iPhone to iOS 9.3 6s and now my data and wifi are in place. Now I can't open the apps and send messages with data and barely on the wifi. I've tried everything, and it still does not work.

    I updated my iPhone to iOS 9.3 6s today and now my data and wifi are in place. Whenever I try to open an app or send text messages with data it does not at all. And with wifi, it just works. I tried just like turn roaming off and off and other lte but nothing seems to work at all. Can someone please?

    I have this same problem too, it really gets me upset

  • Firefox 4 does not save form data after sending form and pressing the previous button

    Firefox 4 does not save form data after sending form and pressing the back button... It's very annoying that it erases all data. It worked fine on FF3.

    See:

    • Firefox or tools > Options > privacy > History: "don't forget to search and form history."
  • Problems sending data between the computer and the emulator.

    I can't send anything to the Calculator Emulator. Does not appear in the Send button calculator. In the emulator, it seems that send key as soon as I connect with the calculator and can send data to it. There is command of testicles that EU can do to make sure that a machine works, for example, the USB driver?

    In fact, including updates, firmware:

    application version: 20140702v6031

    operating system version: V 0.032.6030

    version of the program: 201472 (6031)

    most: the calculator, I received yesterday, day 1. and I doesn't seem to work well. There is a channel for guaranteed support, you can contact?

    Recognizing

    Davi

    Friends:

    Thank you very much. The problem has been resolved. As soon as I saw the kit, 3 updates were made and the machine works normally.

    Thank you

    Davi

  • How to read the date and time of a file by labview information

    How to read the date and time of a file by labview information? for example, time created and updated time.

    The similar question had already spoken here (this is the old thread but still seems topical):

    http://forums.NI.com/T5/LabVIEW/file-date-created/TD-p/109836

  • Need to view daq reads per second but only to record a reading every 10 minutes. I would also like to record the date and time, at the same pace. Need help

    Need to show daq reads per second, but only to record a reading every 10 minutes, need help

    You are also looking to taste to 1 Hz data acquisition?

    My approach would be to use the DAQ acquisition to time your loop display reading each acquisition, then use the loop counter to control the logic of your writing to file.  For 1 Hz and 10 minutes write I would use 'quotient and remainder' I / 600; If rest = 0, then write the data point.

    For the date and time, under Calendar palette use the time get in seconds food a DateTime Format to a string.

  • Create a data streaming from C++ stream and read it in LabView

    Hi all.

    I'm working on a project that is to connect to a tracker of movement and reading data of position and orientation of this in real time. The code to get the data is in c ++, so I decided that the best way to do it would be to create a c++ DLL that contains all the functions necessary to first connect to the device and it reads the data and use the node to call a library function to power the Labview data.

    I have a problem, because, ideally, I would like a continuous flow of data from the code c ++ in Labview, and I don't know how to do this. Put the node function of library call for a while loop seems like an obvious solution, but if I do it this way I'd have to reconnect to the device whenever I get the data, which is quite a bit too slow.

    So my question is, if I created c ++ function that creates a data stream, could I read that in Labview without continually having to call a function? I would rather have only to call a function once, and then read the data stream until a stop command is given.

    I'm using Labview 2010, version 10.0.

    Apologies if the question is badly worded, thank you very much for your help.

    Dave

    dr8086 wrote:

    This method resembles an excellent suggestion, but I have a few questions where I don't think I understood fully.

    I understand the basic principle is to use a call library function node to access a DLL that creates an instance of the device object and passes a pointer too in labview. Then a separate call library function node would pass this pointer to another DLL that could access the device object, update and read the data. This part could be in a while loop, then continue on reading the data until a stop command is given.

    That's all. I'm including some skeleton for example code. I am also including the code because I don't know how you experience multi threading so I show how you can use critical sections to avoid interactions between threads so that they do not lead to questions.

    // exported function to access the devices
    extern "C"  __declspec(dllexport) int __stdcall init(uintptr_t *ptrOut)
    {
        *ptrOut= (uintptr_t)new CDevice();
        return 0;
    }
    
    extern "C"  __declspec(dllexport) int __stdcall get_data(uintptr_t ptr, double vals[], int size)
    {
        return ((CDevice*)ptr)->get_data(vals, size);
    }
    
    extern "C"  __declspec(dllexport) int __stdcall close(uintptr_t ptr, double last_vals[], int size)
    {
        int r= ((CDevice*)ptr)->close();
        ((CDevice*)ptr)->get_data(last_vals, size);
        delete (CDevice*)ptr;
        return r;
    }
    
    // h file
    // Represents a device
    class CDevice
    {
    public:
        virtual ~CDevice();
        int init();
        int get_data(double vals[], int size);
        int close();
    
        // only called by new thread
        int ThreadProc();
    
    private:
        CRITICAL_SECTION    rBufferSafe;    // Needed for thread saftey
        vhtTrackerEmulator *tracker;
        HANDLE              hThread;
        double              buffer[500];
        int                 buffer_used;
        bool                done;       // this HAS to be protected by critical section since 2 threads access it. Use a get/set method with critical sections inside
    }
    
    //cpp file
    
    DWORD WINAPI DeviceProc(LPVOID lpParam)
    {
        ((CDevice*)lpParam)->ThreadProc();      // Call the function to do the work
        return 0;
    }
    
    CDevice::~CDevice()
    {
        DeleteCriticalSection(&rBufferSafe);
    }
    
    int CDevice::init()
    {
        tracker = new vhtTrackerEmulator();
        InitializeCriticalSection(&rBufferSafe);
        buffer_used= 0;
        done= false;
        hThread = CreateThread(NULL, 0, DeviceProc, this, 0, NULL); // this thread will now be saving data to an internal buffer
        return 0;
    }
    
    int CDevice::get_data(double vals[], int size)
    {
        EnterCriticalSection(&rBufferSafe);
        if (vals)   // provides a way to get the current used buffer size
        {
            memcpy(vals, buffer, min(size, buffer_used));
            int len= min(size, buffer_used);
            buffer_used= 0;                 // Whatever wasn't read is erased
        } else  // just return the buffer size
            int len= buffer_used;
        LeaveCriticalSection(&rBufferSafe);
        return len;
    }
    
    int CDevice::close()
    {
        done= true;
        WaitForSingleObject(hThread, INFINITE); // handle timeouts etc.
        delete tracker;
        tracker= NULL;
        return 0;
    }
    
    int CDevice::ThreadProc()
    {
        while (!bdone)
        {
            tracker->update();
            EnterCriticalSection(&rBufferSafe);
            if (buffer_used<500)
                buffer[buffer_used++]= tracker->getRawData(0);
            LeaveCriticalSection(&rBufferSafe);
            Sleep(100);
        }
        return 0;
    }
    

    dr8086 wrote:

    My main concern is that the object can get out of memory or be deallocated since it would not take place to any namespace or whatever it is.

    As you create the object with the new, the object expire not until the dll is unloaded or the process (LabVIEW) closes. If the object will remain valid between condition LabVIEW dll calls not a not unload the dll (who does if the screws are closed). When that happens, I don't know exactly what happens to the active objects (that is, if you forgot to call close), I guess the system recovers the memory, but the device could still be opened.

    What to do to make sure that everything is closed when the dll before I could call unloads close and remove the object is whenever I create a new object in the dll that I add to a list when the dll is unloaded, if the object is still on the list, that I'm deleting it.

    dr8086 wrote:

    I also have a more general question of programming on the purpose of the buffer. The buffer would essentially be a large table of position values, which are stored until they can be read in the rest of the VI?

    Yes, see the code example.

    However, according to the frequency with which you need to collect data from the device you have this buffer at all. That is, if take you a sample on every 100ms, then you can remove all threads and buffer related functions and instead to read data from the read feature itself like this:

    double CDevice::get_data()
    {
        tracker->update();
        return tracker->getRawData(0);
    }
    

    Because you need only a buffer and a separate if thread you collect data at a high frequency and you can not lose any data.

    Matt

  • Can labview take own ECG data and send it to a remote computer with Labview to be viewed graphically? I guess that's for the TCP/ip works?

    IM building a circuit with a series of filters and an anoolgue to digital converter I just need labview to take this data and send it to a remote server any so we can access it from another computer and then represented graphically in a waveform graph.

    Any advice?

    Thanks in advance!

    As a previous poster has mentioned, shared variables would be a good way to do this.  This link on the use of shared variables should help.

    Brandon Treece

    Technical sales engineer

    National Instruments

  • This device cannot start. (Code 10) Click on 'Search for solutions' to send data about this device to Microsoft and to see if there is a solution available.

    Map #2 Microsoft Tun Miniport
    This device cannot start. (Code 10)  Click on 'Search for solutions' to send data about this device to Microsoft and to see if there is a solution available.
    ???

    Hi AnaSk,

    (1) since when are you facing this problem?

    (2) remember to make changes?

    The Code 10 error applies mainly to the problems of hardware driver and devices or compatibility problems between the drivers of equipment and additional software that is installed in Windows.

    Download and install the latest drivers from the computer's network adapter or the website of the manufacturer of the device.

    See the article below

    Description of errors related to the 10 Code that generates the Device Manager in Windows on computers
    http://support.Microsoft.com/kb/943104

Maybe you are looking for

  • Invisible library folder

    I upgraded to Mountain Lion and the 'Library' users folder has become invisible. I found it by doing a search for 'Other' file, but how do I turn back to be visible? There are a lot of files in there that I need access to and turning on folders hidde

  • Re: How to create a partition for instant recovery on Satellite A100 PSAA9E

    .. .This can be a difficult issue but I wil give it a shot... I have a Toshiba Satellite A100 PSAA9E and a defined recovery disk.In the recovery for the operating system (win xp MCE) disk there are two iso: PEbase.iso and the HDbase.iso.After some sn

  • Driver for HP laserjet 1150?

    How can I use my printer if there is no driver for the printer HP laserjet 1150 for Windows 7 64-bit?

  • Install Windows 7 pro clean

    Ok... My PC came with Vista home premium x 64 installed with a free upgrade to windows 7. I also used the Windows each time that the upgrade to get it upgraded to Windows 7 Pro... So, I have 3 CD key. IBUYPOWER (manufacturing of pc) didn't give me an

  • Link to 9000 Desktop Manager directly from blackBerry Smartphones

    The CD that came with my 9000 "BOLD" does not... I need a "Direct link" to download 9000 Desktop Manager on a PC