roberto.s
Newbie level 6
Hi,
I have e stupid problem, but I can't find the solution,
this is the program:
#include <p18f2520.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config PBADEN = OFF
void main (void){
// Imposto PORTA tutti ingressi
LATA = 0x00;
TRISA = 0b11111111;
// Imposto PORTB tutti ingressi
LATB = 0x00;
TRISB = 0x00;
// Imposto PORTC tutti ingressi
LATC = 0x00;
TRISC = 0xFF;
for (;{
if (PORTAbits.RA2 == 0){
PORTBbits.RB2 = 1;
}else{
PORTBbits.RB2 = 0;
}
}
}
easy??? yes, but why the led is always on???
I can explain....
can someone else???
may be a problem of setting?
in the circuit I have a pull-up on the input and nothing else.......
I have e stupid problem, but I can't find the solution,
this is the program:
#include <p18f2520.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config PBADEN = OFF
void main (void){
// Imposto PORTA tutti ingressi
LATA = 0x00;
TRISA = 0b11111111;
// Imposto PORTB tutti ingressi
LATB = 0x00;
TRISB = 0x00;
// Imposto PORTC tutti ingressi
LATC = 0x00;
TRISC = 0xFF;
for (;{
if (PORTAbits.RA2 == 0){
PORTBbits.RB2 = 1;
}else{
PORTBbits.RB2 = 0;
}
}
}
easy??? yes, but why the led is always on???
I can explain....
can someone else???
may be a problem of setting?
in the circuit I have a pull-up on the input and nothing else.......