Hello !
I've been learning more about microcontrollers and microprocessor with 16 and 32 bits. So far I've been using MCS-51 the 8 bit microcontroller and I couldn't understand something when I was learning 32 bit STM32.
I would like to also confirm if I am right about some facts :
- is it true that the code for MCS-51 or for STM32 written in C tracked by program counter and send the whole code from top to bottom into ROM memory and the whole code is being transfered into opcode and sent from ROM into control system and the control system says what ALU has to do whether it is Adding two adresses or changing the value of one if his registers etc.
- The program counter restarts and starts again from top to bottom all the time until the program stops ? I've seen that the program counter has a connection from control system and it increments the program counter
About my problem understanding some things in STM32 which is 32 bits :
- When I have UART that transmits or receive for example 8 bit (I know it can be 7-9 bits I choose 8 bits). Where does it store the information in ALU ?
I mentioned about the storage because MCS-51 I usually had to store information in RAM 128 Byts in which 16 Byts I can choose any bit and change it's value and okey I receive 8 bit of infomation from UART, where could it be stored in the 8 bit microprocessor or microcontroller ? In the 128 Byts of Ram or in 128 Byts of SFR ? Also for 32 bit STM32, where he storages the information in which part of the ram from UART, because he needs 4 Byts to make an adress usable for processor because he need 32 bit adress and cannot take 8 bit or 16 bit adress.
![1696445287361.png 1696445287361.png](https://forum.allaboutcircuits.com/data/attachments/291/291808-195c7f6fc41276271616c4e3e1b130aa.jpg)
- Why the opcodes have different length sometimes it can be 8 bit sometimes 16 bit. For MCS-51 even thoughit is 8 bit the opcode can be 16 bit for one operation.
![1696445438715.png 1696445438715.png](https://forum.allaboutcircuits.com/data/attachments/291/291809-27e81e33626dd3c87976256897cfdc44.jpg)
I thought that SUBB will have 8 bits, A will have 8 bits and R0 also 8 bits, all 3 of them instead of giving 24 bits they give 8 bits. Does it also works the same with STM32 ?
- I think this is the last question. When I write mov 40h, C then I use the bit (like it is shown in red arrow) and when I write mov 40h, A then I use the Byte from the general purpose ram and not the 40h bit from 28 byte ?
I am grasping the knowladge of microcontrolers and microprocessor, it is just the bits/bytes lengths that changes and I lose the track at some point ... I think this isn't that important of information to create a decent program, but I wanted to know how it works because the bit/byte length that changes from 32 bit into 8 bit input from UART that is stored somewhere, or the opcode length, or other bit/byte related things. Also I was struggeling with where it is stored and how much it stores because I was confused with how much space I have and which part of the ram is free so I can direct it somewhere. Sorry for my confusion, because while writing this post I was trying to show my side of confusion with my sloppy grammar ;>
PS.
I was also confused with UART that was transmited from STM32. Like transmite from STM to PC a sentence "Hello World I am STM32 !" How much space will it take in STM32 where it stores do I have to worry whether the space will run out ?
It is hard to say what confuses me I was so used to the MCS-51 where I somehow knew how it worked because when I wanted to control 8 diods so I used one byte to do it with specific value liek 10111001 and I knew which diode worked. But with UART and where is stores the info or other interfaces/devices. I just used UART as an example.
I've been learning more about microcontrollers and microprocessor with 16 and 32 bits. So far I've been using MCS-51 the 8 bit microcontroller and I couldn't understand something when I was learning 32 bit STM32.
I would like to also confirm if I am right about some facts :
- is it true that the code for MCS-51 or for STM32 written in C tracked by program counter and send the whole code from top to bottom into ROM memory and the whole code is being transfered into opcode and sent from ROM into control system and the control system says what ALU has to do whether it is Adding two adresses or changing the value of one if his registers etc.
- The program counter restarts and starts again from top to bottom all the time until the program stops ? I've seen that the program counter has a connection from control system and it increments the program counter
About my problem understanding some things in STM32 which is 32 bits :
- When I have UART that transmits or receive for example 8 bit (I know it can be 7-9 bits I choose 8 bits). Where does it store the information in ALU ?
I mentioned about the storage because MCS-51 I usually had to store information in RAM 128 Byts in which 16 Byts I can choose any bit and change it's value and okey I receive 8 bit of infomation from UART, where could it be stored in the 8 bit microprocessor or microcontroller ? In the 128 Byts of Ram or in 128 Byts of SFR ? Also for 32 bit STM32, where he storages the information in which part of the ram from UART, because he needs 4 Byts to make an adress usable for processor because he need 32 bit adress and cannot take 8 bit or 16 bit adress.
![1696445287361.png 1696445287361.png](https://forum.allaboutcircuits.com/data/attachments/291/291808-195c7f6fc41276271616c4e3e1b130aa.jpg)
- Why the opcodes have different length sometimes it can be 8 bit sometimes 16 bit. For MCS-51 even thoughit is 8 bit the opcode can be 16 bit for one operation.
![1696445438715.png 1696445438715.png](https://forum.allaboutcircuits.com/data/attachments/291/291809-27e81e33626dd3c87976256897cfdc44.jpg)
I thought that SUBB will have 8 bits, A will have 8 bits and R0 also 8 bits, all 3 of them instead of giving 24 bits they give 8 bits. Does it also works the same with STM32 ?
- I think this is the last question. When I write mov 40h, C then I use the bit (like it is shown in red arrow) and when I write mov 40h, A then I use the Byte from the general purpose ram and not the 40h bit from 28 byte ?
I am grasping the knowladge of microcontrolers and microprocessor, it is just the bits/bytes lengths that changes and I lose the track at some point ... I think this isn't that important of information to create a decent program, but I wanted to know how it works because the bit/byte length that changes from 32 bit into 8 bit input from UART that is stored somewhere, or the opcode length, or other bit/byte related things. Also I was struggeling with where it is stored and how much it stores because I was confused with how much space I have and which part of the ram is free so I can direct it somewhere. Sorry for my confusion, because while writing this post I was trying to show my side of confusion with my sloppy grammar ;>
PS.
I was also confused with UART that was transmited from STM32. Like transmite from STM to PC a sentence "Hello World I am STM32 !" How much space will it take in STM32 where it stores do I have to worry whether the space will run out ?
It is hard to say what confuses me I was so used to the MCS-51 where I somehow knew how it worked because when I wanted to control 8 diods so I used one byte to do it with specific value liek 10111001 and I knew which diode worked. But with UART and where is stores the info or other interfaces/devices. I just used UART as an example.
Last edited: