??? 09/30/09 19:54 Read: times |
#169311 - Understand meaning of EQU and DB Responding to: ???'s previous message |
DB0 EQU P1.0 just tells the assembler that whenever you write DB0 in the source code, you really mean P1.0. You are creating alternative names - this is very common to make the source code easier to read, and to allow you to redefine parts of the code without reading through every line of code.
In your examples the display signal EN is connected to P3.7, signal RS is connected to P3.6 and signal RW is connected to P3.5. By having named constants like this, you can rewire your hardware and just change these declarations to get your program to work with a new pin allocation. Your assembler is not expected to recognize EN, RS, RW - they are not intended to be magic keywords for the assembler but user-defined constants naming signals you have connected to the processor. So the the assembler will (after performing the replacement EN -> P3.7) recognize assembler instructions referencing the P3.7 bit. DB means Define Byte. So DB x,y,z will just store three bytes with the value x, y and z in the memory. DB EQU x, EQU y, EQU z would not make sense, since EQU is a binary operator requiring an argument on each side. I don't know why you think you would need to use the EQU keyword in a DB statement. |