Name:
symbol
Syntax:

SYMBOL symbolname = value

SYMBOL symbolname = value ?? constant

Symbolname - is a text string which must begin with an alpha-character or '_'. After the first character, it can also contains number characters ('0'-'9').

Value - is a variable or constant which is being given an alternate symbolname.

?? - can be any supported mathematical function e.g. + - * / etc.

Description:

Assign a value to a new symbol name or create an alias for a variable name.

Mathematical operators can also be used on constants (not variables) Symbols are used to rename constants or variables to make them easier to remember during a program. Symbols have no effect on program length as they are converted back into 'numbers' before the download. Symbols can contain numeric characters, but must not start with a numeric character.

Naturally symbol names cannot be command names or reserved words such as input, step, etc. The list of reserved words is listed in the appendix in part 3 of the manual. When using input and output pin definitions take care to use the term 'pin0' not '0' when describing input variables to be used within if...then statements.

Applies To:
All
See Also:
Related Create:
    Share:
    Print:

    Use of symbols

    Use symbols instead of output, input and variable numbers

    Code Example:
    symbol RED_LED = B.7	; define a output pin
    symbol PUSH_SW = pinC.1	; define a input switch
    symbol DELAY = b0	; define a variable symbol
    
    	let DELAY = 200	; preload counter with 200
    
    main:	high RED_LED	; switch on output 7
    	pause DELAY	; wait 0.2 seconds
    	low RED_LED	; switch off output 7
    	pause DELAY	; wait 0.2 seconds
    	goto main	; loop back to start
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.