domingo, 20 de marzo de 2016

COPYPASTE (p24fj128ga010)

Configuración de timer 2y3 para formar timer de 32-bits, más interrupción:

  1. #include <p24fj128ga010.h>
  2.  
  3. _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & COE_OFF & ICS_PGx2 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR128 & WDTPS_PS32768);
  4. _CONFIG2( FNOSC_PRI & FCKSM_CSDCMD & POSCMOD_HS );
  5.  
  6. /*#define FCY 20000000UL
  7. #include <libpic30.h>*/
  8.  
  9. #include <timer.h>
  10. /* ***************************************************************** */
  11. void __attribute__((__interrupt__, __shadow__)) _T3Interrupt(void){
  12.                
  13.         LATDbits.LATD8=~LATDbits.LATD8; // Cambiamos de estado pin F2.-
  14.         _T3IF = 0; //Borramos flag.
  15. }
  16.  
  17.  
  18. int main (int argc, char * argv[]){
  19.        
  20.        
  21.         TRISD=0xF0FF;
  22.        
  23.         OpenTimer23(T23_ON & T2_IDLE_STOP & T2_GATE_OFF & T2_PS_1_1 & T2_SOURCE_INT,0x004C4B40);
  24.  
  25.         ConfigIntTimer23(T3_INT_PRIOR_1 &  T3_INT_ON);
  26.  
  27.         WriteTimer23(0x00);
  28.        
  29.         while(1){
  30.         }
  31.  
  32. }

No hay comentarios:

Publicar un comentario