Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Not applicable
I am working on AVNET SPARTAN 3A Evaluation KIT.   
I just used a 26bit counter code in the FPGA and   
I send the MS 3 bits of the counter to the PSoC.   
In the PSoC , I just forward the input signal to   
the output port.   
The input pins of teh PSoC are P2(5), P2(7) and   
P4(6) which are connected with the FPGA I/Os.   
The output pins of the PSoC are P0(1), P0(3)   
and p0(5) , which are connected with the   
connector J9.   
I am noticing the counter signal at the input   
of the PSoC, But not at the Output pins.   
I have given the PSoC main.c code below.   
If it is required I can give the VHDL code also.   
Please help me, to find out the problem   
with my code.   
Thank You.   
Project :   
// This project echos the state of port 2 pin 5 to port0 pin 5   
// This project echos the state of port 2 pin 7 to port0 pin 3   
// This project echos the state of port 4 pin 6 to port0 pin 1   
// The status of output ports follow the status of their respective input ports.   
#include <m8c.h> // part specific constants and macros   
#include "PSoCAPI.h" // PSoC API definitions for all User Modules   
void main()   
while (1) {   
if (PRT2DR & 0x20) {   
PRT0DR |= 0x20;   
if (PRT2DR & 0x80) {   
PRT0DR |= 0x08;   
2 Replies
Not applicable

I think that you are not checking the input port value properly. Try the following code instead:


if ((PRT2DR &= 0x20) > 0)




// put the bit toggling code here.



New Contributor



In PSoC Designer, first confirm that your inputs are set to "HIGH Z", not "HIGH_Z Analog".


Next, check that the output pins are set as outputs, eg, "Strong Slow".


Then to read  the inputs use


while (1)
   if (PRT2DR & 0x20)        //if pin P2.5 is set
      PRT0DR |= 0x20;         // set pin P0.5
      PRT0DR &= ~0x20;         // clear pin P0.5


This should get you started. For more on GPIO see the following url: