how does program counter make for 8051 controller
I know how does program counter work but I don't understand how they make ?
Look the following example
· When the 8051 is powered up, the PC (program counter) has 0000 and starts
to fetch the first opcode from location 0000 of the program ROM. In the case
of the above program the first opcode is 7D, which is the code for moving an
operand to R5. Upon executing the opcode, the CPU fetches the value 25 and
places it in R5. Now one instruction is finished. Then the program counter is
incremented to point to 0002 (PC = 0002), which contains opcode 7F, the
opcode for the instruction “MOV R7 , . .”.
· Upon executing the opcode 7F, the value 34H is moved into R7. Then the program counter is incremented to 0004.
· ROM location 0004 has the opcode for the instruction “MOV A, #0″. This
instruction is executed and now PC = 0006. all the above instruc
tions are 2-byte instructions; that is, each one takes two memory locations.
· Now PC = 0006 points to the next instruction, which is “ADD A, R5″. This is
a 1-byte instruction. After the execution of this instruction, PC = 0007.
· The location 0007 has the opcode 2F, which belongs to the instruction “ADD
A,R7″. This also is a 1-byte instruction. Upon execution of this instruction,
PC is incremented to 0008. This process goes on until all the instructions are
fetched and executed.
the program counter points at the next
instruction to be executed
I think input should be reset , clock, opcode ,accumulator, ram memory
what will be input and output for program counter?
I know how does program counter work but I don't understand how they make ?
Look the following example
Code:
Machine language binary language
1 0000 ORG 0H
2 0000 7D25 MOV R5,#25H
3 0002 7F34 MOV R7#34H
4 0004 7400 MOV A,#0
5 0006 2D ADD A,R5
6 0007 2F ADD A,R7
7 0008 2412 ADD A,#12H
8 000A 80FE HERE: SJMP HERE
9 000C 000C END
Code:
PROGRAM MEMORY
Address code
0000 7D
0001 25
0002 7F
0003 34
0004 74
0005 00
0006 2D
0007 2F
0008 24
0009 12
000A 80
000B FE
· When the 8051 is powered up, the PC (program counter) has 0000 and starts
to fetch the first opcode from location 0000 of the program ROM. In the case
of the above program the first opcode is 7D, which is the code for moving an
operand to R5. Upon executing the opcode, the CPU fetches the value 25 and
places it in R5. Now one instruction is finished. Then the program counter is
incremented to point to 0002 (PC = 0002), which contains opcode 7F, the
opcode for the instruction “MOV R7 , . .”.
· Upon executing the opcode 7F, the value 34H is moved into R7. Then the program counter is incremented to 0004.
· ROM location 0004 has the opcode for the instruction “MOV A, #0″. This
instruction is executed and now PC = 0006. all the above instruc
tions are 2-byte instructions; that is, each one takes two memory locations.
· Now PC = 0006 points to the next instruction, which is “ADD A, R5″. This is
a 1-byte instruction. After the execution of this instruction, PC = 0007.
· The location 0007 has the opcode 2F, which belongs to the instruction “ADD
A,R7″. This also is a 1-byte instruction. Upon execution of this instruction,
PC is incremented to 0008. This process goes on until all the instructions are
fetched and executed.
the program counter points at the next
instruction to be executed
I think input should be reset , clock, opcode ,accumulator, ram memory
what will be input and output for program counter?