srf04 and pic
I built the SRFo4 unit as shown in the schematic from Devantech. I used a PIC12F508 rather than a 'C' device as my stockist only carries the 'F' version.
I changed the processor statement in the source code to reflect the 'F' device.
I am triggering the module from a 555-based oscillator - transistor inverted to give a 10uS high level, with about 50mS low period.
Scoping around the circuit shows pulses appearing on 7 and 14 of the MAX232, a good transmit signal, a decent amplified received signal, variable width pulses at pin 5 of the PIC (varying as an object is moved back and forth in front of the transducers), but the is nothing out of pin 6 of the PIC.
The -10V supply is being generated correctly.
Pin 6 remains at a low level.
The PCB has been checked countless times and is 100% correct.
I do not know what I could have done wrong.
I have tried two PICs - the chances of both being identically faulty would be remote.
Has anyone else tried building their own SRF04 units, and did they work?
Can anyone shed some light on the subject?
Added after 2 hours 6 minutes:
Looks like a software problem.....
In the source code supplied by Devantech, there ar two ECHO routines. The default is a transistion detection on the echo line.
The other is a bit more sophisticated - it looks for 3 cycles of 40kHz to give a valid output.
I commented out the default, uncommented the 3-cycle detect routine, reassembled, burnt the PIC and all seems OK, there are pulses appearing at the ECHO pin. They don't seem to vary, but I'll check more deeply a bit later.
I'll look into the code in more depth when I have some time and try to determine why the default routine doesn't function correctly.