- #1
That's why I put the note about DPL in my last post.rcgldr said:This isn't a bubble sort. The code increments DPTR twice on each loop. It should only increment DPTR once on each loop.
XCH A,DPL
JNZ D1
DEC DPH
D1: DEC A
XCH A,DPL
.Scott said:I think the problem is that when you loop from DJNZ R1,L3, R0 is not reset.
Thanks. So overwriting R0 has been the problem. I will replace R0 with another register and check.rcgldr said:Why not use this to decrement DPTR, and also avoid overwriting R0?
The 8051 microcontroller is a type of microprocessor that is commonly used in embedded systems. It was first introduced in 1981 by Intel and has since been widely used due to its low cost, simplicity, and versatility.
"Descending order" refers to the way the 8051 microcontroller organizes and executes instructions. In descending order, instructions are executed from highest to lowest memory addresses, meaning that the first instruction in a program will be located at the highest memory address and the last instruction will be at the lowest memory address.
The descending order of instructions in the 8051 microcontroller allows for efficient use of memory and can result in faster execution times. This is because the microcontroller does not have to search for the next instruction in memory, as it is already located in the next sequential address.
Some of the advantages of using the 8051 microcontroller in descending order include faster execution times, efficient use of memory, and simpler programming. The descending order also makes it easier to debug programs, as the instructions are organized in a predictable and sequential manner.
While there are many advantages to using the 8051 microcontroller in descending order, there are some potential downsides as well. For example, using descending order may limit the flexibility of the program and make it more difficult to implement certain functions. Additionally, if the program is not properly organized, it may lead to inefficient use of memory and slower execution times.