You are here

GPIO Analog - Digital Pins advice | Cypress Semiconductor

GPIO Analog - Digital Pins advice

Summary: 3 Replies, Latest post by Rigyu on 23 Apr 2016 01:30 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
user_151510080's picture
7 posts


I'm trying to read some sensors[QTR-8RC -] and then i got on and dead end...

Need some advice, the sensors need a 10us pulse for charging some capacitance, and the we read the cap discharge. I generate the pulses with a PWM and i can see the waveforms on an oscilloscope and they display correctly but only if i put the pin on "Open drain, drives high" 

Then I try to get the cap discharge signal to a comparator to get a pulse width proportional to sensor measurement.

Well.. after days of reading, i think i need another "pin driving" so i can "read" the signal with the comparator.

Came here to seek some advice, or if i can get another way of achieve the measurement of this sensors.


Thank you, and sorry to bother you!

user_1377889's picture
9293 posts

No bothering. I would suggest you to do something with an output enable signal which will pit your cap loading into Hi-Z when sensing. OE is a property of the pin and you can feed it using your PWM signals.




user_151510080's picture
7 posts

I tried with something similar, but if i change the pin configuration to Hi-Z the cap don't discharges... basically I need to read this "time of discharge" but i can only discharge it if its in "open drain" configuration. Maybe i'm messed up... any form to read this cap discharge and pulse it? have tried bidirectional pins... enabling digital input and digital output of one pin.. but not success.

user_151510080's picture
7 posts

Still going on with this problem... have to do this.

The procedure for using them is:
1. Make the I/O an ouput
2. Allow at least 10 us for the 10 nF capacitor to charge
3. Make the I/O an input
4. Measure the time for the capacitor to discharge by waiting for the I/O line to go low

I'm usign PSoC 5LP Kit CY8CKIT-059. I'll try to change the gpio on firmware like..

1. Strong drive output <- PWM 10us ton

2. High Z Dig <- Timer

I think it's the way to do it... but not sure.

Log in to post new comments.