fetching and executing instruction?

Status
Not open for further replies.

vead

Full Member level 5
Joined
Nov 27, 2011
Messages
285
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Visit site
Activity points
3,815
micro controller contain mainly ALU, control unit ROM , RAM, PORT

Processor take information from ROM, RAM, Input port

fetching - decoder take command from rom memory

decode - decoder decode instruction and tell the cpu what to do like add, sub

execution- alu do the operation like add, sub.. and sand the result into ram memory

processor take input from the input port


Ijust want to know how does ALU, DECODEr, RAM, ROM, I/o port work together
 

Each one of these resources operate once at a time, not together.

Decoder unit performs generation of clock phases necessary to execute the steps you described above.



+++
 

Each one of these resources operate once at a time, not together.

Decoder unit performs generation of clock phases necessary to execute the steps you described above.



+++

I have many doubts, but at this time the main doubt I have that signal from the input device(switch) goes into the input port
how does processor know that which port pin is high and which port pin is low ?

same for output device (LED) signal come from port ?

how does processor send the signal to output port ?
 

...how does processor know that which port pin is high and which port pin is low ?

Assuming that you are referring to a processor which do not maps pins of ports, you must run instructions that read entire port, but bitmask independently each pin for check its value.



+++
 

I am not sure but Think signal from the switch (input) goes input port which is addressed any other memory location in Ram memory
program in rom memory tell the processor to look at location and if the switch is open 0000 the location will hold 0000 data and If switch is closed 0001 location will hold 0001 data


RAM memory ROM memory
location address data
R0:8000 8000 0000 switch is open
R1:8006 8006 0001 switch is closed
!
!
! ! !
R20 8010 0010

program contain both data and address in rom memory processor read the memory instruction 8000 0000

Decoder decode the instruction

processor do the arithmetic and logic operation

program tell the processor look at location and If switch is open 0000 the location 8000 will hold data 0000 and If switch is closed the location 8006 hold the data 0001

program counter execute instruction one by one
 

instruction should be fetch, decode and execute and result, should be save into memory
tell me only, is this correct statement or not ?
If yes then result should be store in which memory rom or ram?
I think ram memory but I am not sure
 

result should be store in which memory rom or ram?

No result may be saved at ROM memories ( conceptually means Read Only Memory ).
In fact, for program memories, most current processors employ FLASH ones rather than ROM, due to their ability to be reprogrammed.



+++
 
Reactions: vead

    vead

    Points: 2
    Helpful Answer Positive Rating
No result may be saved at ROM memories ( conceptually means Read Only Memory ).
In fact, for program memories, most current processors employ FLASH ones rather than ROM, due to their ability to be reprogrammed.



+++
mcro controller contain mainly ALU, control unit ROM , RAM, PORT

Processor take information from ROM, RAM, Input port

fetching - decoder take command from rom memory

decode - decoder decode instruction and tell the cpu what to do like add, sub

execution- alu do the operation like add, sub.. and sand the result into rom memory

we have fetched , decoded and executed instruction but where does we use ram memory ?
 
Last edited:

For almost everything.
These memories are used for store data temporarily.
+++

I know that, I just want to ask when does ram work?
when micro controller do work

fetching - decoder take command from rom memory

decode - decoder decode instruction and tell the cpu what to do like add, sub

execution- alu do the operation like add, sub.. and sand the result into rom memory

we have fetched , decoded and executed instruction but where does we use ram memory there may be done three process
fetching, decode and executing

during all process when does ram work?
 

we have fetched , decoded and executed instruction but where does we use ram memory there may be done three process
fetching, decode and executing

during all process when does ram work?

Ok, now I got the question.
The user addressable RAM is used during program execution.


+++
 

Ok, now I got the question.
The user addressable RAM is used during program execution.


+++

yes can you explain little b

- - - Updated - - -

yes can you explain little bit about when does program execute ?
how the processor work with ram and rom?
 

You already answered the question, just having to rectify the last statement, replacing rom by ram.

fetching - decoder take command from rom memory

decode - decoder decode instruction and tell the cpu what to do like add, sub

execution- alu do the operation like add, sub.. and sand the result into rom memory
 

Hello everyone I want understand how does microcontroller work so I have done some homework

Instruction should be fetch, decode and execute
assembly code
Mov A, #2
Mov R1, #3
Add A, R1

lets say program convert into hexa code

8000 0101 1st Instruction
8001 1o01 2nd instruction
8002 0101 3rd Instruction

this hex code stored in to rom memory
address data
8000 0101
8001 1o01
8002 0101

location of data stored into RAM
location
8000
8001
8002

ok now we want to fetch 1st instruction

we now about accumulator register , decoder
Instruction 1st is 8000 0101 fetch from rom memory, decoder take the information and it will store the value in A register, processor send the request in Ram memory and it look location 8000 for data 0101

program counter execute instruction one by one
now 2nd instruction 8001 1001 fetch from rom memory decoder take instruction and it will store value into register R1 processor send request in ram memory and ram memory look location 8001 for data 1001

3rd instruction fetch from rom memory decoder decode instruction and tell the alu for addition
alu do addition and result will save in ram memory

In my above paragraph I think there are many wrong statement so please check out me and correct me
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…