Events and Sequences


tania

Recommended Posts

hi

my current situation is that: i was monitoring simulated ecg and i have two montioring graphs.i have included buttons wherein when i press the button data logging should start.i am not sure where to write the commands and really wonder what is the specific purpose of an event and a sequence.

also as i log my data..the format in my files as they open are all squeezed together and dificult to decipher..the statement formatdatetime("%C",SYSTIME()) ...well..it brought changes only onto my filename how do i do such chnages for my data i recieve?

my main doubt is regarding how can i log my data when i push a button..

i wrote the following sequence

while(switch(0)==1)

begin logging(ecgra) /*where ecgra is my channelname*/

endwhile

but error occurs....

help!

Link to comment
Share on other sites

First, I strongly recommend you go through the guided tour at the beginning of the DAQFactory help / user's manual. It only takes 30 to 45 minutes and it goes over much of this.

To make a logging set start/stop when you press a button:

1) create a button

2) Open its properties and go to the action tab

3) select start/stop logging, then select the logging set

Pressing the button will now toggle the logging set on or off

As for your code:

while(switch(0)==1)
   begin logging(ecgra) /*where ecgra is my channelname*/
endwhile

a) I'm unsure what the "switch" is. Switch is a reserved word, like "while" and "if" and shouldn't be used as a variable or channel name.

:) (0) is the wrong notation if it is a channel and should be [0] instead.

c) I'm unsure what the while() is for anyway, are you trying to log while the button is pressed and then stop logging when it is released?

d) you usually shouldn't put while() loops inside of component actions and events as they will stop whatever triggered the event. In the case of a component action, it will actually cause DAQFactory to hang.

e) beginlogging() is one word

f) beginlogging() works on a logging set, not a channel. You should create a logging set and then put the ecgra channel in that logging set. Then, use the method I described at the top of this page.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.