Can a CIN that is in an infinite loop send data to labview without exiting?

I have a C program that continuously queries a motor controller.  Right now that program is in a labview vi as a CIN.  The problem is that the CIN must exit before reporting the controller response to the labview vi.  This means I have to constantly run the CIN which opens, queries and closes the connection each time.  Is it possible to run the loop in the CIN itself so that the response buffer from the controller can be sent to the labview vi without exiting.  Are there variables types that can be passed from the CIN before completing the CIN? 

The controller is a Galil DMC4080 motor controller.  I am running Labview under Mandrake Linux.  I can connect and send commands to the controller using a C program.  I modified the C program as a CIN to pass the controller response to the Labview front panel.  Galil has a library of functions used for the controller commands.  LStrPrintf is the command I use to write the data to labview.  Currently I just run this CIN without a while loop and loop it in labview but I recieve an  error message  after  a 1000 executions, see: http://forums.ni.com/ni/board/message?board.id=170&message.id=270220
If interested here is the current code I am using with the infinite loop. 
#include "extcode.h"
#include "dmclnx.h"
#include "hosttype.h"
MgErr CINProperties(int32 prop, void *data);
MgErr CINRun(LStrHandle IPAddress, LStrHandle Command, LStrHandle Response,
        float64 *ErrorCode);
MgErr CINProperties(int32 prop, void *data)
    switch (prop) {
        case kCINIsReentrant:
            *(Bool32 *)data = TRUE;
            return noErr;
    return mgNotSupported;
MgErr CINRun(LStrHandle IPAddress, LStrHandle Command, LStrHandle Response,
        float64 *ErrorCode)
   float          rc = 0;          /* Return code */
   char           buffer[32] = ""; /* Response from controller */
   char           ip[20]=""; /* IP address of controller*/
   char           cmd[20]=""; /* Command to send to controller*/
   HANDLEDMC      hdmc = -1;       /* Handle to controller */
   CONTROLLERINFO controllerinfo;  /* Controller information structure */
   memset(&controllerinfo, '\0', sizeof(controllerinfo));
   controllerinfo.cbSize = sizeof(controllerinfo);
   controllerinfo.usModelID = MODEL_2100;
   controllerinfo.fControllerType = ControllerTypeEthernet;
   controllerinfo.ulTimeout = 1000;
   controllerinfo.ulDelay = 5;
   SPrintf(ip,"%H",IPAddress);
   strcpy(controllerinfo.hardwareinfo.socketinfo.szIPAddress, ip);
   controllerinfo.hardwareinfo.socketinfo.fProtocol = EthernetProtocolTCP;
   DMCInitLibrary();
   /* Open the connection */
   rc = DMCOpen(&controllerinfo, &hdmc);
   if (rc)
       *ErrorCode = rc;
       return noErr;
      while (1)
          SPrintf(cmd,"%H",Command);
          rc = DMCCommand(hdmc, cmd, buffer, sizeof(buffer));
          if (rc)
              *ErrorCode = rc;
              return noErr;
              break;
          else
              LStrPrintf(Response,buffer);
   rc = DMCClose(hdmc);
   if (rc)
      *ErrorCode = rc;
      return noErr;
   *ErrorCode = rc;
   return noErr;

Similar Messages

  • My ipad is on an infinite loop.  I used ios7 for a few days and then did updates on some of my apps. that's when the infinite loop started.  I have tried pressing the power and home button at the same time, but it doesn't work. Please help!

    my ipad is on an infinite loop.  I used ios7 for a few days and then did updates on some of my apps. that's when the infinite loop started.  I have tried pressing the power and home button at the same time, but it doesn't work. Please help!
    I even tried some hints posted for ios6 (turn off Ipad, holding home button and plugging in power cord at the same time and then releasing the home button)
    I did manage to get a different screen that shows the itunes icon and a power cord, but nothing happens.

    You were on the right track. You got the connect to iTunes screen and you ended to use iTujes to restore your iPad. Try recovery mode again.
    Recovery Mode Instructions
    Disconnect the USB cable from the iPad, but leave the other end of the cable connected to your computer's USB port.
    Turn off iPad: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for iPad to turn off.
    If you cannot turn off iPad using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the iPad turns off, release the Sleep/Wake and Home buttons.
    While pressing and holding the Home button, reconnect the USB cable to iPad. When you reconnect the USB cable, iPad should power on.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears you can release the Home button.
    If necessary, open iTunes. You should see the recovery mode alert that iTunes has detected an iPad in recovery mode.
    Use iTunes to restore iPad.

  • HT201272 I downloaded a TV show directly to my IPAD, how can I download that TV show to other devices on the same account without paying twice?

    Title says it all...
    I downloaded a TV show directly to my IPAD, how can I download that TV show to other devices on the same account without paying twice?

    Whether you can re-download them for free depends upon what country that you are in - tv shows can't be re-downloaded in all countries. If they show in the Purchased tab in the iTunes app on your other devices, or the Purchased link under Quick Links on the right-hand side of the iTunes store home page on your computer's iTunes then you can re-download them. Otherwise you can copy them from your iPad to your computer's iTunes via File > Transfer Purchases and then sync them to your other devices.

  • How can i insure that job finished and good  and send mail to the user  ?

    how can i insure that job finished and good  ,
    and how can i send mail to the user "ok"   ?

    Hi Dakota.  We do something simular with our nightly MRP job.  Our MRP job runs around midnight,  then we kick off another job about 4am which checks to see if any of the jobs in question have abended, if so,  then it sends an email to the email addresses specify in the report variant.  Of course, this could be modified to check for successfully complete jobs, if that is your requirement.
    REPORT ZBCJOBMONITOR .
    TABLES: SOMLREC90,
            TBTCO.
    DATA: MAILDATA   LIKE SODOCCHGI1.
    DATA: MAILTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILREC    LIKE SOMLREC90 OCCURS 0  WITH HEADER LINE.
    DATA: I_TBTCO    LIKE TBTCO OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
    SELECT-OPTIONS: S_JOB FOR TBTCO-JOBNAME.
    SELECT-OPTIONS: S_JOBC FOR TBTCO-JOBClass.
    SELECT-OPTIONS: S_REC FOR SOMLREC90-RECEIVER.
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
      CLEAR:    MAILDATA, MAILTXT, MAILREC, I_TBTCO.
      REFRESH:  MAILTXT, MAILREC, I_TBTCO.
      PERFORM GET_ABENDED_JOBS.
      PERFORM BUILD_RECEIVERS.
      LOOP AT I_TBTCO.
        PERFORM BUILD_TEXT_MESSAGE.
        PERFORM SEND_MAIL_NODIALOG..
      ENDLOOP.
    *      Form  BUILD_TEXT_MESSAGE
    FORM GET_ABENDED_JOBS.
      SELECT * FROM TBTCO
              INTO CORRESPONDING FIELDS OF TABLE I_TBTCO
                         WHERE JOBNAME IN S_JOB
                           AND STATUS = 'A'
                           AND JOBCLASS IN S_JOBC
                           AND SDLSTRTDT = SY-DATUM.
    ENDFORM.
    *      Form  BUILD_TEXT_MESSAGE
    FORM BUILD_TEXT_MESSAGE.
      DATA: DATE(10) TYPE C.
      DATA: TIME(10) TYPE C.
      MAILDATA-OBJ_NAME = 'MONITOR'.
      MAILDATA-OBJ_DESCR = 'Batch Job Monitor'.
      MAILDATA-OBJ_LANGU = SY-LANGU.
      CONCATENATE 'Job Name:' I_TBTCO-JOBNAME
                  INTO MAILTXT-LINE SEPARATED BY SPACE.
      APPEND MAILTXT.
      PERFORM FORMAT_DATE USING I_TBTCO-SDLSTRTDT
                                DATE.
      CONCATENATE I_TBTCO-SDLSTRTTM+0(2) ':'
                  I_TBTCO-SDLSTRTTM+2(2) ':'
                  I_TBTCO-SDLSTRTTM+4(2)
                     INTO TIME.
      CONCATENATE 'Start Date/Time:' DATE TIME
                INTO MAILTXT-LINE SEPARATED BY SPACE.
      APPEND MAILTXT.
      CONCATENATE 'Job Class:' I_TBTCO-JOBCLASS
                INTO MAILTXT-LINE SEPARATED BY SPACE.
      APPEND MAILTXT.
      MAILTXT-LINE = 'Job has terminated abnormally'.
      APPEND MAILTXT.
    ENDFORM.
    *      Form  BUILD_RECEIVERS
    FORM BUILD_RECEIVERS.
      LOOP AT S_REC.
        CLEAR MAILREC.
        MAILREC-RECEIVER = S_REC-LOW.
        MAILREC-REC_TYPE  = 'U'.
        APPEND MAILREC.
      ENDLOOP.
    ENDFORM.
    *      Form  SEND_MAIL_NODIALOG
    FORM SEND_MAIL_NODIALOG.
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = MAILDATA
                DOCUMENT_TYPE              = 'RAW'
                PUT_IN_OUTBOX              = 'X'
           TABLES
                OBJECT_HEADER              = MAILTXT
                OBJECT_CONTENT             = MAILTXT
                RECEIVERS                  = MAILREC
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                DOCUMENT_TYPE_NOT_EXIST    = 3
                OPERATION_NO_AUTHORIZATION = 4
                PARAMETER_ERROR            = 5
                X_ERROR                    = 6
                ENQUEUE_ERROR              = 7
                OTHERS                     = 8.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.
    *      Form FORMAT_DATE
    FORM FORMAT_DATE USING IN
                           OUT.
      CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
           EXPORTING
                DATE_INTERNAL            = IN
           IMPORTING
                DATE_EXTERNAL            = OUT
           EXCEPTIONS
                DATE_INTERNAL_IS_INVALID = 1
                OTHERS                   = 2.
    ENDFORM.
    Regards,
    Rich Heilman

  • Cancel Application that is in an infinite loop

    Hi,
    I have an infinite loop in my application, I close  the browser, but the application is still running in background. A new deploy hangs.
    How can I cancel the application without rebooting the J2EE-engine?
    Regards
    Roman

    Hi,
    I didn't try it. Maybe you can stop the application in the Visual admin under Server -> Services -> deploy.
    This is just a guess. But maybe it works.
    Regards,
    Dennis

  • How can I ensure that my operating system is up to date?

    An up to date system is vital, when it comes to running intensive programs like Premiere Elements.
    Here are three ways to ensure you have the latest firmware and drivers.
    1) Go to Windows Update and manually download all the latest, including optional updates for hardware. These non-critical updates don't install automatically
    2) Go to http://www.apple.com and download the latest version of Quicktime. Quicktime is at the core of all PC-based video applications, include Premiere Elements
    3) To ensure that all of your software is up to date, download this great product from Secunia. The home version is free.
    http://secunia.com/vulnerability_scanning/
    This program will update all of your drivers and firmware and will even advise you when a driver is outdated.
    A great, free tool for ensuring your drivers are up to date is Device Doctor, available from http://www.devicedoctor.com/
    This program will scan your drive and recommend driver updates, when available. Although the program is free, a voluntary donation is encouraged. The program also offers to install a free toolbar -- which I recommend you decline.

    Check Settings > General > About. Latest version for the CDMA phone is 4.2.10
    Stedman

  • The information of photo like date change after close it. How can'i correct that

    the information of photo like date change after close it. How can'i correct that?

    Using the Photos ➙ Batch Change ➙ Date menu option will let you change the EXIF Capture Date of the photo.
    For a single photo (or to set a group of photos to the same date and time) use the Photos ➙ Adjust Date and Time ... menu option.
    Happy New Year

  • ActionEvent/Setting gui text in an infinite loop

    Hi,
    I have set up a gui that contains ~ 100 JTextFields and one JTextButton
    Pressing the JTextButton on the gui triggers an action event that
    1.     establishes a socket connection w/ a server
    2.     reads input from the server in an infinite loop
    3.     should use the server data to dynamically setText in the various JTextFields found on the gui.
    for example, during one iteration of the infinite loop, the data may set the text of JTextField #1 to ?foo? and in a later iteration of the loop, the new data from the input stream may set the text of the same field to something else (e.g. ?bar?). Thus, the gui should show a dynamically changing collection of TextFields after the user presses the JTextButton.
    Problem: because of the infinite loop, NONE of the fields is ever updated (see pseudocode below). If I remove the infinite loop and simply have 1 iteration of the block of code within the actionPerformed method, the gui updates properly.
    How might I alter the code to a) maintain the server connection, b) continuously read from the input stream and c) have a dynamic update of the textfields w/in the gui?
    I've tried adding "this.paint(this.getGraphics());" within the infinite loop and it sort of works, but the updates to the gui are FAR SLOWER than the data that are streaming in from the server.
    Thanks for any help!
    The code looks something like this
    Public class abc extends JFrame
    Public abc()
         {initialize components}
    instantiate all textfields & button
    create various arrays
    public void initialize components
         (set up gui using gridbaglayout
         add actionListener to button)
    private actionperformed
    (establish socket connection w/ server
         read data from server in an infinite loop
         parse data and use information to setText on the gui)
    public static void main(blah blah)
         show abc();

    have the reading loop in a different class which will have its own Thread running aside from the main program's thread. This way your application will do both at once :)

  • Program enters infinite loop.

    this is the first program i'm writing with sockets and is also a step towards making a chat application. my problem is that the program enters infinite loop.
    package server;
    import java.net.*;
    import java.io.*;
    class Server
        public static void main(String[] args) throws Exception
            ServerSocket ss = new ServerSocket(9090);
            Socket soc = ss.accept();
            BufferedReader in = new BufferedReader(new InputStreamReader(soc.getInputStream()));
            String str = in.readLine();
            while(str!="")
                System.out.println(str);
                str = in.readLine();
            soc.close();
            ss.close();
    }this was the server - a seperate application. below is a part of the client - a seperate application
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            try
                InetAddress ip = InetAddress.getByName("127.0.0.1");
                Socket soc = new Socket(ip,9090);
                PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(soc.getOutputStream())),true);
                str_out = jTextArea2.getText();
                while(str_out!="")
                    out.println(str_out);
                    str_out = jTextArea2.getText();
                soc.close();
            catch(Exception e)
                System.out.println("Error sending message");
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            str_out = "";
            jTextArea2.setText(str_out);
        }  when i press button send (jButton1) the text from the text area jTextArea2 is supposed to go to the server and then the server should display it in its out put screen. i tried sending hello and the server went on printing hello continously.
    pleas help.

    String str = in.readLine();
    while(str!="")
    System.out.println(str);
    str = in.readLine();
    }You need to test for (str != null) above too, or instead of str != "".

  • My Macbook Pro will not boot up. I can hear the sound that it has started and then goes into an infinite loop.

    My Macbook Pro will not boot up. I can hear the sound that it has started and then it goes into an infinite loop.

    What model MBP and which version of OS X? Sounds as if the hard drive may have failed. If you have an installation disc, try booting with it. If your machine came with Lion or Mountain Lion, try booting to the Recovery partition - Command and R keys held down while booting.
    Clinton

  • How to create an infinite loop that cannot be cancelled?

    Hi , im new around java and i need a program that keeps on repeating after each each input/uses(generally meant for different user) and cannot either stop using "Cancel" or "x" while stopping only using the "stop" button
    I got a few lines of codes that look like this : String arg = "";
    do{
    JOptionPane.showInputDialog("hi");
    }while ( arg != "y" || arg!= "Y");
    and it cannot be stop with both cancel and"x"(which i wanted)
    but when i used this logic with
    Valid validUserInput = new Valid();
    do {
    userInput = validUserInput.validUserInput(a);
    switch(userInput){
    case 1 : validUserInput.optionOne(b);break;
    case 2 : validUserInput.optionTwo(c);break;
    case 3 : validUserInput.optionThree(d,e);break;
    default : validUserInput.validUserInput(f);
    }while(looping != "" || looping != " ");
    it does not really work(while it will keep looping, it can be easily stop by pressing cancelled or "x")
    So is there any logic or method that can prevent the program from being stop?
    Thankyou!

    elricscript wrote:
    "That is helpful. It gives him a direction where he can focus his research. Namely, 'how to run a program in kiosk mode' rather than 'how to create an infinite loop that cannot be cancelled.'"
    No... He already mentioned he wants to "e.g Interactive kiosk", so saying "properly kiosk it" isn't adding any new information. Rather it's just giving the person a dead point of: you're doing it wrong. Pointing out someone is wrong is not a positive enlightenment. Pointing someone in the right direction is more productive.
    >"That is helpful. It gives him a direction where he can focus his research. Namely, 'how to run a program in kiosk mode' rather than 'how to create an infinite loop that cannot be cancelled.'"
    No... He already mentioned he wants to "e.g Interactive kiosk", so saying "properly kiosk it" isn't adding any new information.
    Yes it is. He asked how to do it using some Swing trickery, and I said it won't work. Which is true. The OP didn't already know that, clearly, hence the question. Now he does. That's pretty much new information if you ask me.
    Rather it's just giving the person a dead point of: you're doing it wrong.Right. He is. However, the problem is now no longer related to Java, and not something I can help him with. You should try that: not answering questions you don't know the answer to. It's actually more helpful than posting misleading, wrong answers.
    Pointing out someone is wrong is not a positive enlightenment. I'm giving basic technical help, not yoga lessons.
    Pointing someone in the right direction is more productive.As already stated, I am as ignorant of how to make a Java application into a kiosk app as the OP is. What value can I add in light of that information? I began by answering a question that was not stated to be about kiosks. Once the question moved outside of my area of knowledge, I stopped trying to answer.
    I notice you're not giving him any help, being more interested in admonishing others as you are.

  • How to obtain data from a device and display that data in an infinite loop

    I'm trying to run an infinite loop where I'm testing a robot for thermal insulation.
    I send the robot a command to run infinitely (using VISA communication)..., the robot starts running.
    At the same time I obtain the temperature data from its motors (through sensors) and want to display it. The data should be refreshed at regular itervals but I only get broken display of the data at various instances of time during the robot's test-run.
    I fear that there is a problem with the time synchronization. But having tried many permutations of time delays at various points in the program, I can not find the fault.
    Any help is much appreciated.
    Cheers
    Rajat

    We really need screen shots (*png format/NOT .bmp!) or attached code to see what might be the problem. There are an infinite number of mistakes that can be made (or nearly so), depending on how a program is written.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • A few selection of websites after fully loading become blank and start an infinite loop of loading. I reinstalled firefox once already and the problem persists. What can I do?

    A few selection of websites after fully loading become blank and start an infinite loop of loading. I reinstalled firefox once already and the problem persists. What can I do?

    Sorry I do not know what the problem may be. <br />
    If no-one comes up with better ideas of what causes this then my questions and suggestions:
    What do you mean by an infinite loop ? <br />
    The page loads and then goes blank. What exactly happens next, does the page fully load and fully display again before going blank, and repeat this cycle endlessly in the same tab.
    You do say the problem persisted in safe-mode and you had looked at the basic troubleshooting article. Buy that you can stop the problem by disabling javascript.
    * did you disable all plugins - and did you still get the problem then ?
    As you mention disabling javascript stops the problem, have you tried with<br /> Java script enabled but
    * block popups ON
    * load images automatically OFF
    * advanced options - ALL OFF<br /> What happens do you get the problem then or not.
    While on this firefox site if I look at the error console Ctrl+Sift+J or Tools -> Error console If I clear the console content and reload the webpage the error console shows only a couple of messages. YouTube home page give a lot of yellow triangle warnings about 200, but no red warnings, do you get red warnings.
    You could also try on the problem sites eg YouTube changing the permissions with tools -> Page Info | Permissions
    Did you try the Basic Troubeshooting suggestion of making a new profile. (Heeding the warning not to delete settings, otherwise you loose all bookmarks etc) did that help ?

  • I have a subVI that is running in an infinite loop. Which subVI is it?

    I have a top level VI that's running and it calls many subVIs. One of those subVIs is stuck in an infinite loop and won't let the top level subVI finish running. Is there and easy way to figure out which subVI is the culprit. The best I can figure is to go into the VI hierarchy and open every front panel until I find the one that has the "running" run arrow. 
    CLD (2014)

    Greetings,
    Even with many sub-vi's using the highlight execution in conjunction with breakpoints should identify your infinity loop pretty easy. If your code is "all over the place" it may take a little bit more time, but if it's done correctly should work like a charm. Just make sure to install breakpoints accordingly (after loops) so you're not waiting for any loops to execute hundreds of times in highlight mode. And if you never reach your breakpoint, well, you know it's in the loop prior to the breakpoint, and can debug from there.You should be able to systematically break it down in no time.
    Good Luck.
    Chazzmd

  • I have three email accounts on my iPhone.  one account is now constantly downloading old emails as unread.  I am know into the thousands.  How can I stop that

    I have three email accounts on my iphone.  one of the accounts is now constantly downloading old emails and marking them as unread. I can I stop this from happening?

    iPhone mirrors the content of your accounts. You can turn off that account by going to Settings > Mail, Contacts, Calendars > account > turn off mail. Then access your email account via webmail/website and delete them there. Once you turn on the account again in your iPhone it wont download them all. Otherwise to leave it downloading then mark them all read once downloaded.

Maybe you are looking for