How to run VI in the background and save system resources

Hello

I want to develop an application (pc, windows 7) that checks the line port DSR series every 100 MS basically, I know how to create a VI that works with serial ports using VISA drivers. My request or my VI must be invisible to the user, and a variable DSR everytime level incrementing counter is high.

What is the best way to create a VI that runs in the background (invisible to the user, not even shown minimized in the taskbar). Given that the application needs to run most of the time, when the pc is running, I don't want to use too much computer resources (cpu, memory on an average desktop pc). The user should be able to work with other applications like ms office, during execution of the VI in the background.

LabVIEW is appropriate create a background VI which periodically checks the serial port and consumes system resources minimum or are languages like c ++ much better suited to save system resources? What is the best way to create an invisible VI that is running in the background?

Thank you very much for your help!

Tom

On any modern hardware, the difference in the use of resources among a LabVIEW application and written in C++ for a simple task like this will be minimal. Anyway that you use a fraction of the time CPU available if the application is written correctly.

To run an invisible VI in the background, see user-defined execution of a LabVIEW Application as Windows Service.

Tags: NI Software

Similar Questions

  • How to display data on the screen and save the data in a file at the same time?

    The code can display acceleration on the screen of the playbook.

    But, when fprintf (f, "X (m/s2), Accel Accel Y (m/s2), Accel Z (m/s2) \n" ") runs, debug displays no source available.

    ??

    Does anyone know how to solve the problem, which writes data to a file?

    The code is below.

    /*
    * Copyright (c) 2011 Research In Motion Limited.
    *
    Licensed under the Apache License, Version 2.0 (the "license");
    * You may not use this file except in compliance with the license.
    * You can get a copy of the license at
    *
    www.Apache.org/licenses/license-2.0
    *
    * Unless required by the applicable law or agreement written, software
    * distributed under the license is distributed on an "AS IS" BASIS.
    * WITHOUT WARRANTIES OR CONDITIONS of ANY KIND, express or implied.
    * See the license for the specific language governing permissions and
    * limitations under the license.
    */

    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include

    /**
    The milliseconds between the accelerometer readings. It's the same thing
    * rate in which the accelerometer data will be updated
    * material. The update of material rate is below to help
    * accelerometer_set_update_frequency (FREQ_40_HZ).
    */
    public static const int ACCELEROMETER_MAX_POLL_INTERVAL = 25;

    public static screen_context_t screen_ctx;
    public static screen_window_t screen_win;
    dialog_instance_t main_dialog = 0;

    paused int = 0;

    The forces of the accelerometer
    float force_x, force_y, force_z;

    file elements
    int _logcounter = 0;
    FullName Char [256];
    FILE * f;

    /**
    * Use the PID to set the id of Group window.
    */
    public static char
    get_window_group_id()
    {
    public static char s_window_group_id [16] = "";
    If (s_window_group_id [0] == '\0') {}
    snprintf (s_window_group_id, sizeof (s_window_group_id), "%d", getpid());
    }
    Return s_window_group_id;
    }

    /**
    * Set up a basic screen, so that the browser will be
    * Send window state events when the State of the window changes.
    *
    * @return @c EXIT_SUCCESS or EXIT_FAILURE @c
    */
    public static int
    setup_screen()
    {
    If (screen_create_context (& screen_ctx, SCREEN_APPLICATION_CONTEXT)! = 0) {}
    Return EXIT_FAILURE;
    }
    If (screen_create_window (& screen_win, screen_ctx)! = 0) {}
    screen_destroy_context (screen_ctx);
    Return EXIT_FAILURE;
    }
    use of int = SCREEN_USAGE_NATIVE;
    If (screen_set_window_property_iv (screen_win, SCREEN_PROPERTY_USAGE, & use)! = 0) goto fail;
    If (screen_create_window_buffers (screen_win, 1)! = 0) goto fail;
    If (screen_create_window_group (screen_win, get_window_group_id())! = 0) goto fail;
    buff screen_buffer_t;
    If (screen_get_window_property_pv (screen_win, SCREEN_PROPERTY_RENDER_BUFFERS, (void *) & buff)! = 0) goto fail;
    buffer_size int [2];
    If (screen_get_buffer_property_iv (buff, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size)! = 0) goto fail;
    int attributes [1] = {SCREEN_BLIT_END};
    If (screen_fill (screen_ctx, chamois, attributes)! = 0) goto fail;
    int dirty_rects [4] = {0, 0, buffer_size [0], buffer_size [1]};
    If (screen_post_window (screen_win, buff, 1, (const int *) dirty_rects, 0)! = 0) goto fail;
    Return EXIT_SUCCESS;
    in case of failure:
    screen_destroy_window (screen_win);
    screen_destroy_context (screen_ctx);
    Return EXIT_FAILURE;
    }

    /**
    * Rotates the screen at the specified angle.
    *
    @param angle angle to rotate the screen.  Must be 0, 90, 180 or 270.
    *
    * @return @c EXIT_SUCCESS on success, to another @c EXIT_FAILURE
    */
    public static int
    rotate_screen (int angle)
    {
    If ((angle! = 0) & (angle! = 90) & (angle! = 180) & (angle! = 270)) {}
    fprintf (stderr, "Invalid Angle\n");
    Return EXIT_FAILURE;
    }
    int rc;
    int rotation;
    RC = screen_get_window_property_iv (screen_win, SCREEN_PROPERTY_ROTATION, & rotation);
    If (rc! = 0) {}
    fprintf (stderr, "error getting the window of the screen rotation: %d\n", rc);
    Return EXIT_FAILURE;
    }
    int size [2];
    RC = screen_get_window_property_iv (screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size);
    If (rc! = 0) {}
    fprintf (stderr, "error getting size memory buffer window screen: %d\n", rc);
    Return EXIT_FAILURE;
    }
    int temp;
    switch (angle - rotation) {}
    case - 270:
    case - 90:
    decision 90:
    case 270:
    Temp = size [0];
    size [0] = size [1];
    size [1] = temp;
    break;
    by default:
    break;
    }
    RC = screen_set_window_property_iv (screen_win, SCREEN_PROPERTY_ROTATION, &angle);)
    If (rc! = 0) {}
    fprintf (stderr, "screen rotation window for parameter error: %d\n", rc);
    Return EXIT_FAILURE;
    }
    RC = screen_set_window_property_iv (screen_win, SCREEN_PROPERTY_SIZE, size);
    If (rc! = 0) {}
    fprintf (stderr, "error creating window screen size: %d\n", rc);
    Return EXIT_FAILURE;
    }
    RC = screen_set_window_property_iv (screen_win, SCREEN_PROPERTY_SOURCE_SIZE, size);
    If (rc! = 0) {}
    fprintf (stderr, "error creating window screen size: %d\n", rc);
    Return EXIT_FAILURE;
    }
    RC = screen_set_window_property_iv (screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size);
    If (rc! = 0) {}
    fprintf (stderr, "error creating window buffer size of the screen: %d\n", rc);
    Return EXIT_FAILURE;
    }
    Return EXIT_SUCCESS;
    }

    /**
    To manage an event of navigator.
    *
    * @return @c the value true if the application should shut down, another fake.
    */
    public static bool
    handle_navigator_event(bps_event_t *Event)
    {
    bool should_exit = false;
    switch (bps_event_get_code (event)) {}
    case NAVIGATOR_EXIT:
    should_exit = true;
    break;
    case NAVIGATOR_ORIENTATION_CHECK:
    navigator_orientation_check_response (event, true);
    break;
    case NAVIGATOR_ORIENTATION:
    {
    int angle = navigator_event_get_orientation_angle (event);
    If (rotate_screen (angle) == EXIT_FAILURE) {}
    should_exit = true;
    }
    navigator_done_orientation (Event);
    break;
    }
    }
    Return should_exit;
    }
    /**
    * Display an alert dialog box that contains the location data.
    */
    public static void
    show_main_dialog()
    {
    If {(main_dialog)
    return;
    }
    dialog_create_alert(&main_dialog);
    dialog_set_alert_message_text (main_dialog, "Acceleration to first fix");
    dialog_set_size (main_dialog, DIALOG_SIZE_FULL);
    dialog_set_group_id (main_dialog, get_window_group_id());
    dialog_set_cancel_required (main_dialog, true);
    dialog_show (main_dialog);
    }

    /**
    * Displays geolocation data in the main dialog box.
    */
    public static void
    display_acceleration_data (float force_x, float force_y, float force_z) {}
    char buf [1024];
    snprintf (buf, sizeof buf,
    "\tX: m\n % 7.3.f.
    "\tY: m\n % 7.3.f.
    "\tZ: m\n % 7.3.f."
    force_x, force_y, force_z);
    dialog_set_alert_message_text (main_dialog, buf);
    dialog_update (main_dialog);
    }

    void createafile() {}
    sprintf (fullname, "shared/documents/Raw-%d.txt",_logcounter);
    {if(f==null)}
    file does not exist
    f = fopen (fullname, "r");
    {while(f!=null)}
    file exists
    fclose (f);
    ++ _logcounter;
    sprintf (fullname, "shared/documents/Raw-%d.txt",_logcounter);
    f = fopen (fullname, "r");
    }
    }
    }

    write data to the file
    void writedataintofile() {}
    f = fopen (fullname, "w");
    fprintf (f, "X (m/s2), Accel Accel Y (m/s2), Accel Z (m/s2) \n" ");
    fprintf (f, "" 7% 7% .3f, .3f, %7.3f\n ', force_x, force_y, force_z ");
    fclose (f);
    }

    /**
    * A sample application shows the native APIs of BlackBerry for accelerometer.
    * The example initializes and reads the accelerometer periodically until one
    * NAVIGATOR_EXIT event is received.
    Enforcement also tuned to changes status window in the browser so that
    * It can stop reading the accelerometer when the application is no longer visible.
    */
    int main (int argc, char * argv {})
    bool exit_application = false;
    /*
    * Until we can listen for events from the BlackBerry Tablet OS platform
    * services, we need to initialize the BPS infrastructure
    */
    bps_initialize();
    /*
    * Once the BPS infrastructure has been initialized, we can save to
    * events of different services of BlackBerry Tablet OS platform. The
    * Browser service manages and provides the life cycle of application and
    * events of visibility.
    For the example, we ask browser events so that we can follow when
    * the system ends the application (NAVIGATOR_EXIT event). This allows to
    * us to clean up resources in the application.
    */
    navigator_request_events (0);
    dialog_request_events (0);
    /*
    * Initialize the screen so that the Windows Id is correctly set, to allow
    * dialogs to display.
    */
    If (setup_screen()! = EXIT_SUCCESS) {}
    fprintf (stderr, "Failed to initialize the screen.");
    Exit (-1);
    }
    /*
    * Once the BPS infrastructure has been initialized, we can save to
    * events of different services of BlackBerry Tablet OS platform. The
    * Browser service manages and provides the life cycle of application and
    * events of visibility.
    *
    For the example, we ask browser events so that we can follow when
    * the system ends the application (NAVIGATOR_EXIT event).
    *
    * We ask events of dialogue so that we can be notified when the service of dialogue
    * answers to our queries/requests.
    */
    If (BPS_SUCCESS! = navigator_request_events (0)) {}
    fprintf (stderr, "error asking navigator events: %s", strerror(errno) (errno));
    Exit (-1);
    }
    If (BPS_SUCCESS! = dialog_request_events (0)) {}
    fprintf (stderr, "error asking dialog events: %s", strerror(errno) (errno));
    Exit (-1);
    }
    /*
    * Create and display the dialog box that displays the data from the accelerometer.
    */
    show_main_dialog();
    /*
    Prior to initialize the accelerometer function, we must ensure the unit
    * takes in charge
    */
    If (sensor_is_supported (SENSOR_TYPE_ACCELEROMETER)) {}
    /*
    * If the device does not support the accelerometer so warn the user,.
    * clean in and out
    */
    public static const int SENSOR_RATE = 40;
    sensor_set_rate (SENSOR_TYPE_ACCELEROMETER, SENSOR_RATE);
    sensor_request_events (SENSOR_TYPE_ACCELEROMETER);

    }
    /*
    * Initialize the accelerometer setting the rate at which the
    * accelerometer values will be updated material
    */
    accelerometer_set_update_frequency (FREQ_40_HZ);

    /*
    Treat browser events and take the accelerometer readings periodically
    * until we receive a NAVIGATOR_EXIT event.
    */
    createafile();
    f = fopen (fullname, "w");

    While (! exit_application) {}
    /*
    * By setting the timeout to bps_get_event to ACCELEROMETER_MAX_POLL_INTERVAL,
    * We assign the maximum duration (in millis) who will wait before
    * release so that we can take a reading of the accelerometer.
    */
    bps_event_t * event = NULL;
    bps_get_event (& event, ACCELEROMETER_MAX_POLL_INTERVAL);

    If {(event)
    If (bps_event_get_domain (event) is {sensor_get_domain()})
    /*
    * We woke up. See if we are in the paused state. If not,
    take a reading of the accelerometer
    */
    If (! pause) {}
    sensor_event_get_xyz (event, & force_x, & force_y, & force_z);
    display_acceleration_data (force_x, force_y, force_z);
    fprintf (f, "X (m/s2), Accel Accel Y (m/s2), Accel Z (m/s2) \n" ");
    fprintf (f, "" 7% 7% .3f, .3f, %7.3f\n ', force_x, force_y, force_z ");
    } //paused
    }
    / * If this is an event of the dialog box, determine the response code and handle
    * the event accordingly.
    */
    {ElseIf (bps_event_get_domain (event) == dialog_get_domain() {)}
    ;
    }
    /*
    * If it's a NAVIGATOR_EXIT event and then set the exit_application
    * indicator so that the application stops processing events, clean and
    * output.
    */
    {ElseIf (bps_event_get_domain (event) == navigator_get_domain() {)}
    exit_application = handle_navigator_event (event);
    }
    } //if event
    } //while
    /*
    * Destroy the dialog box, if it exists.
    */
    If {(main_dialog)
    dialog_destroy (main_dialog);
    }

    fclose (f);

    /*
    * Clean the infrastructure bps and output
    */
    sensor_stop_events (SENSOR_TYPE_ACCELEROMETER);
    bps_shutdown();
    screen_destroy_window (screen_win);
    screen_destroy_context (screen_ctx);
    return 0;
    } //main

    Hello

    As I said on your other thread:

    In order to write in the shared directory/documents, your application should request action "access_shared" and it must be granted by the user. Make sure you have

    access_shared

    in your bar - descriptor.xml.

    Also note that the shared documents folder may not be the best place to write the application log data. There is one connects / in the sandbox to this effect, or the application directory data / directory if the information should be persisted. The documents/shared/folder is designed for documents that the user creates or interacts with.

    HTH,

    Christian

  • When I close thunderbird is still running in the background and always using data?

    I'm with an internet provider that has limited use of data per month. If I close Thunderbird when done using it it is still running in the background and using the data or is it closed here for not to retrieve messages or using the data?

    When you close Thunderbird, it cannot check or retrieve new messages.
    Not sure what you mean with "always running in the background.
    When you close Thunderbird is closed. Period.

  • Run the application in the background and receive updates of geolocation

    Is it possible to run an application in the background (for example all doing other things such as the use of browser, mail, etc) and always receive updates HTML5 geolocation?

    If you make your application in the "background" and do not close, the watchPosition should go on the provision of data within your App App in the background means you open the app and ample bottom to somehow minimize, for example. to open another app or something like that. As long as he remains upwards in the list of open applications it should "look at the position.

  • How to put an image in the background and Center my text?

    I am new to this, I thought it would be much easier, but I was wrong. I can't yet put an Image in the background and Center my text.

    To do precisely what that you are looking for, within the DW interface (no coding)...

    Background image

    1. open the page you want as the background on image

    2. click on modify > Page Properties

    3. under click appearance (CSS) the search for a button for BackgroundImage and choose a file from your defined Site

    Center text

    1 highlight the text you want to Center in Design view

    2. click on the button CSS in the Properties window (Ctrl + F3 if it is not open)

    3. choose one of the icons of alignment that is there found

  • Something seems to be continually downloading in the background, and the computer is so slow. What can I do to fix this?

    How to configure startup programs

    Something seems to be continually downloading in the background, and the computer is so slow, it is booting?

    On Saturday, may 5, 2012 12:58:21 + 0000, joodZO wrote:

    Something seems to be continually downloading in the background, and the computer is so slow, it is booting?

    Since the very little information you provided, I do not know why
    He runs slowly. But two points:

    1. first of all, note that you should be concerned all the programs
    starts automatically, not only those who enter in the system tray.
    Not all the programs auto-start manifesting by an icon in the
    Status bar.

    On each program, you don't want to automatically start, check its
    Options to see if he has the choice of not start (make sure you)
    Indeed choose not to run, not just a "don't show icon.
    Optional). Many can easily and better be arrested like that. If that is not
    work, run MSCONFIG from the start. Run the line, and then click the Startup tab.
    Uncheck the programs that you do not want to automatically start.

    However, if I were you, I wouldn't do it just for the application of
    the minimum number of running programs. Despite what many people say
    You should be concerned, not with the way that a lot of these programs
    you run, but who. Some of them can degrade performance severely, but
    others have no effect on performance.

    Don't stop all programs to run willy-nilly. What you need to do
    is to determine what each program is, what its value is up to you which
    the performance cost is its running all the time. You can try
    Internet search and ask questions about the details here.

    Once you have this information, you can make a smart informed
    decision on what you want to keep and what you want to get rid of.

    2. the computer running slowly is very often due to a malware
    infection. What anti-virus and anti-spyware programs do you run?

    Ken Blake, Microsoft MVP

  • How can I actually email the scan, and how can I check this virus?

    SENDING A SCAN

    I am currently using Internet Explorer 8 and want to send someone using Internet Explorer 8

    How do I actually email the scan AND how can I check this virus

    Internet Explorer is a Web browser, not an e-mail program... To send messages, you need an e-mail account and the recipient needs an e-mail account. You need to know your email address and you must know the e-mail address of the recipient.
     
    Download and run the free versions of these two programs to check the software malicious & software unwanted spies.
     
     
  • To get the background and foreground color of the screen title

    Currently the title screen background color is black, and foreground color is white.

    But when we use custom theme then it can have different background and foreground colors.

    That's why I need to pick up the color of the screen title properties.

    How can I achieve this?

    Thank you

    I think you want to color your application according to the background and foreground color! Override the paint of the main method and use instance graphics for call getColor () and getBackgroundColor ()... Save it to integer variables and use it anywhere where you need...

    See you soon...

  • How to run SQRW outside the process scheduler

    Hi all

    on the 8.53 on Win 2008 Server, MSSQL DB server, tools how to run SQRW outside the process scheduler?

    Thank you.

    To run a QAS on the client:

    1. Select Start, run, click Browse and navigate to PS_HOME\bin\sqr\MSS\binw.

    Select sqrw.exe and click Open.

  • Tracing a png - how to get rid of the background

    I imported a png image of a simple drawing of a man in black (as you can see on a bathroom door) with a transparent background and tried to trace it to a vector, but I can't get rid of the white background. I tried it in jpeg format to see if the route command would generate two thicknesses for the main drawing and one for the background that I could remove, but he di awaters. I tried to adjust the fuction just Trace expose but does nto work no more.

    Can someone tell me how to get rid of the background by drawing a simple image or to break the object to get the shape of the background?

    Kevin

    Use Expand in the menu object and then use the direct Selection tool to select the white and remove. You will need the transparency grid show be enabled in the view menu to see it.

  • My iPhone does not to import! How can I appear in the Photos and delete those that are already imported?

    My iPhone does not to import! How can I appear in the Photos and delete those that are already imported?

    My iPad appears fine with an option to import the 'new' photos and then delete them once they are imported. However my iPhone appears not at all on the pictures. Although most is already imported via the cloud, some are not, but more importantly, I would remove at least half of 30 000 photos that are taking place on my phone and a "clear items after button import" would be nice right now! I tried to turn off photo stream on my phone, but it still does not appear in the application.

    What can I do?

    Thank you!

    If you use iCloud photo library you cannot delete pictures after the import (or) - deletions on any device will be on all devices - if storage is a question about a device set to use optimized photos

    LN

  • After you create a new playlist in iTunes, every song has the cover of the album and no box on the left side. How can I remove from the work and recover the box? TIA

    After you create a new playlist in iTunes, every song has the cover of the album and no box on the left side. How can I remove from the work and recover the box? TIA

    You can change the appearance of a selection by clicking on "reading list" in the upper right of the iTunes window. The desired view is probably "tracks"

  • How to set up and enable the WINS and WINS-R resource records?

    How to set up and enable the WINS and WINS-R resource records?

    Hello

    Please repost these questions in the Technet Forums

    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

    See you soon.

  • How to play audio through the headphones and computer speakers, at the same time.

    Hey I just need to know how to play sounds through the headphones and speakers. Help

    Depends on your audio device.

    If its edge, while normally when you plug the headset switch will cut off the speakers.

    If you have a USB or Firewire pro device you can listen to your headphones as the signal played through your speakers.

    See you soon,.
    Jerry

  • How can I disable all the pings and tones and notes and sounds of the HP Officejetpro 8610?

    I can't tolerate the noise.  How can I disable all the pings and tones and notes and sounds of the HP Officejetpro 8610?  This 'thing' emits a beep and the pings and plays music.

    Thank you

    Sam

    Hi Sam,

    On the front panel of the printer, scrool main screen to the right and the clock setting icon.

    Then click Printer Setup, and then select sound effects Volume.

    Select and confirm, that should disable all these sounds.

    Shlomi

Maybe you are looking for

  • Large Photo Book

    I used iPhoto to order travel photo books in the past.  With the new iMac and Photo, I now want to print a book with about 500 photos.  All types and styles I find now available withPhoto accept only about 1/2 that amount. Solutions?

  • HP Pavilion 15-r007TX: Smart hard disk error

    Hello. The last 2 days im getting Smart hard drive failure, everytime I turn on my laptop. But it works very well but there are some unexpected Frost in between jobs. It is said Hard drive 1 (301) If I run the system diagnosticks, it gives me an ID Q

  • Update an indicator of in while loop with event driven programs

    I'm trying to update a chart shared by several events within a Structure of the event. I would like a change in value of a button (NOPE or OK buttons in the attached example images) causes the structure of the event causes a switch between the variou

  • Bought support1 services, Plimus, Galaxynewtechnology - valid sources?

    I was called by a man Indian (in Brooklyn), and he proceeded to tell me that my system has been infected and I turned on the control for him, he then proceeded toMy control system for a few hours and with me watching, it fixes all of the problems, I

  • Will be my Sony Vaio windows 7 computer print with lexmark z25

    will be my sony vaio computer windows 7 print with lexmark z25?