Rich (BB code):
#define XTAL_FREQ 20MHZ
#define _LEGACY_HEADERS
#include <htc.h>
__CONFIG(0X3F32);
void main(void)
{
ADCON1= 7;
TRISB = 0x00001111;
while(1){
RB0 = 1;
RB1 = 1;
RB2 = 1;
RB3 = 1;
if(RB4==1){
RB0=0;
}
if(RB5==1){
RB1=0;
}
if(RB6==1){
RB2==0;
}
if(RB7==1){
RB3==0;
}
}
}
Then if i input wire 5V (from Vcc) to RB4 - RB7 (inputs), i want to turn off the LED. Why wouldn't it work?
and somehow the LED at RB0 doesn't light up, but the other three does.
Last edited by a moderator: