GET_xxxx - Get the associated PORTx/LATx/TRISx/WPUx

Language reference ›› Built-in functions ›› Conditional compilation ››
Parent Previous Next

get_port-function = GET_PORT "(" identifier ")" .
get_lat-function = GET_LAT "(" identifier ")" .
get_tris-function = GET_TRIS "(" identifier ")" .
get_wpu-function = GET_WPU "(" identifier ")" .

NEW! (V2.0): Returns the associated PORT/LAT/TRIS/WPU of the argument.


<Identifier> may refer to any declared identifier or literal string that refers to a PORTx, LATx, TRISx, WPUx whole 8-bit or a particular bit.


These functions are compilation-time functions for alias specification in variable declaration blocks.


For small devices returned values are GPIO/TRISIO.


If the processor does not have LATx registers, GET_LAT() returns the same result as GET_PORT(), so it is legal to use GET_LAT() for any processor.


Useful for conditional compilation with passed $DEFINE values.



{$DEFINE PORT_TO_USE 'LATA'}

VAR
 CTRL_IN_PORT: BYTE @ GET_PORT(DEFINED_VALUE(PORT_TO_USE)); // Assigns to PORTA
 CTRL_IN_PORT_BUSY: Boolean @ GET_PORT(DEFINED_VALUE(PORT_TO_USE)).2; // Assigns to PORTA.2
 CTRL_IN_PORT_OTHER: Boolean @ PORTB.4;
 CTRL_IN_PORT_OTHER_TRIS: Boolean @ GET_TRIS(CTRL_IN_PORT_OTHER); // Assigns to TRISB.4



See also:  DEFINED, DEFINED_VALUE.