??? 08/26/10 03:12 Modified: 08/26/10 04:43 Read: times |
#178325 - Code is horrific Responding to: ???'s previous message |
Anas,
The code that you posted is just plain horrific. It has the look of small understanding of how programming can be done. I know you probably got this whole thing off some web page and did not really write much of it yourself. But none the less I want to comment as to the quality so that you do not think that this is acceptable type if coding. Several things need serious cleaning up. 1) Get rid of those long sequences of assembler code that repeat over and over again to display individual characters onto the LCD. Replace these with a declaration in the source code such as: StringName: DB 'string text', 0 Then make up a subroutine that takes a parameter in the DPTR register that points to the beginning of a string as described above. This subroutine can scan the string in a loop and send each text byte to the display until the loop encounters the zero ending byte to stop and exit from the subroutine. This change will reduce the volume of your code by a tremendous amount. 2) Get rid of the extremely inefficient use of the internal data memory with all those defined memory addresses. Use the above string type scheme to send parts of the LCD module that are fixed text. Then make up a subroutine that sends some formatted item to the display that meets your needs. One example could be a routine that accepted a byte in A as the entry parameter and then display that value as a two or three ASCII digit value on the LCD module. 3) Note that it is possible to start display at any character cell position on the LCD. You are not just forced to start display from the start of a row. Michael Karas |
Topic | Author | Date |
help in Assembly compiling please | 01/01/70 00:00 | |
Instructions can't always store full target address | 01/01/70 00:00 | |
Dear Per Westermark | 01/01/70 00:00 | |
Code is horrific | 01/01/70 00:00 | |
hi Michael![]() | 01/01/70 00:00 |