Hi, I need the MQX function for time delay in microseconds, I tried to modify the _time_delay () that is only for milliseconds, but without success. I'm using the TWR-PXN20 with CW10.2 + MQX3.8. do you know how to solve this problem? I need a similar function as _time_delay () but for a microsecond.
Here is my attempt to edit the function _time_delay :
The function works correctly when microseconds> = 1000. but when microsecond <1000 the function still behaves as if the delay was set to 1000US (1ms).
void _time_delay_mikro
(
/ * [IN] the number of mikroseconds to delay * /
register uint_32 mikroseconds
)
{/ * Body * /
register KERNEL_DATA_STRUCT_PTR kernel_data;
register TD_STRUCT_PTR td_ptr_;
# if MQX_ENABLE_USER_MODE && MQX_ENABLE_USER_STDAPI
if (MQX_RUN_IN_USER_MODE) {
_usr_time_delay (mikroseconds);
return;
}
# endif
_GET_KERNEL_DATA (Kernel_data);
_KLOGE2 (KLOG_time_delay, mikroseconds);
if (! mikroseconds) {
_KLOGX1 (KLOG_time_delay);
return;
} / * Endif * /
td_ptr_ = kernel_data-> ACTIVE_PTR;
_int_disable ();
/ * PSP_TIME_TO_TICKS (& time, & td_ptr-> TIMEOUT); * /
/ / PSP_MILLISECONDS_TO_TICKS_QUICK (mikroseconds, & td_ptr-> TIMEOUT);
PSP_MICROSECONDS_TO_TICKS (mikroseconds, & td_ptr_-> TIMEOUT);
/ * Calculate time to wake up the task * /
PSP_ADD_TICKS (& td_ptr_-> TIMEOUT, & kernel_data-> TIME & td_ptr_-> TIMEOUT);
_time_delay_internal (td_ptr_);
_int_enable ();
_KLOGX1 (KLOG_time_delay);
} / * Endbody * /
Thank you for your answers.
Hello Tomas!
Did that hint work?
Best regards!
Monica
Hello Tomas Lipka,
this was already asked & answered here :
Does it help you ? Share the result, thank you.
Regards,
0xc0170