┬ÁTasker Forum > FreescaleTM MC9S12NE64

Initialize Timer Port on power on


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: --- 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;

--- End code ---



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?




[0] Message Index

Go to full version