C251 User's Guide

INTR2 Compiler Directive

Abbreviation

I2

Arguments

None.

Default

The C251 compiler assumes that an interrupt pushes 4 bytes onto the stack: a 24-bit return address and PSW1.

µVision

Options — C251 Compiler — Object — Save PSW1 in interrupt code.

Description

The INTR2 directive informs the C251 compiler that the 251 CPU saves the low order 16 bits of the program counter but does not automatically save PSW1 when entering an interrupt. When INTR2 is used, the C251 compiler generates code that manually saves and restores the PSW1 register in interrupt functions. You must use this directive if you want 8051 compatible behavior.

Example
C251 SAMPLE.C INTR2

#pragma i2