cancel
Showing results for 
Search instead for 
Did you mean: 

How to record time stamps in SPC5 code

Basavanagouda1
Associate II

Hi All,

I need to record time stamps in the code, how i can do it? is there any example code is available?

Thanks,

Basava.

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
Angelo Castello
Associate III

Hello,

First of all, sorry for the delay.

In case you are using the latest SPC5Studio tool version you can record the timestamp using the OSAL API's like these piece of code.

result_t wait_for(uint16_t mdelay) {

uint32_t btime = osalThreadGetMilliseconds();

// 0xffff is a infinite wait.

while (is_active() == 0x0) {

if (mdelay < (osalThreadGetMilliseconds() - btime)) {

if (mdelay != 0xffff)

return TIMEOUT;

}

}

return NO_ERROR;

}

Hoping this is useful for you.

Regards,

Angelo

View solution in original post

1 REPLY 1
Angelo Castello
Associate III

Hello,

First of all, sorry for the delay.

In case you are using the latest SPC5Studio tool version you can record the timestamp using the OSAL API's like these piece of code.

result_t wait_for(uint16_t mdelay) {

uint32_t btime = osalThreadGetMilliseconds();

// 0xffff is a infinite wait.

while (is_active() == 0x0) {

if (mdelay < (osalThreadGetMilliseconds() - btime)) {

if (mdelay != 0xffff)

return TIMEOUT;

}

}

return NO_ERROR;

}

Hoping this is useful for you.

Regards,

Angelo