accessing SFR

I am writing a program in C using Arduino IDE.
I want to access PCON register to check if bit 4 is high or low.
How can I access the internal SFR registers of CPU ?
Please guide, may be I need to include some Library.

Which microprocessor ?

Indeed! I can’t find a register called “PCON” on ANY of the popular Arduino microcontrollers!

In general, most SFRs are defined as global symbols in all caps, so something like:

   if (PCON & (1<<4)) {
     // do something if pcon bit 4 is set
   }

Would be sufficient. ARM chips tend to define deeper data structures:

    if (RTC.MODE0.PCON.reg & (1<<4))

Many Thanks to those who replied.
I am sorry for not clarifying which CPU I am using.
Here are the details.
I am working on Arduino Mega board using Mega 2560 chip.
In my earlier days of programming I was working on Atmel devices, PCON SFR register bit 4 holds the information if power had failed or device was manually reset.
I assumed same register name will work here as well.I am sorry for mistake.
Let me check the SFR details and how to differentiate between a power failure and manual reset in Mega 2560.
Any help in this regard is highly appreciated please.

PCON SFR register bit 4 holds the information if power had failed or device was manually reset.

Ah. On AVRs, there is the “MCU Status Register”, “MCUSR”:

Bit 3 – WDRF: Watchdog System Reset Flag
This bit is set if a Watchdog System Reset occurs. The bit is reset by a Power-on Reset, or by writing a logic zero to the flag.
Bit 2 – BORF: Brown-out Reset Flag
This bit is set if a Brown-out Reset occurs. The bit is reset by a Power-on Reset, or by writing a logic zero to the flag.
Bit 1 – EXTRF: External Reset Flag
This bit is set if an External Reset occurs. The bit is reset by a Power-on Reset, or by writing a logic zero to the flag.
Bit 0 – PORF: Power-on Reset Flag
This bit is set if a Power-on Reset occurs. The bit is reset only by writing a logic zero to the flag.

Unfortunately, this generally can’t be used on Arduinos because it’s sort of a read-once register, and the bootloader interferes with its value by the time the user’s sketch starts. There are some hacks that MIGHT let you get at some of the information, and they’re bootloader-dependent.

“PCON” was present on (some of?) Atmel’s older 8051 processors like the AT89C51. An entirely different architecture than the AVRs used on Arduinos.

power failure and manual reset.

We have the following situations with regards to the Reset event of ATmega328 Processor (CPU/MPU/MCU) chip:

1. Power-up Reset or Cold Reset
There is no power in the board. We have applied power in the board. The CPU receives a reset-signal at its RST/-pin from an external RC-based reset-circuit. This event is known as Power-up Reset or Cold Reset. In Fig-1, we observe that the EXTRF flag of MCUSR Register is affected by external power-up reset signal.


Figure-1: External reset circuit for ATmega328 in Arduino UNO Board

There are reported cases where the CPU did not come up by power-up reset signal. In this case, we press the Reset Button to inject a reset-signal at the RST/-pin. Is it Power-up Reset or Cold Reset or Manual reset? I have no clear answer.

The ATmega328 has dedicated its Pin-1 to receive external power-up/manual Reset signal; however, this pin can be configured not to receive power-up reset signal but to work as IO port or pin-change-interrupt (Fig-2). Under this condition, the MCU receives power-up reset signal from its internal reset circuit explained below in Fig-2 where we observe that the PORF flag of MCUSR Register is affected by internal power-on reset signal.


Figure-2: Internal reset circuit for ATmega328

2. Hot Reset or Manual Reset
The Microcontroller Board has already started up at the very first Power-up reset-signal. We have been working with it; in the meantime, we have pressed/released the manual Reset Button. This is a Hot Reset or Manual Reset.

**The old 8085 Microprocessor could recognize if the reset was a Hot Reset.