why we need memory in microcontroller?

Thread Starter

vead

Joined Nov 24, 2011
629
Ask if you don´t understand anything.
lets think I have micro controller 89c51 ,LED,switch,compiler(keil),programmer (flesh magic)
SWITCH is input device connected port pin P0.1
LED is output device connected port pin P1.1

I have written assembly code in keil software
Rich (BB code):
ORG  OH
ON:
SETB P1.1   ; LED IS ON
OFF:
CLRB P1.1    ; LED IS OFF
LOOP:
JB P0.1         ; SWITCH ON
JNB P0.1        ; SWITCH OFF
SJMP LOOP
END
1)how the processor understand command setb P1.1 from ROM memory ?

LED on:lets say the P1.1 is data bit that means 0100 0000 and its address something likr 0010 0000 stored into ram memory
LED off: lets say P1.1 is data bit that mean 0000 0000 and its address something like 0001 0000 stored into ram memory

1)how the processor fetch and execute the command SETB P1.1, CLR p1.1 ?

I want to understand how the ALU, control unit, RAM, rom work togather with this example
 
Last edited:

GRNDPNDR

Joined Mar 1, 2012
545
I've read through 5 pages of this thread, and am utterly and completely confused by wth is going on.

why memory is used, and how, has been explained about 10 different times in as many different ways.

Then we have the philosopher who is questioning the universe and it's very essence in relation to circuitry, and whom I almost imagine to look very similar to Tommy Chong.

I don't know whether I should laugh, cry, or just sit here with a confused look on my face for a while.
 

ScottWang

Joined Aug 23, 2012
7,400
I think you still didn't see the 74F181 very carefully and more times, when you figured out how it work, what you asking now will disappear, see the normal IC functions of each pin and the functions of internal logics structures.

The answers is there, how a software working with a hardware - 74181 will give you what you want, there is no shortcut, you have to spend more and more time to understand how it work, see #31, #36 and draw the circuit, starting to figure out how the hardware and software working together.

If you still asking that kind of question then I will thought that you didn't spend more time to study it, many people can use the hardware and design the software, but maybe they can't give you the answer like this, only you can help yourself.

Many things have to study from the very basic when you met some deeper problems, and that will make your skills getting progress.
 

takao21203

Joined Apr 28, 2012
3,702
lets think I have micro controller 89c51 ,LED,switch,compiler(keil),programmer (flesh magic)
SWITCH is input device connected port pin P0.1
LED is output device connected port pin P1.1

I have written assembly code in keil software
Rich (BB code):
ORG  OH
ON:
SETB P1.1   ; LED IS ON
OFF:
CLRB P1.1    ; LED IS OFF
LOOP:
JB P0.1         ; SWITCH ON
JNB P0.1        ; SWITCH OFF
SJMP LOOP
END
1)how the processor understand command setb P1.1 from ROM memory ?

LED on:lets say the P1.1 is data bit that means 0100 0000 and its address something likr 0010 0000 stored into ram memory
LED off: lets say P1.1 is data bit that mean 0000 0000 and its address something like 0001 0000 stored into ram memory

1)how the processor fetch and execute the command SETB P1.1, CLR p1.1 ?

I want to understand how the ALU, control unit, RAM, rom work togather with this example
you wrote some code, great.
i've read about the 8080 on wikipedia.

How about if the engineering team would have had your assistance?

And I am writing a 8080 emulator now.
i just write the C source, without compiling it or testing it.

On a large microcontroller!

The 8080 program is loaded somehow into a RAM.
The emulator is executing from the FLASH.

I need to write a C function for each Opcode. they all have 8 bits.

Maybe there is unused space for a VEAD instruction- CPU blinks random lights for some time. The person who watches it gets happy.

I dont know everything how to get CP/M working on the PIC.
But I understand most of it.

I transform the PIC into an 8080. And for what it is worth, solder a RAM chip, well, why not? Then I can use more RAM.
 

takao21203

Joined Apr 28, 2012
3,702
OK. Let's put it that way. The processor does not actually know if it is RAM or ROM.

It is outside IC.

PROCESSOR = CPU. External RAM and ROM.

MICROCONTROLLER = CPU + RAM + ROM

OTP - MASK ROM
FLASH - reprogramable

RAM and ROM are the same. Except ROM can not be written.
 

takao21203

Joined Apr 28, 2012
3,702
I know ,that's not my question look at post #53
how does a match work when it is lit and put to candle in oxygen athmosphere?

The same as "Whack a mole"- just hit'em.


when you did take the advice and study 8080, you'd see the engineers did not know either.

But they managed, and somehow made the first processor.

That's why they called engineers. If they just ask like you, they are not engineers.
 

JWHassler

Joined Sep 25, 2013
306
I am stupid guy because I don't understand easy things there is no need to tell other

I just want to ask when does ram work?
processor take information from both memory ram and rom

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

I don't understand how does ram work when instruction fetch, decode and execute
... the processor does not write the result back to ROM: it can only write to RAM
Processor can read from and write to RAM memory.

Not to muddy the waters too much, but: some processors can run RAM as program-memory(fetch instructions from) and as data memory (read data from/write data to.)

Sorry to make such a big deal out correcting your quote above, but you've made that same incorrect assertion several times now.
 

takao21203

Joined Apr 28, 2012
3,702
... the processor does not write the result back to ROM: it can only write to RAM
Processor can read from and write to RAM memory.

Not to muddy the waters too much, but: some processors can run RAM as program-memory(fetch instructions from) and as data memory (read data from/write data to.)

Sorry to make such a big deal out correcting your quote above, but you've made that same incorrect assertion several times now.
I explained to him, it makes no difference except ROM is not possible to write. The processor actually DOES NOT KNOW.

then he replied: Yes but that was not my question.

I don't understand how does ram work when instruction fetch, decode and execute

Then I reply: the processor does not actually know and it could be doing it from ROM.

But that was not the question.
 

Thread Starter

vead

Joined Nov 24, 2011
629
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
 
Top