lunes, 12 de marzo de 2018


Dr. Carlos Hernandez.

/*
This program configures the TIMER0 of the PIC182550 for a periodic interrupt.
/*


void interrupt() {

  PORTC.F0 = ~PORTC.F0;
  INTCON.TMR0IF=0; // clear the TIMER0 interrupt
  TMR0L = 100;
  T0CON.TMR0ON = 1;

}



void main() {

 PORTC = 0;
 LATC = 0;
 TRISC = 0x00;

 INTCON.GIE = 1;  // Global interrups enable

 INTCON.PEIE = 1;  // peripheri.
 INTCON.INT0IE = 0; // external interrup enable
 INTCON.TMR0IE = 1; // TIMER0  interrupt enable

 INTCON2.TMR0IP = 1; //TMR0 Overflow Interrupt Priority bit


 T0CON.T08BIT = 1; //8 bits TIMER0 configuration

 T0CON.T0CS = 0; //Timer0 Clock Source Select bit,
                 //0 = Internal instruction cycle clock (CLKO)
 T0CON.PSA = 0;  //0 = Timer0 prescaler is assigned.
                 // Timer0 clock input comes from prescaler output.
 T0CON.T0PS0 = 1; // Timer0 Prescaler Select bits
 T0CON.T0PS1 = 1; 
 T0CON.T0PS2 = 1; 

 TMR0L = 100;

 T0CON.TMR0ON = 1;   //start TMR0


while(1){


}


}











No hay comentarios.:

Publicar un comentario

BTFSS INSTRUCTION  IN ASSEMBLER FOR PIC18F In this sample, we show that how to use a switch input to make an action. Remember that I...