Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC18f452 simple LEd problem

Status
Not open for further replies.

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??
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top