This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use timer T6 !?!

I have a problem by using the timer T6.I downloaded the apnt_115_p1 and included the timer-files to my current project.It worked - but only while I was debugging.When I tried to flash the hex-file, I lost all the functionality. When I tested the timersript whithout hardware (to understand how it realy works) it seemed to be easy: It produces periodic int.req.(in the way the timer is initialized) - But I don't understand why there is no jump into the ISR when a reguest is given ?!? Is there no int.ack.?!? (global interrupts are enabled!)
I think I have a problem by using and understanding interrupts :-). Please help me !

  • Which hardware did you use for testing?

    Also does your program run in the simulator?

  • Hi Chris,

    to use timer 6 interrupts you will need to ...
    - implement an interrupt function for timer 6.
    - set timer 6 interrupt priority and enable the interrupt.
    - enable all interrupts.
    - set timer 6 mode and start the timer.

    In C, it would look like this:

    void timer6_int (void) interrupt 0x26
    {
    /* do something ... */
    }

    void main (void)
    {
    T6IC = 0x44; /*T6IR=0, T6IE=1, T6ILVL=1, T6GLVL=0*/

    IEN = 1;

    T6CON = 0x47; /*T6R=1, T6M=0, T6I=7*/

    while (1);
    /* timer 6 interrupt should occur every 1.34s (with 25MHz CPU) */
    }

    The linker should generate an interrupt vector table entry for timer 6. You can verify this by looking in the linker output file *.m66 in the "memory map" section.
    Make sure that compiler and linker do not prompt warnings or errors.

  • In my project I use the PHYTECMO -EVALUATIONBOARD whith a c167crlm.
    For testing the timerfunctions I used only the simulator(no hardware).

  • Hello Holger,
    Thank U for the "to-do-list". It was really helpfull. I checked everything and uuups... I lost the code "IEN = 1" somewhere !!!
    It works now (in the simulator). Let's see if it works flashed, too (next days). Thanks a lot
    Chris