cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

Anonymous
Not applicable

I am trying to do something with an Encore V MCU (7C64343). The problem I am facing has been described many times yet I have been unable to make it work for me at this stage:
On port 1 I have a few digital inputs and one output controlled by an interrupt function.
My problem is that I can never read the actual status of the inputs, they are always 0.
What I am doing is this:

   

The relevant bits P1.2, P1.3 and P1.4 are configured as StdCPUInput and drive Analog High Z in the PD

unsigned char P1;

and then in the interrupt function (executed around 100 times per second):

P1=PRT1DR; // supposedly reads the actual input states
P1^=0x20; // swinging the output pin
PRT1DR=P1; // update the output

Everywhere else in the code I only use P1 as read from the code above.
Where is my problem here?

Thanks!

0 Likes
3 Replies
Anonymous
Not applicable

If you are using P1 as a shadow register, then you should not be updating it with the PRT1DR value.  You should only write values that you need to reflect on your output pins and then update the PRT1DR with P1 value.

   

Check out the below Blog article that explains the concept of shadow register.

   

PSoC 1 GPIO Demystified - Part 2

   

Best Regards, Ganesh

0 Likes
Anonymous
Not applicable

"Analog hi Z" is not the correct drive state for digital inputs. In order to be digital inputs, they need to be configured as "hi Z". "analog hi Z" drive turns off the digital input schmitt trigger.

0 Likes
Anonymous
Not applicable

Thank you both for the responses. Problem solved.

0 Likes