Page 1 of 1

A pin on which port?

PostPosted: Thu Nov 09, 2017 9:09 am
by Coccoliso
Hi,

I would like to know if there is a macro or a way of knowing on which port is a given pin in order to exclude code at compilation level.

Re: A pin on which port?

PostPosted: Sun Nov 12, 2017 12:35 pm
by David John Barker
I'm not quite sure what you mean - could you give some pseudo code of what you mean...

Re: A pin on which port?

PostPosted: Sun Nov 12, 2017 1:33 pm
by Coccoliso
Hi David,

I need something that if I pass #option MYPORT = PORTB.0 let me know that we are on PORTB and I use pin 1.
This is because in my module port and bits should end in two different constants otherwise use #if #elseif #else #endif.

Re: A pin on which port?

PostPosted: Sun Nov 12, 2017 1:47 pm
by David John Barker
If you are wanting to know a port bit at runtime, you have to use BitOf(). If at compile time, then maybe you have to use #if#else etc or in[0..x].