Timer fucntion

Hi all,
I am trying to port VB 6.o code to LabVIEW 7.0. Got stuck up with timers. Please help me to sort of this issue. In the current VB code, there is a fucntion called Scan, which receives the input from GUI. This function execution is based on timer value. Say if the timer is set for 5ms, then the scan will be called for every 5ms and also, if I click on any button in the GUI or change any value. The changed value will be passed to scan function.
I need to implement the same in LabVIEW program. So, I used millisecond timer in loop, to execute the code present in the loop for every 5ms. But now the other part of the code (like change in any control value etc) is not getting executed ,till this while loop terminates. I am totally confused in the design of the code. Help Me
Thanks,
Poornima

A better way to do this is an event structure. It eliminates polling entirely and you can create events for any kind of FP changes you desire. Instead of polling every 5ms if anything changes, the code waits until an event occurs.
The basic design is an event structure inside a while loop. Any monitored event (e.g. value change of a control) will trigger execution of the assigned event case. Have a look at the shipping examples. Search for "events". Have a look at e.g. the example named "event tracking.vi" or "New event handler.vi".
Back to your original question:
Without event structures, you need to compare each value with the previous value from a shift register at each iteration to see if they have changed. use the boolean output of the comparison to switch to a designated execution case. If nothing changed, play an empty case. The case structure of course must be in the same loop where the polling takes place, NOT outside the loop as you seem to be trying to do.
There are many more complex ways to do this, e.g. with seperate loops for UI and computations, linked by e.g. queues. At this stage, I would keep it simple.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Set polling time with BPEL and ESB File Adapters

    We have create file adapters in BPEL and ESB. We see where you can set the frequency for polling but do not see a place to set the polling time. We would like it to check a directory every 24 hours at midnight. We can set the 24 hours but not the midnight. How does ESB and BPEL determine the time to run based upon the interval?

    Oracle SOA is started, from the time the adapter is loaded, the interval counting starts. It is not on a particular time.
    If you want to start a BPEL process on a certain time, you could use the quartz timer fucntionality of BPEL to start an instance on a particular time (like unix cron tab).
    Marc

  • Gui timer v/s Async timer priority

    Hi NI,
    I am trying to build an application where in i am communicating with an automotive ECU over RS-232 periodically. I am using an aysnc timer to do the communications part and a GUI timer to do the graphical object update. I have three questions for your team.
    1. What RTOS and PC configuration do you recommend for using a RT Async Timer with Prority ? (preferably whats available in the market today in terms of "cheap" hardware)
    2. What is the priority of the GUI timer when compared to the Async timer? Is is possible for the GUI timer to inetrrupt the Async timer fucntion call ? If yes...is there an exclusion mechanism that would stop this from happening ?
    3. I am using a two linked list concept...the first list populates while the other's data is being drawn on the strip chart...and then i flip over to populating the second linked list while the first lists data is being plotted. The communications(population of data in a structure in a linked list) is being done in the Async thread while the plotting is being done in the GUI thread. The issue i am facing is that i do not have a clean linked list population, plotting and freeing of data sequence...i feel this is due to some un-predictability in the timer function calls.(hence Q2 above). Do you recommend only using thread safe queues or do you think this is do-able with linked lists.
    Looking forward to your reponse.
    -Ashish

    I don't know what degree of certainity you need but a "fixed calling and execution sequence" is just a dream in a Windows environment.
    Windows will operate your threads together with many more of its own, all with varying priorities.
    So, you should think of priority as a vague way of making one thread to be operated more/less than another lower/higher degree thread.
    No thread priority class guarantees a certain frequency of thread execution.
    GUI timer callbacks are executed in the main program thread while async timers are executed in a seperate thread.
    So, yes their execution times may coincide. Hence the need to protect your global data.
    Data accessed by multiple threads should be protected so that, no thread would be interrupted in the middle of a write/read operation on that data.
    TSQs do that for you. Otherwise you cannot be sure about the integrity of the data you are plotting.
    If you need do some more reading about this. But TSQs stand out as a more elegant way to solve your problem.
    S. Eren BALCI
    www.aselsan.com.tr

  • Regarding Fucntion module for Labor and Machine times

    Dear all,
    Is there any fucntion module to get the labor and machine times when we give in material and plant.
    thanks
    J

    check the function
    SCOV_TIME_DIFF
    Import parameters               Value
    IM_DATE1                        2008-01-01
    IM_DATE2                        2008-01-01
    IM_TIME1                        10:00:00
    IM_TIME2                        11:30:00
    Export parameters               Value
    EX_DAYS                         0
    EX_TIME                         01:30:00

  • DBMS_JOB Not running for the scheduled time, but run with .run fucntion.

    Hi all,
    I am executing a job every 15 minutes which have to delete the rows created in every 30 minutes.
    ========================================
    Jobs Submitted as -
    begin
    sys.dbms_job.isubmit(job => 202,what => 'del_test_info_p;',next_date =>sysdate,interval => 'sysdate + 15/1440');
    commit;
    end;
    ==================================
    Procedure that is running in Job -
    CREATE OR REPLACE procedure del_test_info_p is
    cnt number;
    begin
    select count(*) into cnt from test where ((created_at+30/1440)<=systimestamp);
    update jobcount set cnt=cnt+1 ;
    delete from test where ((created_at+30/1440)<systimestamp);
    update jobcount set cnt=cnt+1 ;
    commit;
    dbms_output.put_line (cnt ||' ROWS DELETED');
    end del_test_info_p;
    =====================================
    PROBLEM - Job is running in every 15 minutes as per user_jobs but rows are not deleteing from the test table whose created time is more then 30 minutes from systimestamp. Even the views are not having logs of any job run.
    Checked the queries and run the job Manually using dbms_job.run.. gives correct output and deletes the row.
    Please suggest where is the problem and how I can correct it.
    With Regards
    Amit Nanote

    HI All,
    I have found solution for this. Dont use Systimestamp in the DML's if using in a job (scheduled).
    There is a statement in procedure del_test_info_p
    delete from test where ((created_at+30/1440)<systimestamp);
    Here usage of systimestamp restricting that procedure to execute.
    Create procedure as -
    CREATE OR REPLACE procedure del_test_info_p is
    tstamp timestamp;
    begin
    select systimestamp into tstamp from dual;
    delete from test where ((created_at+30/1440)<tstamp);
    commit;
    end del_test_info_p;
    Thank You.

  • How to use expression fucntion at deadines for task in time constraints Tab

    Hi all,
    The Human Task should have a start deadline by which the Task has to be started. Or otherwise some other Task will run. I did this with a boundary Event StartDeadlineIsCriticalExeption and an offset for the start deadline at the task.
    but this is a fixed value now i want to modify that with expression function .
    Edited by: Vikramshirole29 on Sep 20, 2010 1:20 PM

    Hi
    We can use a dateTime value to set completion deadline dynamically. I guess we can do the same for start deadline also.
    I am using the dateTime(String val) inbuilt function for this.
    Regards
    Vidyadhar

  • The sync fucntion resets every time I restart firefox. Why is this happening?

    I open Firefox and set up sync. I have an existing account. When I close Firefox and then open again, the sync function is reset and I have to set it up all over again.

    Changing the settings so that saved passwords are not deleted when Firefox closes solve the problem. I'm not using a master password so I don't think that is an issue.

  • Absence quota generation with PCR in Time Evaluation

    Dear All,
    I am generation absence quota Annual leave = 50 through PT60- ZM04. Its daily calculation and transfered at the month end.
    The quota entitlement is 30 days per year.
    I have written this pcr. Have configured a time type too. but not sure why its not generating any quota.
    The time type I have configured is:
    Time Type: 0097
    Save as day balance - No Formation
    Save as period balance - 1
    Store for time accounts - 1
    Have assigned the time type 0097 in Base entitlement for Absence quota generation as Day Balance and even in generation rules.
    Have placed the PCR with ACTIO Z003 before CUMBT fucntion.
    The PCR Z003 is:
    000010 D HRS?0
    000020 *
    000030 = D OUTAQTYP
    000040 = **
    000050 = 50 Z GCY ZQTY
    PCR ZQTY is:
    000010 D OUTWPMOLGA
    000020 **
    000030 99 HRS=FR50C ADDDB0097Z ADDDB0097 HRS=D0097
    I didnt mention anywhere in configuration or PCR that its 30 days per year.
    Do I need to do this?
    Have I missed out anything, please help me.
    Thanks & regards,
    Majid

    Hi,
    This you can do through config also without using PCR.
    Base entitlement is 30 for calender year. Selection rule- Accrual period is daily and transfer time is time evaluation period.
    Use appropriate rounding rule in selection rule.
    Rgds,
    Lata

  • XSLT Mapping server Time

    Hi,
      I am doing a xslt mapping, i need to mark a field with the server Time of xi server, any lights on this?
    Regards,
    Anirban.

    Hi Anirban,
    i think u dont have a fucntion to get the current time of the server directly in XSLT.you need to write a user defined function in java to get the current time and call that java function in XSLT.
    u can try this code for getting time
    SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss a z");
            Date now = new Date();
            String nowAsString = formatter.format(now);
    if u run it in ur XI server u will get the server time.
    for calling java functions in XSLT chk out this link
    How to use standard java functions in a XSLT mapping
    regards
    jithesh

  • How can I load a picture and use it in ActiveX in run time ??

    I am using an ActiveX object which needs a property "picture" as input.
    I can set the picture property in its property page in design time, but I don't know how to give it a "picture" in run time.
    In VB, I can do:
    dim pic As Picture
    pic = loadpicture("c:\test.bmp")
    control_1.picture = pic
    (("control_1" is the ActiveX object, and picture is the property))
    How can I do the same with labview?
    Is there any example that sets the picture property of an ActiveX in run time?

    sealiker wrote:
    I am using an ActiveX object which needs a property "picture" as input. I can set the picture property in its property page in design time, but I don't know how to give it a "picture" in run time. In VB, I can do:   dim pic As Picture pic = loadpicture("c:\test.bmp") control_1.picture = pic (("control_1" is the ActiveX object, and picture is the property))   How can I do the same with labview? Is there any example that sets the picture property of an ActiveX in run time?
    As
    far as I understand from the MSDN site, it seems that the Picture
    datatype is a specific VB only datatype. Most probably it is a handle
    (uInt32) value as far as other programs including LabVIEW are
    concerned, but there is no way that LabVIEW could deal with this
    datatype directly.
    If you can convert this datatype with some VB fucntions into a HBITMAP
    or HDIB then you could call some Win32 API functions to extract the
    relevant bitmap data from this common Win32 datatype and get somewhere
    from there. OR it maybe that VB itself has other functions to extract
    the bitmap data, color palette and other attributes of the Picture
    datatype. Don't expect LabVIEW to be able to deal with the Picture
    datatype directly though, this is really a proprietary VB thing.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Count and range columns based on amount of time

    I'm doing SSRS and I have a table that has two different datetime columns called TranTime and AppTime.
    What I want to do is take the difference in time between those tables and do some counting based on that difference calculated.  For example, if the difference between the two dates is less than 5 minutes, then I want to have a column that counts
    the number of rows that have less than 5 minutes.  I want to do the same thing to count the number of rows that are greater than or equal to 5 minutes, but less than 10 minutes.  And have another column that is greater than or equal to10 minutes,
    but less than 15.  And then have a final row that counts all of the rest of the rows that are 15 minutes or greater.  I think I have to use some sort of case statement but I keep getting error messages. Any thoughts...? Thanks in advance

    Hi jrcowles94,
    According to your description, you have two datetime type columns in your report. Now you want to count the number of records based on the difference of these two data fields. Right?
    In this scenario, we can use DateDiff function to get the difference between two datetime. Then we use IIF function to make judgement inside of aggregation fucntion, also specify the scope for the aggregation function. We have tested your case in our local
    environment. Please try the expressions below:
    <5: =sum(IIF(DateDiff(DateInterval.Minute,Fields!TranDate.Value,Fields!AppDate.Value)<5,1,0),"DataSet1")
    5-10: =sum(IIF(DateDiff(DateInterval.Minute,Fields!TranDate.Value,Fields!AppDate.Value)>5 and DateDiff(DateInterval.Minute,Fields!TranDate.Value,Fields!AppDate.Value)<10,1,0),"DataSet1")
    >10: =sum(IIF(DateDiff(DateInterval.Minute,Fields!TranDate.Value,Fields!AppDate.Value)>10,1,0),"DataSet1")
    The result looks like below:
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • PCRs of time management

    hi experts
    kindly provide the list of all the  PCRs of time management schema TM04 with description.
    so that i can understand which rule is used to do what.
    as im trying to learn about rules, functions & operations.
    i also request  the list of Funtions and operations on time management schema TM04.
    i understand  i can pick them up from pe02 and pe04 and i tried it too but i really need them as soon as possible
    and its taking time for me to work around so once u experts provide me the list of rules function and operations of
    time managemnt i can work on them more effectively with certain data in my hand.
    Please provide me the list of rules ,fucntions and operations.
    special request to my favorite members(sikindar,anantha prakash,Ram manohar)
    regards

    Hello Sikandar,
    Can you also kindly forward me TM Schema and PCR docs..Im a complete layman in these areas, though ive a brief understanding of how it functions.Also do uve any idea on End user manuals and HR Report Management, I mean docs on how to generate reports by an Enduser, especially payroll related. If so kindly do help me.
    Thanks a million in Advance,
    [email protected]

  • Time Siries AGO Error

    Hi,
    When i try to use the AGO function in time sieries i am getting below error.
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22040] To use AGO function, the storage level of the query ('[MV_CALENDAR.YEAR_454, MV_CALENDAR.MONTH_454]') must be a static level. (HY000)
    I have a fact table which stores data at the month level. It has item#,Year#,month# and sales measure for all the months. I have created Calendar Dimesion on Calendar logical table and made it as time dimesion. When i try to create previous month sales column in BMM layer using Timesiries AGo fucntion i am getting the above error.Please help me.
    Thanks in advance
    Regards,
    Shanx

    Hi,
    I have a calender dimension table which consists of Year,month,month key, no of weeks columns in that table.
    I have created Calendar Dimension as Total Years(Grand Total)->Years(Year as key,2 elements)--> Month(Month Key as Key,12 elements). Then I have created new column in BMM layer called Last Month Sales using timesiries AGO function like AGO(IR.MV_AGG_ITEM_LOC_HIST.SALES_ISSUES, IR.calendar."Month", 1) where SALES_ISSUES logical column stores sales data for all the months.
    Can you please check and let me know where i have done wrong?
    Thanks in advance
    Regards,
    Shanx

  • Time to HHMM integer in Labview 7

    I know i asked this a while ago but for labview 5, well now we have labview 7, and i can't find the function that was posted for me to try in 5. I'm trying to get the current time in just HHMM format but as an integer so that i can add it to an existing integer array. I tried playing woith the date format and the string to number fucntions and i just can't get it work.

    Since you won't be able to open the 7.1 VI, the way to find your old posts is click on your name on the left and then select the Find All Posts... link. The function Ben used can be found in the Time & Dialog palette. To find VIs in palettes, you can use the search button which should appear on the top of the palette when you open any palette.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Time reduction  for  getting materials as per plants, login from R/3

    Hi All,
    I am technical person working on SRM . Our SRM configuration uses the ITS for the end user to login to SRM server.
    The requirement is that, the user logged into the SRM must see the material for the plants which they are assigned in org. structure(through  search help) while creating the shopping cart. 
    Since I was unable to find any link between the Plants and material in the SRM server, I used the RFC fucntions to do the same i.e i tried getting the materials from the backend.
    But the time taken to achieve the objective is more due to the amount of the materials .
    Could you please suggest any means by which I can avoid going to backend sytem and achieve the same in the SRM system?
    Regards
    Sachin

    Hi Yann,
    Thanks for the pointers to the discussion. They did provide certain insights to as,  what can be the possible alternatives.
    I am interested in knowing or want a final word or confirmation,  whether I can by any means use the SRM server only for getting the materials based on user and hence plant, without querying the backend.
    From what I have seen  in dicussion , I think that only resort is to get to the backend to do the same, whether I develop RFC enabled Function module in backend or use the BAPI_GET_LIST or the META_* function
    Regards Sachin

Maybe you are looking for