Re: data acqusition, display and control



Premsagar C wrote:
[...]
Tristan,
Heres the basic gist of my prgram
My data acquistion is done in a dialog box called teleop defined by the
function teleop
 void teleop
{ // define my 6 text boxes to dispaly values from my 6 ckts plus my snap
shot button and another textbox obj and a menu button menu;
bacq=gtk_button_new_with_label("FORCE SNAPSHOT");
 then i connect my signals
// this is my basic window, its part of a larger program but am pretty sure
the error is somewhere here
gtk_signal_connect(GTK_OBJECT(tmdialog),"destroy",GTK_SIGNAL_FUNC(destroy_func),NULL);
//my snap shot button
gtk_signal_connect(GTK_OBJECT(bacq),GTK_SIGNAL_FUNC(button_funcsnp,NULL);
 // my timeout that keeps acquireing and displaying data till i click bacq
to=gtk_timeout_add(2000,button_funcacq,NULL)
 }
 gint buttonacq (gpointer data)
{
 // I use nidaqmxbase to acquire data one array at a time then display it
using
 gtk_entry_set_text(GTK_ENTRY(s1text),op1);
//repeats this for all 6 sensors . works np !!
}
 // my snapshot button
 void button
{
 gtk_timeout_remove(to);
//note to,s1text,obj has been declared global at the start of the code along
with the headers
 then depending on the sensor value add some stuff to obj textbob
 }
 My problem is the code works sometime ( 50 %) . when i click on the bacq
button sometimes things work fine . other time i get this error
 LABVIEW caught fatal signal
7.0 - Recieved SIGSEV
reason: address not mapped to object
attempt to reference address : 0x4706e170
 Somehow i dont believe its a link problem with my data acquisition. One of
the things am concerned is the manner i remove my timeout. Am i not removing
the timeout from inside the timeout?? hope this stuff is enough to identify
the problem if not i will need to send a whole deal more of code
 Thanks
Prem


Must you use GTK+-1.2 ? if not; why dont you use
 g_timeout_add/g_source_remove/g_signal_connect ?

The code you've shown here is unclear; surely you dont call
gtk_timeout_add() directly after calling gtk_signal_connect() to
connect to the clicked signal; surely you call gtk_timeout_add in
button_funcsnp() (which I dont see in the above code).

Do you return TRUE in buttonacq() untill there is no data; where
you should then return FALSE to remove the timeout ?

You should also manage the value of "to" (the GSource id);
i.e. you should set it to 0 when returning FALSE from the source
and after calling g_source_remove() on it.

Maybe if you look at the stack trace (i.e. type "where" or "bt"
when running your program under gdb) you'll see what code segment
is writing to unstacked/unallocated memory.

Cheers,
                              -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]