PSoC 3 Timer Interrupt for ultrasonic sensor | Cypress Semiconductor
PSoC 3 Timer Interrupt for ultrasonic sensor
I've built a circuit which transmits and recieves ultrasonic waves. It has an input (controlling the tx - normally pulsed at 40kHz), and an output (logic high or low - if reflected pulse detected).
I am driving the tx from a PWM(1) at 40kHz, I am then controlling the on time of PWM(1) with a second PWM(2).
ie, PWM(1) is outputting 40kHz for 0.5ms and is off for 64.5ms.
Now, I would like to time the time taken for the reflected signal to occur. I've thought about using an interupt and then reading the PWM value and converting it into a time, or using a timer.
Please could you point me in the right direction, as I am unsure wheather this is best treated in software or hardware (trigger and capture pins on the timers/pwms).