Naming Pins for flexibility

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

cross mob
SuSc_283911
Level 1
Level 1
5 replies posted 5 questions asked First reply posted

I'm trying to find MORE information on the use of naming pins in PSoC1.  I've read (& reread) both GPIO Demystified posts as well as AN 2094 - Getting Started with GPIO.

   

From what I've gathered, if I name a pin (say PB), then I can access the PORT by typing LED_1_Data_ADDR.  How do I access just the PIN then to determine if it's high or low? 

   

Right now, if "PB" is at port 1, pin 7, I read that pin by using PRT1DR & 0x80.  What would I do if I want to use the name only? 

   

AN 2094 says there's a macro for the pin mask, but doesn't give the command.  Where should I look for more information so I can figure this out?

   

Thanks!

0 Likes
3 Replies
Anonymous
Not applicable
        For one example, you want turn on LED so you can write [ LED_Data_ADDR |= LED_MASK; ] These definitions are there in PSoCGPIOINT.h of Lib/Lib_Header. OK?   
0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Also be aware of the need to use shadow registers on ports with mixed

   

I/O in them.

   

 

   

      www.planetpsoc.com/psoc1-articles-digital/13-basics-of-psoc-gpio.html

   

 

   

www.cypress.com/

   

 

   

Regards, Dana.

0 Likes
SuSc_283911
Level 1
Level 1
5 replies posted 5 questions asked First reply posted

Hi - and thanks to both of you.

   

I actually looked in the PSoCGPIOINT.h file and found the answer to my question, so you've just confirmed that I interpreted the info in the file correctly.  Of course, my working project also convinced me.  I can now move that pesky push button switch to  wherever there's a free pin on a port and not have to keep editing my switch function! I need the pin mask is so that I can use shadow registers flexibly.

   

Thanks again!

0 Likes