pic to pic ir link versus wired link : help please anyone
i have connected two pic16f690 via one pin.
"sender" pic's pin rc5 is outputing a signal in pwm at 40 khz at a 30% duty cycle to "receiver" pic pin ra0.
the pic output on rc5 is connected to a bc182l npn transistor via a 4.7k resistor while the receiver pic pin ra0 is connected to the transistor collector lead. transistor emiter lead is connected to gnd which is common to both pics. the signal from emitter pic should bring the receiver pic pin to gnd and trigger an interrupt so it starts to read the pwm input.
The signal is:
on for 2400us
8 times: off for 600us, on for 600 us
off for 600us, on for 600 us
off for 600us, on for 1200us
off for 600us, on for 600 us
off for 600us, on for 600 us
off for 600us, on for 600 us
off for 600us, on for 600 us
off for 600us, on for 600 us
off for 600us, on for 600 us
this is a 'header' followed by two bits with bits sent msb to lsb:
0000000001000000
the receiving pic gets the signal on pin ra0 and it triggers an int but in the int handler, pulsin records values equal to 0!!!
If instead i attach an infrared led (Vishay tsal6100 at 940 nm) via the gate of an irld110pbf hexfet/mosfet at the output pin and use a Vishay tsop4840 ir receiver-demodulator at 40khz that pulls the receiver pic pin low when receiving an ir signal at 40khz, then it works! the receiver pic gets the interrupt, reads the signal and pulsin records the right duration.
How can it be?
Is it related to the way the transistor works? Sonething about the saturation or a lag?
i tried replacing the resistor+transistor with a hexfet but it does not work either!
I need to use a wired link between the pics, not an ir led and an ir receiver.
The code works because when using ir link (tsal6100-hexfet-tsop4840) the pic gets the signal. What's wrong with the transistor or hexfet?
Any ideas?
Pic to Pic one wire data transmission: success
Quote:
Originally Posted by
Darrel Taylor
It should work. But you probably need to invert it.
On the transmit side, where it would previously turn the HPWM ON, make the pin LOW instead.
For PWM OFF, set the pin HIGH, and forget the transistor.
Added: And make sure the CCP module is turned OFF.
<br>
Pure genious... Darrel, thank you. it works perfectly!
Hope this thread will help other.
Regards