DEFINED_VALUE - Retrieve the value asserted to a defined identifier

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

defined-value-function = DEFINED_VALUE "(" conditional-identifier ")" .

This function returns the value assigned in the last $DEFINE of <conditional-identifier>.


If there's no value a compilation error occurs.

The value may be numeric (integer scalar only) or string.


{$DEFINE BAUD_RATE 9600}
{$DEFINE PORT_TO_USE 'PORTA'}
 …
CONST
 Bit_Delay_us = 1000000 DIV Defined_Value(BAUD_RATE); // Value is 1000000 div 9600

VAR
 IO_Bit: BOOLEAN @ Defined_Value(PORT_TO_USE).0; // I/O on PORTA.0


See also: DEFINED, DECLARED.