- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
I'm trying to turn the the ports of my psoc device by reading from an input from a raspberry pi 2 on port 3 , Ive configured all port drives to be in strong mode
if (PRT3DR & 0x0f ) // if high input from outside
{
PRT5DR=0xff;
PRT1DR=0xff;
}
else if (PRT3DR & 0x00 )// if low input
{
PRT5DR=0x00;
PRT1DR=0x00;
}
Is this correct ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The line below looks not good, as anything make an "&" with 0x00, the result will be 0.
"else if (PRT3DR & 0x00 )// if low input"
AN2094 - PSoC® 1 - Getting Started with GPIO is a good reference for how to use PSoC1 GPIO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are reading from Raspberry Pi, and using GPIOs configured as strong drive, you are connecting two outputs together. This may cause either one or both of the GPIOs to fail, if they output opposite logic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sir, So how should I configure the the GPIOs for my project as High? or some other way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sir, this is what I need to implement On the transmitter side i will send either 4 or 6 packets depending whether port 3 is receiving 5v or 0v from the raspberry pi. And depending on this on receiver side i will turn my Leds On or OFF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will have to configure the GPIO as High Z Analog.
If you have the input at Port 3, bit 0, use the following code
if (PRT3DR & 0x01)
{
MAX_TX_PACKETS = 4;
}
else
{
MAX_TX_PACKETS = 6;
}
If you have the input at Port 3 bit 4 the if condition would be
PRT3DR & 0x10