The process of executing a program by a microcontroller is actually the process of executing the program we have programmed. That is, the process of instruction by instruction. Each execution of an instruction by a computer can be divided into three phases, that is, fetching an instruction----analysing an instruction-----execution instruction.

The task of fetching instructions is to read the current instruction from the program memory according to the value in the program counter PC and send it to the instruction register.

The task of analyzing the instruction phase is to take out the instruction opcode in the instruction register, decode it, and analyze the nature of the instruction. If the instruction requires an operand, look for the operand address.

The process of the computer executing the program is actually repeating the above operation process one by one, until the stop instruction can be cycled to wait for the instruction.

When a general computer is working, the program and data are first sent to the memory through the input interface circuit and the data bus through an external device, and then taken out one by one. However, the programs in the microcontroller are generally fixed in the on-chip or off-chip program memory by the writer in advance. Therefore, the instruction can be executed upon startup.



Below we will give an example to illustrate the execution of the instruction:

At startup, the program calculator PC becomes 0000H. Then the microcontroller automatically enters the execution program process under the action of the sequential circuit. The execution process is actually a loop process of fetching instructions (taking out the stage of instructions stored in memory beforehand) and executing instructions (analysing and executing instructions).

For example, the execution instruction: MOV A, #0E0H, its machine code is "74H E0H", the function of this instruction is to send the operand E0H to the accumulator, 74H has been stored in the 0000H unit, and E0H has been stored in the 0001H unit. When the microcontroller starts running, it first enters the fetching phase, in the order:

1. The contents of the program counter (in this case, 0000H) are sent to the address register;

2. The content of the program counter is automatically incremented by 1 (becomes 0001H);

3. The contents of the address register (0000H) are sent to the memory through the internal address bus, and the address in the memory is decoded, so that the unit with the address 0000H is selected;

4. The CPU makes the read control line valid;

5. The contents of the selected memory cell (74H at this time) are sent to the internal data bus under the control of the read command. Since it is the fetch stage, the content is sent to the instruction register via the data bus.

At this point, the instruction phase is completed and enters the stage of decoding analysis and execution instructions.

Since the content entered into the instruction register is 74H (opcode), after decoding by the decoder, the microcontroller knows that the instruction is to send a number to the A accumulator, and the number is the next one in the code. Storage unit. Therefore, to execute the instruction, the data (E0H) must be taken out of the memory and sent to the CPU, that is, the second byte is also taken in the memory. The process is very similar to the fetching phase, except that the PC is already 0001H.

The instruction decoder, in conjunction with the timing component, generates a micro-operation series of 74H opcodes that cause the digital E0H to be fetched from the 0001H unit. Because the instruction is required to send the fetched number to the A accumulator, the fetched number enters the A accumulator via the internal data bus instead of entering the instruction register. At this point, the execution of an instruction is completed. PC=0002H in the single-chip microcomputer, the PC automatically adds 1 every time the CPU fetches or retrieves the memory, and the MCU enters the next fetching stage. This process is repeated until a pause command is received or the loop waits for a command pause. The CPU executes the instructions one by one to complete all the specified functions.

Custom Cable Assembly

We provide wire harness manufacturing services for cable harnesses and built-to-print cables used in many industries, such as computer, game machine, POS machine, ATM , audio/video, electro-mechanical, data communications, telecommunications, medical, etc.

Related Products:speaker cable,customized cable assemblies,electrical cable assemblies.

We have developed a tradition of high-tech engineering, prototyping, and quality custom cable manufacturing at very competitive pricing. Also with professional flow chart (wire cutting-stripping-copper twisting-crimping-crimping 100% inspection-soldering-molding-asssembling-testing-FQC100% -OQC1-OQC2) , which can help us support customers with stable quality.


Custom Wire Harness Assembly

  • Electrified dimensional build boards with 100% continuity test
  • Capabilities to test for fuse,diode,resistor, and relay presence
  • Mating test fixtures for lower production wire harnesses
  • Ability to free hand build harnesses for prototypes and design validation
  • Separate layout boards for addition of fir tree clips, rosebuds, clamps,and labels after coverings added
  • Capabilities to add board interlocks and test markings to harness as needed

Speaker Cable,Straight Bnc Cable Assembly,Idc Red Custom Cable Assembly,Customized Cable Assemblies,EV Cable Assemblies,Cable Assembly,Custom Cable,Customized Cable Assemblies

ETOP WIREHARNESS LIMITED , https://www.oemwireharness.com