Content originally posted in LPCWare by exgreyfox on Wed Aug 07 13:13:19 MST 2013
Quote: MikeSimmonds
It is very probably true that your micro can not interface in a bit bang fashion as you describe and the Fall Guy has demonstrated.
However, I would suggest interfacing your device's signal pin to TWO cpu pins! -- one input and one output with a loop back prevention diode between them.
The the poor design of the sensor is mitigated by treating the start and receive as two independant problems.
Set the output pin to a standard PWM -- 2 microsecs hi, 200 millisesc low (i.e. whatever you want the sampling interval to be).
Set the inpit pin for input capture to get a value proportional to the return pulse width -- that is precisely what it is designed to do.
For details, these forums have many posts both on PWM and on input capture; there is example code in the LPCXpresso setup and on this site also.
Regards, Mike
So basically interface the single sensor pin into two separate pins on the MCU by Y-splitting the sensor pin and adding a diode on the PWM signal output pin?