Understanding Microcontroller Port Signals and Memory Storage: A Question

In summary, the conversation discusses the role of a microcontroller (uC) in processing and executing instructions. The uC reads from input ports and writes to output ports, with the help of an ALU and control unit. The locations for fetching and saving information are specified by the program. The conversation also mentions the use of RAM in the process of fetching, decoding, and executing instructions, but it is not clear when exactly RAM is used. The speaker also mentions reading about RAM and provides a link to a microcontroller tutorial for reference.
  • #1
vead
92
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
  • #2
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).
 
  • #3
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
 
  • #4
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.
 
  • #5
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?
 
  • #6
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?
 
  • #8
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
 
  • #9
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:

1. What is a microcontroller?

A microcontroller is a small, integrated circuit that contains a processor, memory, and input/output peripherals. It is used to control and monitor various electronic devices and systems.

2. What are the common applications of microcontrollers?

Microcontrollers are used in a wide range of applications, including consumer electronics, automotive systems, industrial control systems, and medical devices. They are also commonly used in robotics, smart home devices, and Internet of Things (IoT) devices.

3. How does a microcontroller differ from a microprocessor?

A microcontroller is a complete computer system on a single chip, while a microprocessor is only a central processing unit (CPU) and requires external components for memory and input/output. Microcontrollers are also designed for specific tasks, while microprocessors are more general-purpose.

4. What programming languages are used to program microcontrollers?

The most commonly used programming languages for microcontrollers are C and assembly. However, there are also other languages, such as BASIC and Python, that can be used with certain microcontrollers.

5. What factors should be considered when choosing a microcontroller?

Some important factors to consider when choosing a microcontroller include the required processing speed, memory size, number and type of input/output pins, and available development tools and support. The cost and power consumption of the microcontroller should also be taken into account.

Similar threads

  • Programming and Computer Science
Replies
6
Views
3K
  • Computing and Technology
Replies
8
Views
3K
  • Programming and Computer Science
Replies
17
Views
1K
Replies
37
Views
3K
Replies
14
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Introductory Physics Homework Help
Replies
13
Views
5K
Back
Top