How on earth do I implement this?! - A PSOC 4 Conundrum.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello Ladies and Gents of the Cypress forums, I have come once again to beg you all for a slice of your genius.

Long story short I need to be able to use the same 8 pins to deal with various types of inputs (I'm using modular external hardware).
I.E; in one case the user may place a button or rotary encoder across the input, and in another case the user may place a potentiometer across the same pin.

What I want is a way to switch between using a pin as analogue and digital , whilst ideally keeping all of the pins on the same port.
The tricky part is that I need to have state transition interrupts triggered for those pins which are set to digital so that I may use rotary encoders in the design (the other leg is connected to a pin on a port which will always be digital.)

Is this even possible on the 049 kit?  WIll I just have to bite the bullet and use my precious remaining port to handle these two lines separately (at the cost of other functionality I had planned for the system.)

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Hi Jamie,

It is possible to switch a pin between analog and digital. The following AN may be a good reference for you. It introduces how to reuse the pin both for analog and digital in chapter 6.40.

AN86439 - PSoC 4 - Using GPIO Pins | Cypress Semiconductor

Regards,

Owen

View solution in original post

3 Replies
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Hi Jamie,

It is possible to switch a pin between analog and digital. The following AN may be a good reference for you. It introduces how to reuse the pin both for analog and digital in chapter 6.40.

AN86439 - PSoC 4 - Using GPIO Pins | Cypress Semiconductor

Regards,

Owen

Anonymous
Not applicable

Does this mean I can use digital interrupts on the same port as I have analogue reads happening without the analogue changes triggering the interrupt?

0 Likes

Do you use the same pin as an analogue input and digital interrupt? If you are doing so, you will need to switch the pin to digital first, then you can use digital interrupt.

0 Likes