i therfore, bounce the IR signal off a wall for example, then it is recieved at the receiever.
As far as I remember, Infrared travels from transmitter to receiver by direct line of sight. you make no sense to me UNLESS your wall has a large mirror on it and the signal bounces off of that.
The normal LED which is circled in green, lights up when pin 2 is low, this is because pin 2 is low, but the other end is 12V, therefore current flows and the LED lights up.
Here is my theory. A LED has an anode and a cathode pin. You wired the LED in an inverted configuration. Data will then be fed to the cathode.
If the data is set to a logic low, the LED will light up. Think of a logic low as -ve, and a logic high as +ve.
The LED always lights when the anode is connected to +ve and cathode is connected to -ve. and please make sure a resistor is in series with the LED, and it is high enough (I suggest at least 1K ohms) or the circuit may fail.
When pin2 gives out a high, i.e 12V, because the other end is 12V and ther is no potential difference, no current flows, therefore, the LED doesnt light up.
I agree. Its basically the same as connecting the anode and cathode together.
Now, when i dont connect Pin2...... i.e the wires D0 and D1 to the PIC, this circuit works PERFECTLY. When nothing is detected, Pin 2 gives out a HIGH and the LED isnt on.. and if it detects something, Pin2 goes low and the LED comes on.
The problem..... As SOON as i connect D0 and D1 to the PIC, or emulation board the problem starts.
Have you tried using more pins?
Instead of using just one as bidirectional (input and output), why not use one pin strictly for input, and another pin strictly for output?
If you are running out of pins, you can add a latch or a flip-flop IC to existing pins and update your code. The IC will store information for you, so that anytime you need it, it is there.
And another thing. you might want to add a pull-down resistor (about 10K) at the PIC ports you use. This will define a logic level of "0" (light on) should the PIC be unable to produce an output at any given port.
With my LCD to 8051 interface, I had to tie the LCD's EN line to a 2.7K pull-down resistor, just to get the LCD to work.