SFRs in 8051

There are a total of 21 SFRs in 8051, out of which few SFRs are already discussed in previous tutorials and remaining would be covered in upcoming tutorials. 

SFRs in 8051

There are 111 instructions in 8051,

For eg : MOV A, P0

This is assembly language which is converted into opcode, so one instruction for one SFR requires one opcode. But 8051 is limited to 256 opcodes.

So all the SFRs are allocated with some address. In the internal RAM, we have used only 128 addresses out of 256, so those addresses can be allotted to these SFRs. Refer architecture tutorial for more info.

If SFRs of 8051 are allotted with some address, there can be a general opcode for each instruction.

MOV A, 143 ( 143 is address ), there is some code which moves data from X address to A target. In this huge numbers of opcodes can be decreased. 

There are also few bit operational SFRs , such as P0 has 8 bits which is bit addressable, so these bits will also be allotted with some addresses. In the structure of internal RAM we have left our 2nd part ( bit addressable ) upto 7F bit address only, we were left out with 128 more bit addresses. S0 these bits ( P0.0, P0.1 …… P3.7 [ all 32 ] ) are allotted with bit addresses from 7F. Refer memory organization for more details about this.

SETB P0.0 { however we write code in this way only, but in 8051 P0.0 means data of xxx address }

In the upcoming tutorial we would learn about 8051 addressing modes.

Spread knowledge

Leave a Comment

Your email address will not be published. Required fields are marked *