TRIS - Setup processor's TRIS register

Language reference ›› Built-in procedures ›› Implied PIC statements ››
Parent Previous Next

TRIS(port, mask-expression)

Usually PMP does not have special instructions to manipulate registers; to access to the I/O direction registers the TRISx registers should be directly assigned.

Unfortunately, some old and / or BASELINE devices do not have memory-mapped TRISx registers, but a special instruction TRIS that is a write-only instruction.

The TRIS built-in procedure will automatically map into a TRISx register assignment if such a register exists or into a TRIS instruction otherwise.

As said above, the processor's TRIS instruction is write-only: the value cannot be read back, so it should be saved in a global variable if you want to manipulate / mask individual bits.


<port>:

An existing I/O port (PORTA, …),


<mask-expression>:

A numeric expression that gives a BYTE range.