- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
This should be a very basic question, so forgive me. I'm trying to detect a voltage on a PSoC pin. It's either going to be 3V or 0V. The pin I am using is currently P0[0] and I have its drive set as Pull Down. I initialize the PRT0DR bit to 0, but I never read a high value when the voltage is 3V. Is there something that I am doing wrong?
Essentially I want the PSoC to read a high value when a voltage is applied and a low value when the pin is floating.
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How are you reading the pin? Are you using the PRT0DR register? Check out the below blog posts that may be of help.
PSoC GPIO Demystified - Part 1
PSoC GPIO Demystified - Part 2
Best Regards,
Ganesh
The PSoC Hacker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for responding!
Yes, I am trying to read the bit on PRT0DR. I am essentially doing this:
if (PRT0DR & X)
{
trueFlag = 1;
}
else
{
trueFlag = 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update -
I switched the Selected mode to High Z instead of Pull Down and now it works! Thank you for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are most welcome!! Glad to hear that you found the solution and got it working.
Best Regards,
Ganesh