Syntax:
SWAP( VariableA, VariableB)
Command Availability:
Available on all microcontrollers.
Support Bytes and Words only.
Explanation:
A function that swaps (or exchanges) one byte or word for another. SWAP supports the use of byte and word variables.
Example:
dim ByteA as Byte
dim ByteB as Byte
ByteA = 10
ByteB = 20
SWAP( ByteA, ByteB ) ' <<< the SWAP instruction
HSerPrint ByteA
HSerPrintCRLF
HSerPrint ByteB
HSerPrintCRLFKey line: SWAP( ByteA, ByteB ) — exchanges the values held in ByteA and ByteB, so after this line ByteA holds 20 and ByteB holds 10.
See Also:
- SWAP4 — related command in the same category
- Using Variables — related command in the same category

