Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: toamaVaca.c
- * Author: student
- *
- * Created on March 3, 2015, 4:53 PM
- */
- #include <p24ep256mc202.h>
- #include <stdlib.h>
- #include <stdio.h>
- unsigned long contor=0;
- unsigned long limita=0;
- void __attribute__((interrupt, no_auto_psv))_T2INterrupt(void)
- {
- IFS0bits.T2IF=0;
- contor++;
- }
- int main(int argc, char **argv)
- {
- TRISBbits.TRISB15=0;
- TMR2=0;
- PR2=35;
- T2CONbits.TCKPS=1;
- T2CONbits.TON=1;
- IPC1bits.T2IP=1;
- IFS0bits.T2IF=0;
- IEC0bits.T2IE=1;
- while(1)
- {
- if (contor>=limita)
- {
- limita+=1;
- LATBbits.LATB15^=1;
- }
- }
- return(EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement