Dear Sir/Madam I configured my RTOS tick on 25us in order to read sensors fast. but in other hand i need to have for example 50 seconds delay in my program.So i use
void os_tmr_call(U16 ifo)
and
os_tmr_create(U16)
;U16 lenght is 65536 and as you know maximum delay is 65536 X 25us = 1.63 S if i will be able to use U32 in os_tmr_create problem will be solved but i can't. Also i don't want to stop program in a line.I mean i don't want to use for example
for(i=0;i<50;i++)os_dly_wait(40000);
and just want to use virtual timer or something like that.
Could you please tell me how can i increase delay time to 50 S or more base on 25us tick ?
Thank you for your ideas.They are very useful.I used mutex because i must to read 8 pins ic buffer for reading about 30 sensors and simultaneously i must to write about 40 outputs with these 8 pins buffer.timing is very important in this case so mutex guaranties access blocking to this I/O peripheral from another part of codes.
"timing is very important in this case so mutex guaranties access blocking to this I/O peripheral from another part of codes."
But the big question is: "should there be another part of the codes"?
It's common to write code like layers of an onion. So you have "kernel" code taking care of I/O. And then other code that makes use of this "driver layer". And at the top you have business logic that processes received data and produces new output data.
In a layered approach, you should see if you need more than one single function for accessing this group of signals.
A mutex implies that you need to synchronize between multiple OS tasks. But if all the signals needs to be accessed with critical timing it's very strange that you would let multiple tasks - that will obviously run at different timing - share the access to the signals.
Yes in this projects I have 10 tasks and one of them reads and writes I/O and i used mailbox for accessing data in this task between another tasks.but as i said before i configured Tick time on 25us and you advised i can do read the sensors in ISR and increase tick time around 1khz in order to increase delay time in os_tmr_create();
If only one task is using the IO, then you don't need any mutex - a mutex is only needed to synchronize access between multiple threads.
And a mutex can not be used to synchronize between an ISR and a tread, since the OS can't make the thread release the mutex if the ISR wants access.
Ok Thank you for your last answer.this is very important note.