05-29-2008 09:42 PM
Need to make a correction in one of my above posts ---
BTW... I already looked at the multi-threading examples you suggested ...
Actually, I looked at the examples that came with the CVi developer ... not the links posted.
I found one of the links very useful ...... http://zone.ni.com/devzone/cda/tut/p/id/3663#toc2
The other links, not
05-29-2008 09:42 PM
Need to make a correction in one of my above posts ---
BTW... I already looked at the multi-threading examples you suggested ...
Actually, I looked at the examples that came with the CVi developer ... not the links posted.
I found one of the links very useful ...... http://zone.ni.com/devzone/cda/tut/p/id/3663#toc2
The other links, not so
05-29-2008 09:42 PM
Need to make a correction in one of my above posts ---
BTW... I already looked at the multi-threading examples you suggested ...
Actually, I looked at the examples that came with the CVi developer ... not the links posted.
I found one of the links very useful ...... http://zone.ni.com/devzone/cda/tut/p/id/3663#toc2
The other links, not so much
05-30-2008 09:07 AM
X_Modem_Err = XModemSend (X_Modem_Com_Port, X_Modem_File_Name);
05-30-2008 10:36 AM
05-30-2008 12:21 PM
06-02-2008 01:17 PM - edited 06-02-2008 01:19 PM
06-02-2008 01:58 PM
06-02-2008 02:56 PM
end of X_Modem_UI_RW
The Timer simply ticks every second and does this :
end of timer
When running the panel, and after clicking the command button, the timer starts, the xmodem starts uploading.. as soon as the upload starts, the timer stops updating the slider. When the upload finishes, the timer will start again (but then in the next millisecond, resets to 0 and is disabled - so no use there)..... and if, while the upload is in progress, the mouse or any other "non CVI" program is used, then the timer does update the slider values, but not each second... more like hit and miss... the more events I manually generate by moving the mouse, the better the tick resolution... if the mouse is not moved at all, the timer simply does not update the slider... this is "proved" (using the word loosely here) by seting a breakpoint at the processing section of the timer loop...
I set up the break point, run the program, and stop moving the mouse... the upload starts and continues, the timer never hits the break point.... so I'm pretty well satisfied that the timer is not being called (for whatever reason) .....
As far as i can the code is simple, straightforward, and there is no reason the timer should not be ticking (causing events)....
int threadFuncID = 0;
int Thread_Ret_Value = -9999; // dummy return value set as a default for debug purposes
SetCtrlAttribute (Panel_X_Modem, UI_X_Modem_NUM_SLIDE_XM, ATTR_MAX_VALUE, ticks);
SetCtrlAttribute (Panel_X_Modem, UI_X_Modem_TIMER_Count_Down, ATTR_ENABLED, 1);
X_Modem_Com_Port = com_port_ref;
packet_size = size_of_packet;
X_Modem_File_Name= upload_file_name;
CmtScheduleThreadPoolFunction(DEFAULT_THREAD_POOL_HANDLE, SendFileThreadFunc, 0, &threadFuncID);
CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE,threadFuncID, OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
CmtGetThreadPoolFunctionAttribute (DEFAULT_THREAD_POOL_HANDLE, threadFuncID,ATTR_TP_FUNCTION_RETURN_VALUE, &Thread_Ret_Value);
CmtReleaseThreadPoolFunctionID (DEFAULT_THREAD_POOL_HANDLE, threadFuncID);
SetCtrlAttribute (Panel_X_Modem, UI_X_Modem_TIMER_Count_Down, ATTR_ENABLED, 0 );
SetCtrlAttribute (Panel_X_Modem, UI_X_Modem_NUM_SLIDE_XM, ATTR_CTRL_VAL, 0 );
return (Thread_Ret_Value);
}
int CVICALLBACK CB_Count_Down (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
static int current_tick;
static int max_tick;switch (event)
{
case EVENT_TIMER_TICK:GetCtrlAttribute (Panel_X_Modem, UI_X_Modem_NUM_SLIDE_XM, ATTR_CTRL_VAL, ¤t_tick);
GetCtrlAttribute (Panel_X_Modem, UI_X_Modem_NUM_SLIDE_XM, ATTR_MAX_VALUE, &max_tick);
if ( current_tick < max_tick )
{
SetCtrlAttribute (Panel_X_Modem, UI_X_Modem_NUM_SLIDE_XM, ATTR_CTRL_VAL, (current_tick+1) );
}
else
{
SetCtrlAttribute (Panel_X_Modem, UI_X_Modem_NUM_SLIDE_XM, ATTR_CTRL_VAL, 0 );
}
break;
}
06-02-2008 04:22 PM