Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/04/12 16:43
Read: times


 
#185301 - Assembly coding micro-converters
I have a question for anyone who can code in assembly, I have read the tutorials and the FAQ but the answer eluded me.

When beginning a section of code it is sometimes useful to define certain numbers that re-appear often in your code. I have found it quite difficult to find information on this subject probably because the answer is obvious but never the less its kept me baffled for quite some time today.

Here is the intro to my code:

************************************************************************

PCF1_ADD EQU 01000101b ; I2C expander 1
PCF2_ADD EQU 01001101b ; I2C expander 2

RES_1 EQU 0x00 ; 100k ohms
RES_2 EQU 0x01 ; 10k ohms  these are integer values for 2-bit select lines
RES_3 EQU 0x02 ; 1k ohm
RES_4 EQU 0x03 ; 0.1k ohms

BYE_BITS DATA 0x40 ; 8-bit register for counting down 8 units
MUX_NO DATA 0x41 ; 8-bit register for holding an ID number

NACK BIT 0x50 ; Acknowledge flag for I2C
PCF_2 BIT 0x51 ; I2C expander select flag

************************************************************************

The DATA and BIT commands seem straight forward enough and look like they work but I’m not sure because I have very little experience writing code. From the comments can you tell if they have been used correctly?

I have major doubts about the EQU command, at first I wrote it like [ RES_1 EQU #0x00 ] but this would not compile so I removed the # symbol.

It would be of great benefit to me if someone could try to explain this stage of coding to me or maybe recommend some text that covers my issue.


List of 40 messages in thread
TopicAuthorDate
Assembly coding micro-converters            01/01/70 00:00      
   Code indented            01/01/70 00:00      
      Assemblers often have different syntax            01/01/70 00:00      
         Assembler            01/01/70 00:00      
            Why not use Keil A51 ?            01/01/70 00:00      
               why assembler?            01/01/70 00:00      
                  Libraries?!?!?            01/01/70 00:00      
                     Libraries good, but not always best            01/01/70 00:00      
                        Ok back to Data and Bit            01/01/70 00:00      
                           Manual            01/01/70 00:00      
                           ok back            01/01/70 00:00      
                              I C            01/01/70 00:00      
               Keil A51            01/01/70 00:00      
                  junk downloaders            01/01/70 00:00      
                  take a look at ASEM51            01/01/70 00:00      
                     asem-51 macros            01/01/70 00:00      
                        You don't have to use 'em            01/01/70 00:00      
                  re-think about tools            01/01/70 00:00      
                     ADuC842            01/01/70 00:00      
                        learn            01/01/70 00:00      
                           There are PLENTY of debuggers ...            01/01/70 00:00      
                              Documentation            01/01/70 00:00      
                                 interrupt vectors            01/01/70 00:00      
                                 Memo to Reinhard Keil            01/01/70 00:00      
                                 Keil docs are not bad.            01/01/70 00:00      
                                 Well ... Last time I had questions about ASEM51 ...            01/01/70 00:00      
                                    the good and the bad            01/01/70 00:00      
                                       Well, I must have mistyped            01/01/70 00:00      
                                          asem/asm            01/01/70 00:00      
                                          linker support?            01/01/70 00:00      
                                             it's provided by ASEM-51, I suppose            01/01/70 00:00      
   Ok back to the task at hand            01/01/70 00:00      
      make it easy for yourself            01/01/70 00:00      
         I’m afraid the hard ware is non negotiable            01/01/70 00:00      
            well, ....            01/01/70 00:00      
               Dinosours, I2Cs, Gang-bang???            01/01/70 00:00      
                  1st            01/01/70 00:00      
                     Simple approach            01/01/70 00:00      
                        yes            01/01/70 00:00      
                           For Free :-)            01/01/70 00:00      

Back to Subject List