How i can create a delay?

Hi,

I just begin with connectcore 9C on NETOS. I need create a delay in miliseconds or seconds, but i dont found the way. who can help me ?. Thanks in advance.

tx_thread_sleep(NS_MILLISECONDS_TO_TICKS(250));
(1/4 second delay)

tx_thread_sleep() is a threadx call to suspend a thread for a particular number of TICKS.

NS_MILLISECONDS_TO_TICKS() is a helper macro to convert milliseconds to TICKS taking into account changes in ticks/second as set in the bsp.

for tx_thread_sleep make sure you include tx_api.h
for NS_MILLISECONDS_TO_TICKS() make sure you include bsp_api.h

NS_MILLISECONDS_TO_TICKS is in V7.3 and V7.4. I am not sure about versions prior to V7.3.

Now tx_thread_sleep will work without NS_MILLISECONDS_TO_TICKS as the following:
tx_thread_sleep(250). The difference being that NS_MILLISECONDS_TO_TICKS gives you a more accurate number of ticks based on the number of milliseconds you need.

Thanks a lot!. Now i will work on SNMP… :smiley:

Prior to 7.x,

tx_thread_sleep(BSP_TICKS_PER_SECOND/4)

That will give you 250ms. It is abstracted, but the resolution is 10ms for tx_thread_sleep().

-Erik