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

Timer (Zeitgeber) for Port inverting (blink) XC888/886

this is my programm. why is it not working?
#include <XC888CLM.h>
#include <stdio.h>

Timer 1 Interrupt Service Routine.

void timer1_ISR (void) interrupt 3
{ while (TF1==0);
TR1=0;
P3_DATA=!P3_DATA; // Invertieren von P3 }

//MAIN C function

void main (void)
{ SFR_PAGE(_pp0, noSST); // Change to page 0
P3_DIR=0XFF;
P3_DATA=0Xff;

TMOD = 0x02; /* Set Mode (8-bit timer with reload) */
TH1 = 5;
TL1 = 0;
ET1 = 1; /* Enable Timer 1 Interrupts */
TR1 = 1; /* Start Timer 1 Running */
EA = 1; /* Global Interrupt Enable */
TF1=0;
CMCON = 12;

while (1) { }
}

Parents
  • sorry I forgot to explain what the programm is supposed to do.
    i want to use the timer 1 in modus 2 (Autoreload) to synxchronise the on-off process of the leds of port3.
    after each overflow, the leds should change their state.

    when in compile and run, i get 0 warnings, 0 errors, but Port 3 goes one time on and off, and nothing else .

    i am using the mcbxc888 eval. board with ulink.

    thanks

Reply
  • sorry I forgot to explain what the programm is supposed to do.
    i want to use the timer 1 in modus 2 (Autoreload) to synxchronise the on-off process of the leds of port3.
    after each overflow, the leds should change their state.

    when in compile and run, i get 0 warnings, 0 errors, but Port 3 goes one time on and off, and nothing else .

    i am using the mcbxc888 eval. board with ulink.

    thanks

Children
No data