Author Topic: Initialize Timer Port on power on  (Read 12561 times)

Offline Marco

  • Newbie
  • *
  • Posts: 21
    • View Profile
Initialize Timer Port on power on
« on: October 09, 2009, 05:25:40 PM »
Hi, Mark

I am trying to control a RC servo, I know it works but when i turn on the power the servo times out before the timer port is initialized.

Can you please tell me if I can initialize the timerport imediately on power up.  Initializing it in my task takes to long.

Code: [Select]
TSCR1 = 0x80;   //10000000 (Turn on the Timer port)
      TSCR2 = 0x03;   //00000011 (Set Prescale to 8)
      TIOS = 0xF0;    //11110000 (set all channels to output compare)
      TTOV = 0xF0;    //11110000 (enable Toggle output on overflow)
      TCTL1 = 0xAA;   //11111111 (OutputModeX, OutputLevelX) 0x55;//0xAA; //0xFF;



Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3237
    • View Profile
    • uTasker
Re: Initialize Timer Port on power on
« Reply #1 on: October 11, 2009, 08:33:56 PM »
Hi Marco

The routine fnUserHWInit() (in application.c) is called almost immediately once the board is ready to run. This is the best place to add any application specific initialisation which need to be performed very quickly.

Note that a task without a start delay should also start very quickly (not much slower than fnUserHWInit()) - are you sure that your task is not being delayed?