PDA While Loop using Bluetooth results in interface lockup

The PDA Module ships with an example project that demonstrates client/server Bluetooth communication.  I decided to try it out with my PC acting as the server and my PDA as the client.  The demo basically transmits waveform data continuously via Bluetooth from server to client.  Attached is the code for the client PDA and the heart of the code is a while loop which continuously accepts data via Bluetooth and outputs the data onto the display.  For the most part, this is the stock example VI
that ships but I had to modify the interface with an event structure so
that I could use the PDA virtual keyboard to enter in the proper server
address.
The Bluetooth portion of the demo actually works great!  When the data set is set to random, the PDA very quickly displays new random data on the LCD.
The problem occurs when I try to stop the VI.  Both the disconnect and Exit booleans are unresponsive when I tap their respective buttons.  My desired application will behave similarly to this demo which is why this is of concern to me.  Is there a better way to implement a continuous Bluetooth polling system but still retain the functionality of my front panel?
System specifications:
PDA Module 8.0.1
iPAQ hx2790
Windows Mobile 5.0.
Attachments:
NI PDA Bluetooth demo.JPG ‏106 KB

Hi,
Just by looking at the snapshot it is hard to tell what's going wrong. Since the bluetooth part is working fine, I would suggest that you try to strip the bluetooth part from your VI and run the VI in highlight execution mode. This should shed some light on what happens when you click on Stop or Exit buttons. If you still need help after that, please post your stripped VI here and someone from the community will be sure to help you out.  
Regards,
Ankita

Similar Messages

  • Stopping a while loop using the time difference of two tick counts

    Hi Guys,
    I'm currently writing a code which test how long does it take for a formula node to perform its operation. The program uses a while loop to perform the calculation, and the program stops after calculating when tick count has reached 10 seconds. The program then displays the number of iterations it does in 10 seconds. 
    So initially I created 2 frames of sequence structure. In my first frame I have my initial tick count, and in my second frame I have my final tick count and the while loop. I used the subtract function and divide the output by 1000 to get the time difference. Then using the comparison function, I set if output > 10 then the program should stop, to do this I linked the output of the comparison function to the stop button inside the while loop. 
    However, when I tried to run the code, the program just didn't run. Hence I created a similar program which puts the last tick count in new frame sequence. When I ran this code, the program never stopped. 
    Do you guys have any idea what went wrong with my codes.
    Thank you!
    Erry
    Solved!
    Go to Solution.
    Attachments:
    1. Tick Count.vi ‏27 KB
    tickcoun2.vi ‏27 KB

    Dataflow!
    In both VI's the stop terminal of the while loop is controlled by a boolean whose source is ouside of the while loop.  So that loop will either run once, or run forever, depending on the value of the boolean that is calculated before the loop starts and shows up at the tunnel going into the loop.
    I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • Question about while loop using Timer?

    I am trying to use a while loop to read data from oscilloscope through
    GPIB card continously(lasting for a fixed time, for example,1 minute). I
    want a Timer, when it expires, the while loop will stop. But I do not
    know how to implement it.
    Any help would be greatly appriciated!
    Thanks in advance.
    zhljh
    Sent via Deja.com http://www.deja.com/
    Before you buy.

    In article <87q5t2$7kh$[email protected]>, wrote:
    >I am trying to use a while loop to read data from oscilloscope through
    >GPIB card continously(lasting for a fixed time, for example,1 minute). I
    >want a Timer, when it expires, the while loop will stop. But I do not
    >know how to implement it.
    So, you need it to count down, then I assume? Okay, you need to put a
    true/false node within your for loop. Set the true case to i=1 (iteration
    of the for loop) so that it will initialize one time (and be true one
    time). Then, add whatever time you need for the vi to run to that
    indicator (where you send a numeric value on the first iteration). Put a
    greater than comparison to the timer and the additoin of the indicator and
    your value. Let that be the term
    inating thing on your for loop.
    Now, this might present a problem with a circular reference. If it does,
    you'll need to basically do the same thing, only you'll need to send the
    value through a shift register in the for loop.
    Harry

  • Running java process in a while loop using Runtime.exec() hangs on solaris

    I'm writting a multithreaded application in which I'll be starting multiple instances of "AppStartThread" class (given below). If I start only one instance of "AppStartThread", it is working fine. But if I start more than one instance of "AppStartThread", one of the threads hangs after some time (occasionaly). But other threads are working fine.
    I have the following questions:
    1. Is there any problem with starting a Thread inside another thread?. Here I'm executing the process in a while loop.
    2. Other thing i noticed is the Thread is hanging after completing the process ("java ExecuteProcess"). But the P.waitFor() is not coming out.
    3. Is it bcoz of the same problem as given in Bug ID : 4098442 ?.
    4. Also java 1.2.2 documentation says:
    "Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock. "
    I'm running this on sun Solaris/java 1.2.2 standard edition. If any of you have experienced the same problem please help me out.
    Will the same problem can happen on java 1.2.2 enterprise edition.?
    class AppStartThread implements Runnable
    public void run()
    while(true)
    try
    Process P=Runtime.getRuntime().exec("java ExecuteProcess");
    P.waitFor();
    System.out.println("after executing application.");
    P.destroy();
    P = null;
    System.gc();
    catch(java.io.IOException io)
    System.out.println("Could not execute application - IOException " + io);
    catch(java.lang.InterruptedException ip)
    System.out.println("Could not execute application - InterruptedException" + ip);
    catch (Exception e)
    System.out.println("Could not execute application -" + e.getMessage());

    I'm writting a multithreaded application in which I'll
    be starting multiple instances of "AppStartThread"
    class (given below). If I start only one instance of
    "AppStartThread", it is working fine. But if I start
    more than one instance of "AppStartThread", one of the
    threads hangs after some time (occasionaly). But other
    threads are working fine.
    I have the following questions:
    1. Is there any problem with starting a Thread inside
    another thread?. Here I'm executing the process in a
    while loop.Of course this is OK, as your code is always being run by one thread or another. And no, it doesn't depend on which thread is starting threads.
    2. Other thing i noticed is the Thread is hanging
    after completing the process ("java ExecuteProcess").
    But the P.waitFor() is not coming out.This is a vital clue. Is the process started by the Runtime.exec() actually completing or does the ps command still show that it is running?
    3. Is it bcoz of the same problem as given in Bug ID :
    4098442 ?.
    4. Also java 1.2.2 documentation says:
    "Because some native platforms only provide limited
    ed buffer size for standard input and output streams,
    failure to promptly write the input stream or read the
    output stream of the subprocess may cause the
    subprocess to block, and even deadlock. "These two are really the same thing (4098442 is not really a bug due to the reasons explained in the doc). If the program that you are exec'ing produces very much output, it is possible that the buffers to stdout and stderr are filling preventing your program from continuing. On Windows platforms, this buffer size is quite small (hundreds of characters) while (if I recall) on Solaris it is somewhat larger. However, I have seent his behavior causing problem on Solaris 8 in my own systems.
    I once hit this problem when I was 'sure' that I was emitting no output due to an exception being thrown that I wasn't even aware of - the stack trace was more than enough to fill the output buffer and cause the deadlock.
    You have several options. One, you could replace the System.out and System.err with PrintStream's backed up by (ie. on top of) BufferedOutputStream's that have large buffers (multi-K) that in turn are backed up by the original out and err PrintStream's. You would use System.setErr() and System.setOut() very early (static initializer block) in the startup of your class. The problem is that you are still at the mercy of code that may call flush() on these streams. I suppose you could implement your own FilterOutputStream to eat any flush requests...
    Another solution if you just don't care about the output is to replace System.out and System.err with PrintStreams that write to /dev/nul. This is really easy and efficient.
    The other tried and true approach is to start two threads in the main process each time you start a process. These will simply consume anything that is emitted through the stdout and stderr pipes. These would die when the streams close (i.e. when the process exits). Not pretty, but it works. I'd be worried about the overhead of two additional threads per external process except that processes have such huge overhead (considering you are starting a JVM) that it just won't matter. And it's not like the CPU is going to get hit much.
    If you do this frequently in your program you might consider using a worker thread pool (see Doug Lea's Executor class) to avoid creating a lot of fairly short-lived threads. But this is probably over-optimizing.
    Chuck

  • How do i exit a while loop using event handler

    Hello,
    I have an event handler structure within which i run a while loop for a particular event. I would like to interrupt the execution of this while loop as soon as another event occurs, even if the while loop has not finished execution. I have tried so many ways, the best i could get is exiting one itteration after the new event occurs which is no good for me.
    Any suggestions???
    Thanks
    Me

    Instead of having a task while loop in an event case, put your task while loop in parallel with the loop surrounding the event structure. When the event which should start the task occurs, you can signal the start of the task while loop. You could use local variables of references to start/stop the loop when an event occurs. You could also use notifiers instead of variables to pass signals to start/stop the while loop. In general you should have a while loop for the event structure, and a parallel while loop to do the tasks. The parallel loop is controlled by variables or notifiers which are set in the event cases.
    - tbob
    Inventor of the WORM Global

  • While loop using a timer object

    Hello Technet,
    I have a file that gets created every night by a batch job and I need to send that file every night. So, I came up with a method (if there's a better way, I'd like to hear). I created a 2 hour timer object to run a while loop. While the time elapsed is less
    than 2 hours, the loop will run.  In the loop, I have a if condition to test for a file.  If the file is not there, then sleep for 10 minutes.  If the file is there, then send it to me with send-mailmessage. The problem is, I will get the file
    sent to me at every interval because the loop is terminated by the timer. I would like the loop to terminate once the email message is sent to me.  Here is my code snip. Can someone please help on getting the loop to terminate when the message is sent?
    $file = "c:\file.txt"
    $timeout = new-timespan -hours 2
    $sw = [diagnostics.stopwatch]::StartNew()
    while ($sw.elapsed -lt $timeout)
    if(!(test-path -path "$file1"))
    file is not there...yet
    start-sleep -seconds 600
    else
    $SmtpServer = "relay"
    $To = "my@emailaddr"
    $From = "me@emailaddr"
    $Subj = "Got it"
    $Attm = "$file1"
    $Body = "Please see Attachment"
    Send-MailMessage -smtpserver $SmtpServer -from $From -to $To -subject $Subj -body $Body -attachment $Attm

    Hi,
    You can use break:
    http://ss64.com/ps/break.html
    EDIT: Alternatively, you can try this:
    $filePath = 'c:\file.txt'
    $found = $false
    Do {
    $file = Test-Path -Path $filePath
    If ($file) {
    Send-MailMessage -To [email protected] -From [email protected] -Subject 'Got it' -Body 'Please see Attachment' -Attachments $filePath -SmtpServer smtp.domain.com
    $found = $true
    Else {
    Start-Sleep -Seconds 600
    Until ($found -eq $true)
    This will loop until the file is found instead of relying on a timer.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • Connection between Sony ericson PDA and desktop using bluetooth

    Hi folks,
    My desktop is bluetooth enabled using a motorola USB dongle and I have a Sony Ericsson 910i PDA. My program which is written in JAVA needs to communicate with a midlet running on the PDA. Unfortuantely it doesn't, 'cause its not able to discover the PDA nor find the services.
    I have tried most of the bluetooth libraries like jsr82,bluecove,atinav,avelink .... but even the test programs which come as a part of these jars do not discover my PDA.
    The motorola USB dongle comes with a Widcomm bluetooth stack versioned 4.0.1.2500.
    Am stuck up with this from past 4 weeks and its really frustrating.
    Can anyone please help me regarding this.
    Thanks in advance,
    $hanki

    Can u tell me from where u downloaded the Widcomm..
    i am unable to download Widcomm..

  • How do I correctly time while loops using SCPI and VISA/Ethernet communication to send DC current Values to a Power supply?

    I'm rather new to using labview and I having an
    issue with a test Data Aquisition lab I'm trying to setup using a
    Keithley 6221 AC/DC current source and a basic PCI M-series NI-DAQmx. 
    First of all, I'm looking to update the  current value on a power
    supply at a rate of atleast 10Hz and I'm using SCPI commands and VISA
    communication through ethernet to do so.  Attached below is the VI I
    have written. 
    The issue I'm having is this:
        My VI will
    loop through the values fine in software, or so it seems.  I am unable
    to get the Power supply to update sequentially if I don't set my loop
    delay to anything greater than 130ms.  If I try to run the loop faster
    it starts skipping values instead of counting 1,2,3,4,5,1,2,...etc.  it
    goes 1,2,4,5,2,4,1,2 on the display of the power supply and my DAQ unit
    also skips these values so I know that the number just isn't getting
    read to the Power supply in time.  I was wondering if this was due to
    my sloppy programming or if it is a hardware issue, my computer or the
    method of communication to the power supply?  Is this due to the fact
    that I'm using ethernet and VISA communication?  Is there a faster way
    to communicate or is GPIB faster?  Any input at all would be extremely
    helpful.
    On a side note:  Right now I'm using an pre-determined
    array of values that I can update on the fly but in the future this
    with be put into a  closed-loop control system.  The value for the
    power supply output will be determined by the loop and sent that way.
    Attachments:
    basic DC loop 6221 Keithley.vi ‏145 KB

    Also, one of the string constants is NOT set to '\' Codes Display. Here is an alternative method of calculating the index. I removed the DAQ and VISA stuff since I could not run it.
    Lynn
    Attachments:
    basic DC loop 6221 Keithley.2.vi ‏16 KB

  • How to put the break at the first place of execution While Loop

    Hello everybody,
    I have a problem with a while loop.
    I made the interface of a tic-tac-toe game with labview.
    my problem is that after the computer has won or there is a draw, that the board has to be updated, which i do by shift register.
    My problem is now though, that there isn't a break after i updated the board. I have to click one more time on the board(and execute the whole VI) before the break sets in.
    so my question is, how can i put the break in a way that the condition is checked everytime BEFORE the VI runs?
    Thank you very much

    The correct way is probably to use a state machine architecture. Simply enter the idle state when the game is over.
    LabVIEW Champion . Do more with less code and in less time .

  • Is it possible to have one while loop in another while loop

    Is it?

    Well, actually there are several possibilities:
    1. You right click the orange square where the double value gets out of the loop and select "enable indexing". This results in an array of all values you get while this inner loop is running.
    2. You add a shift register to the outermost loop and use the "build array" function after the inner while loop. This results in an array of the last value after the inner while loop has stopped.
    3. You combine both ways described above. Then you get a 2D-array.
    You can see this in the attached vi. In every case you have to be aware of what happens with the memory. In case 2 and 3 the array grows steadily. This could leed to problems, so you have to take care to empty it, if possible.
    Now it depends on what kind of data you need.
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    BuildArray.vi ‏16 KB

  • While loop in xpress

    Hi,
    I have retrieved a list of users. Each user having some attributes like manger id, user id, location. I have stored the result in one attribute named 'test'. Now i want to create a while loop so that each user is fetched and all the attributes of eaach user are getting fetched.
    i have done the search on th basis of firstname and last name..here is the code
    <set name='test">
    <invoke name='funcname' class='classname'>
    <ref>fname</ref>
    <ref>lname</ref>
    </invoke>
    </set>
    now i want to start a while loop using this
    <ref>
    <concat>
    <s>test[#</s>
    <ref>i</ref>
    </s>]</s>
    </concat>
    </ref>
    please tel me what should be the code for while loop so that all the entries are fetched for each user

    Hi princy,
    Can you tell me how are the attributes stored in each user?
    Here test variable is a list,where each element of list represents a user.Now how attributes Like manager,location stored in it?can u clarify tht?
    Thanks.

  • How can I opearate indicator outside while loop?

    I do small program, I have many while loops and I want to connect wire (in my application) from each loop to AND gate then to another while loop, but how can I operate these wires to agree with the change of my application inside while loops.
    If not clear :
    In another words, suppose I want to operate indicator ouside the while loop. How can I operate indicator outside while loop, so when my application become TRUE (inside while loop) the indicator will be ON (outside while loop) and when my application become FALSE(inside while loop) the indicator will be OFF (outside while loop).
    Help me if you have any idea please..........................

    Hi Rammo,
    For the wire to carry the boolean condition from the while loop to an 'and' gate outside, the while loop must stop running
    If you want the while loop to keep on running and still pass a boolean value to a destination outside the while loop, use any one of these: property nodes, global or local variables.
    i am still not clear as to what you intend to say by this sentence
    " I want the wire that comes out from the while loop will become TRUE if it in my application is TRUE inside while loop and the opposite is true. Because I want to connect the wire that comes out from while loop to AND gate than to another application"
    plz tell me if the first part of this mail of mine answers your doubt or do you need more information?
    regards
    Dev

  • ReadUTF() and exiting a server while loop

    What I want to do is simple.. I want to be able to type "exit" into a client and send that message to the server... And exit the server while loop as a result.. Here is what I tried.
    //server code
    while(true)
    //bla bla bla
    //bla bla bla
    String message = socket.readUTF();
    if( message == "exit" )
    break;
    // bla bla bla
    however, when I type exit and send the message, this while loop doesn't break.. I'm new to java so I'm wondering if I'm messing up syntax somewhere.. It seems like it should work fine, whats going on?

    if(message.equals("exit"))

  • Event structure + while loop

    Hello, I'm trying to figure out for a half a day how to unite two while loops in attached VI
    The first while loop creates solid state machine that reacts on each button press and executes one of the case structure events. (this part works fine)
    The second while loop, all the time generates random number, but it stops the generation during the time when one of the case structure events are executed. (this is the ticky part)
    Any suggestions?
    Solved!
    Go to Solution.
    Attachments:
    SSM_v1.1.vi ‏15 KB

    If you want your random number to stop while the user triggered events are executing you should be able to simplify your design quite a lot.
    It can be done with one while loop using the timeout case.
    Troy
    CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
    I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
    Beware of the man who won't be bothered with details. - William Feather
    The greatest of faults is to be conscious of none. - Thomas Carlyle
    Attachments:
    SSM_v1.2.vi ‏16 KB

  • SubVi with feedback nodes used more than once inside a While Loop

    All,
    I have a subvi that does a set of operations and uses 3 feedback nodes. I am using this subvi inside a While Loop a total of 4 times. I've noticed that all instances used share the same result at each corresponding feedback node but I would like to have an individual result from each of them. Is there an easy way to go around this problem? I have come up with ways to avoid this: a) create a different vi for each time the subvi was used. b) use global variables instead of feedback nodes. Is there any easier way to go around this issue?
    ExamplePlease note that both subvi's are the same) If on my first subvi I calculate a maximum value and get 1.29 (then goes to feedback node) on my second subvi i get 1.01 my feedback node at the second subvi still registers the maximum value to be 1.29. (and I want it to be 1.01!)
    Hope this is not too confusing, I've been scratching my head with this for a while, can't find the "easy" button. Thanks in advance.
    -Pop
    Im using 9.0.
    Solved!
    Go to Solution.

    Attaching the code would be helpful. Anyway, I am not sure how multiple feedback nodes are supposed to operate so I will defer that to others to answer. As far as being able to use distinct values or instances if you are using a subVI you could mark it as reentrant. That way each call to it will behave as it it were a copy of the VI and it will have its own memory space. This should include the feedback node. You may be ending up with a single subVI and in reality a single feedback node. If you need to pass data between calls than simply wire the data through. You could also use an Action Engine to store and retrieve values. An AE is a MUCH better solution than a global variable.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for