Jump to content

MIOS_Timer_Set Howto?


jmie

Recommended Posts

Hello,

I'm trying to periodicly call a function.The function itself is working well,

but I did not get it to be called perodically.

I'm not clear how to initialize the Timer with "MIOS_Timer_Set"

If using  MIOS_Timer_Set(1);  make results:

main.c:42: warning 112: function 'MIOS_Timer_Set' implicit declaration

main.c:42: error 101: too many parameters

How is the right syntax for MIOS_Timer_Set?

And is    void Init(void) __wparam {  MIOS_Timer_Set(1);  }    the right place to put it?

Thanks in advance

Juergen M.

Link to comment
Share on other sites

Hi Juergen,

the purpose of the parameters are described in the MIOS function overview (which unfortunately only comes with assembly examples, this will be changed sooner or later)

-> http://www.ucapps.de/mios_fun.html#MIOS_TIMER_Init

So, using small values is not recommented, because in this case the timer will propably more oftenly called then it could execute the appr. code.

I would say, that periods < 100 uS should be prevented, periods > 500 uS should be prefered if the execution of the main program should not be stalled that much.

An example for the timer usage can be found in the "analog box" application, here an excerpt:


  // initialize the timer - it should be invoked each mS
  MIOS_TIMER_Init(0, 10000); // 1 mS / 100 nS = 10000 cycles
[/code]

Yes, the timer should be initialized within Init(), but you are also allowed to change timer period from anywhere else if required (see clockbox -> dynamic adjustment of BPM)

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...