kristt2001
New Member
Hi all, i am using a PIC18f452 with the C18 compiler.
i am trying to interface this with a QTI line sensor.
when it is connected to the voltmeter, i see the voltages varying when it detects something.
however i am trying to set an LED when it detects this change.
// set i/o pins on PIC
TRISCbits.TRISC2 = 0; // W LineSnsrPwr ;output from PIC 17
TRISCbits.TRISC1 = 1; // R LineSnsrIn ;input to PIC 16
PORTCbits.RC2 = 1; // W send high to linesnsr power
Delay1KTCYx(5); //delay for 5ms
PORTCbits.RC2 = 0; // W send low to linesnsr power
if (PORTCbits.RC1==0){
TRISCbits.TRISC3 = 0;
PORTCbits.RC3 = 1; // LED2
}
LED 2 is supposed to light when the light is refracted. can anyone help me spot the problem??
i am trying to interface this with a QTI line sensor.
when it is connected to the voltmeter, i see the voltages varying when it detects something.
however i am trying to set an LED when it detects this change.
// set i/o pins on PIC
TRISCbits.TRISC2 = 0; // W LineSnsrPwr ;output from PIC 17
TRISCbits.TRISC1 = 1; // R LineSnsrIn ;input to PIC 16
PORTCbits.RC2 = 1; // W send high to linesnsr power
Delay1KTCYx(5); //delay for 5ms
PORTCbits.RC2 = 0; // W send low to linesnsr power
if (PORTCbits.RC1==0){
TRISCbits.TRISC3 = 0;
PORTCbits.RC3 = 1; // LED2
}
LED 2 is supposed to light when the light is refracted. can anyone help me spot the problem??