Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define BP1 PORTB.B1 // RB1 s'appel BP1
- #define BP2 PORTB.B2 // RB2 s'appel BP2
- #define LED1 PORTA.B0 // RA0 s'appel LED1
- #define LED2 PORTA.B1 // RA1 s'appel LED2
- void interrupt()
- {
- if (INTCON.INTF == 1)
- {
- if (BP1 == 1)
- {
- LED1 = 1;
- }
- if (BP2 == 1)
- {
- LED2 = 1;
- }
- else
- {
- LED1 = 0;
- LED2 = 0;
- }
- }
- }
- void main()
- {
- CMCON = 7; // comparateur desactivé
- PCON = 0x10; // OSCF a 4MHZ pour oscillateur interne
- INTCON = 0x90; // GIE , INTE actif
- OPTION_REG = 0xc0; // RBPU pull up désactivé , INTDG int rising
- PORTA = 0; // int full sortie
- PORTB = 0x01; // int RB0 entrée
- TRISA = 0; // int full 0V
- TRISB = 0; // int full 0V
- while(1)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement