Understanding Microcontroller Port Signals and Memory Storage: A Question

  • Thread starter Thread starter vead
  • Start date Start date
  • Tags Tags
    Microcontroller
AI Thread Summary
The discussion centers on how microcontrollers process input signals from switches through input ports and send output signals to devices like motors via output ports. It confirms that the processor fetches, decodes, and executes instructions, with results typically stored in RAM rather than ROM. Participants clarify that RAM is utilized during the execution phase, where data is temporarily held for processing. The conversation also touches on the architecture of the 8051 microcontroller, providing resources for further understanding. Overall, the thread emphasizes the importance of RAM in the operation of microcontrollers and the need for specific architectural knowledge to fully grasp these concepts.
vead
Messages
92
Reaction score
0
I don't understand what does mean of following statement

when user presses switch how does processor know that which port pin is high and which port pin is low

processor take signal from switch via the input port and send processor the signal signal to motor via output port

is this correct statement or not ?

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
 
Engineering news on Phys.org
vead said:
I don't understand what does mean of following statement
processor take signal from switch via the input port and send processor the signal signal to motor via output port

is this correct statement or not ?
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

Let's say you are using a microcontroller (uC) that has an 8-bit data bus width. Then each register or port will be 1 byte wide. The uC reads from the address of the input port, and gets an 8-bit value. Each of the bits can represent an input, like from a switch or from a sensor, etc.

When the uC writes to an output port, it writes an 8-bit value, and each of those bits can control some output thing, like light an LED or turn on a motor, etc.

The locations that you fetch information from and save results to are specified by your program. If you are writing in C for example, in the first part of your program you will declare your variables and how big they are, and if you want to force them to be located at some particular location in the memory map (like if you want to do reads and writes from the IO ports, for example, as opposed to some variable that is located somewhere in RAM and you don't care where it is).
 
berkeman said:
Let's say you are using a microcontroller (uC) that has an 8-bit data bus width. Then each register or port will be 1 byte wide. The uC reads from the address of the input port, and gets an 8-bit value. Each of the bits can represent an input, like from a switch or from a sensor, etc.

When the uC writes to an output port, it writes an 8-bit value, and each of those bits can control some output thing, like light an LED or turn on a motor, etc.

The locations that you fetch information from and save results to are specified by your program. If you are writing in C for example, in the first part of your program you will declare your variables and how big they are, and if you want to force them to be located at some particular location in the memory map (like if you want to do reads and writes from the IO ports, for example, as opposed to some variable that is located somewhere in RAM and you don't care where it is).


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
 
It looks like you have been doing some reading about uCs, which is good! :smile:

Can you point us to what you've been reading? That would make it easier to answer your questions about that reading.
 
berkeman said:
It looks like you have been doing some reading about uCs, which is good! :smile:

Can you point us to what you've been reading? That would make it easier to answer your questions about that reading.

yes you are correct I am reading about ram memory , BUT I don't understand how does ram work when instructions fetch, decode, and execute

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?
 
vead said:
yes you are correct I am reading about ram memory , BUT I don't understand how does ram work when instructions fetch, decode, and execute

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?

You did not answer my question by posting a link to your reading. Do you understand that it would be *much* easier to answer your question if you gave us a pointer to what you are reading?
 
berkeman said:
You did not answer my question by posting a link to your reading. Do you understand that it would be *much* easier to answer your question if you gave us a pointer to what you are reading?
I have given answer look at my previous post
I am reading about ram memory
I don't understand how does ram work when instruction fetch, decode and execute
 
First off all instructions are timed with a processor clock, when a Ram address is decoded via a decoder addressing circuit. Upon a chip enable instruction, via the CPU clock several signals are generated within a specific timing. the chip enable, the decoded Ram address, which is both a row and column address scheme. then data is written to the specified address location.

whether the RAM reads or writes is also controlled via one or two pins

If you look at a Ram chip and download the data sheet for that chip, it will provide the required signals and timing. Examine also the pin-out scheme. Ram cannot run by itself you need to look at the full circuit necessary to control a RAM module. As well as research the specific signals and timing. The specifics depend on the RAM module itself, so without further information from you we cannot help you further. IE we need to know your reference material

edit forgot to mention each RAM memory bit is essentially a flip flop circuit, you can google that
 
Last edited:
  • #10
everyone say start with basics so I am trying to understand in this way

Instruction + register +address +data ; statement for my understanding (idea)
mov + A + ? +02 ; assembly code ; statement for assembler (assembler)
01 + 10 + 01 + 01 ; binary digit ; statement for controller
off on + on off +off on +of on ; transistor on off
0,5v +5v ,0v +0v , 5v +0v 5v ; voltage level

can anyone help me In this way
 
  • #11
I'm sorry but the above doesn't give me enough to assist you. Which processor are you working on, Intel, PICO, Motorolla. If your looking for the assembly instructions and the hexadecimal conversions, with the correct OP codes we need to know this. We also won't be able to describe how the instructions work with the hardware addressing, such as the ALU addressing of the microprocessor to memory module location without knowing which system your working with
 
  • #12
Mordred said:
I'm sorry but the above doesn't give me enough to assist you. Which processor are you working on, Intel, PICO, Motorolla. If your looking for the assembly instructions and the hexadecimal conversions, with the correct OP codes we need to know this. We also won't be able to describe how the instructions work with the hardware addressing, such as the ALU addressing of the microprocessor to memory module location without knowing which system your working with

Thanks for reply I am talking about 8051
 
  • #13
Now we can work with you, unfortunately I never worked on the 8051, however finding the information is easy enough.

here is the 8051 architecture

http://www.mikroe.com/chapters/view/65/chapter-2-8051-microcontroller-architecture/


here is your much needed manual it has coverage of the architecture, with programming examples including memory.

http://cse.iitkgp.ac.in/~soumya/embcs/the-8051-microcontroller-0314772782.pdf

those will answer your questions, just work through the pdf file if you have further questions include the manual in your related posts, so others can look through it and help you with specific sections
 
Last edited by a moderator:
Back
Top