Last active
February 23, 2019 04:50
-
-
Save rescurib/ead706ac38f0fbefe97df55ac4788c42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "config.h" | |
#include <xc.h> | |
//#define _XTAL_FREQ 48000000 | |
void init(){ | |
TRISBbits.TRISB0 = 0; // RB0 - salida | |
TRISDbits.TRISD0 = 1; // RD0 - entrada | |
ANSELDbits.ANSD0 = 0; // AN20 - desactivado | |
} | |
void main(void) { | |
init(); | |
while(1){ | |
if(PORTDbits.RD0 == 1) | |
LATBbits.LATB0 = 1; | |
else | |
LATBbits.LATB0 = 0; | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment