Hi, guys.
I just started working with operating systems. And MQX is my first one.
Recently I learned to do some simple things with the help of examples and application notes. It's an exciting process ![]()
And I have one question. What is the best way to organaize regular execution of task every 1 ms (its execution time is about 150us)? I tried to do that in such way:
if (_timer_create_component(7, 1500) != MQX_OK) printf ("  Timer initializing error\n");else printf(" Timer initialize\n");_time_init_ticks(&ticks, 0);_time_add_msec_to_ticks(&ticks, 1);//_time_add_sec_to_ticks(icks, 1);SPI_timer = _timer_start_periodic_at_ticks(led_driver_task, 0, TIMER_ELAPSED_TIME_MODE, &ticks, &ticks);It's work fine only when i use the seconds/(hundreds of ms) as a period. ![]()
And in such way:
task(){  while(1){    my_function(&trans_matrix[0][0][0]);    _time_delay(1);  }}How would you have done this in my place?
Regards, Rasul
P.S. How is my English? 
 Is it too many mistakes here?
解決済! 解決策の投稿を見る。
Hi again!
My problem was solved by following change in the MQX source code:
uint_32 _mcf51CN_timer_init_freq (........){  ............  // calculating prescale and rate  ............  /* set registers */  /* mtim_ptr->MTIMCLK = ((uint_8) prescale);   mtim_ptr->MTIMMOD = (uint_8) rate - 1;   mtim_ptr->MTIMSC = MCF51XX_MTIMSC_TRST_MASK | (unmask_timer ? MCF51XX_MTIMSC_TOIE_MASK : 0); */  mtim_ptr->MTIMCLK = 0x07;       // this value and value below are manualy calculated with process expert  mtim_ptr->MTIMMOD = 0xF3;   mtim_ptr->MTIMSC = MCF51XX_MTIMSC_TRST_MASK | (unmask_timer ? MCF51XX_MTIMSC_TOIE_MASK : 0);}My project is already finished, and it works fine. ![]()
But I noticed that some timer functions like _time_delay() didn't worked properly. Generated time durations was changed. This is not a critical issue for my project.
And I understand that this is because of my change of MQX source code.
So my question: Can this change cause any other problems except described above?
Any answer would be greatly appreciated!!
MQX 3.6 was used.
Regards.
I did it.
Using ISR from second timer MTIM2.
I think it is a best decision.