How many 16bit registers are there in 8051?
When I searched for it, I got most of the answers as 2(DPTR AND PC). But 8051 has 2 16bit timers also so the number of 16bit registers should be 4 right?
Some say that timers cannot be considered since they are divided into two 8bit registers. But the DPTR is also divided into two.
There are multiple 16 bit registers in a standard 8051, most of them are accessible by 8 bit halves, too:
The PC cannot be accessed like other registers. You change it in software by means of jump, call, and return instructions. Of course the hardware change it by means of reset and interrupts, too.
The DPTR can be changed by
MOV DPTR,#dataandINC DPTR, or by accessing any of its halves.The registers of timer 0 and 1, respectively, are only used in some cases as 16 bit registers, for example in timer mode 1. However, there are no instructions to access them as 16 bit registers.
The accumulator and register B form a 16 bit register with the instruction
MUL AB, which stores the 16 bit result of its 8 by 8 multiplication. At least one can look at them like this. ;-)Final line: It depends on the definition of "register" to count the 16 bit ones. Personally, I would count them all, so there are 5 for me. Others might say, only accessibility in 16 bit counts, then there are only 2. Then one might say, only mapped in the SFR memory segment counts, then the PC is out.
Anyway, the actual count is not important. Your understanding of the microcontroller and its working is important.
Note: The 8052 has timer 2, additionally, with TH2/TL2 and RCAP2H/RCAP2L. And other derivatives have even more registers.