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 09:43
Read: 1095 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      Donagh Choghlan      01/04/12 09:43      
   Code indented      Donagh Choghlan      01/04/12 09:56      
      Assemblers often have different syntax      David Prentice      01/04/12 10:14      
         Assembler      Donagh Choghlan      01/04/12 10:29      
            Why not use Keil A51 ?      David Prentice      01/04/12 10:38      
               why assembler?      Stefan KAnev      01/04/12 11:05      
                  Libraries?!?!?      Donagh Choghlan      01/05/12 02:46      
                     Libraries good, but not always best      Per Westermark      01/05/12 03:21      
                        Ok back to Data and Bit      Donagh Choghlan      01/05/12 04:34      
                           Manual      Donagh Choghlan      01/05/12 05:02      
                           ok back      Stefan KAnev      01/05/12 08:14      
                              I C      Donagh Choghlan      01/05/12 08:34      
               Keil A51      Donagh Choghlan      01/05/12 02:41      
                  junk downloaders        Erik Malund      01/05/12 05:57      
                  take a look at ASEM51      Richard Erlacher      01/05/12 08:22      
                     asem-51 macros      Donagh Choghlan      01/06/12 08:43      
                        You don't have to use 'em      Richard Erlacher      01/06/12 21:17      
                  re-think about tools      Stefan KAnev      01/06/12 14:08      
                     ADuC842      Donagh Choghlan      01/09/12 08:47      
                        learn      Stefan KAnev      01/09/12 14:46      
                           There are PLENTY of debuggers ...      Richard Erlacher      01/09/12 20:28      
                              Documentation      Donagh Choghlan      01/10/12 05:30      
                                 interrupt vectors      Stefan KAnev      01/10/12 06:41      
                                 Memo to Reinhard Keil      Erik Malund      01/10/12 07:56      
                                 Keil docs are not bad.      David Prentice      01/10/12 08:00      
                                 Well ... Last time I had questions about ASEM51 ...      Richard Erlacher      01/10/12 21:36      
                                    the good and the bad      Erik Malund      01/11/12 05:50      
                                       Well, I must have mistyped      Richard Erlacher      01/11/12 13:29      
                                          asem/asm      Robert Revens      01/11/12 16:43      
                                          linker support?      Maarten Brock      01/12/12 00:18      
                                             it's provided by ASEM-51, I suppose      Richard Erlacher      01/12/12 22:22      
   Ok back to the task at hand      Donagh Choghlan      01/05/12 08:26      
      make it easy for yourself      Erik Malund      01/05/12 09:09      
         Iím afraid the hard ware is non negotiable      Donagh Choghlan      01/05/12 09:26      
            well, ....      Erik Malund      01/05/12 09:46      
               Dinosours, I2Cs, Gang-bang???      Donagh Choghlan      01/05/12 10:19      
                  1st      Stefan KAnev      01/05/12 11:15      
                     Simple approach      Donagh Choghlan      01/06/12 04:59      
                        yes      Stefan KAnev      01/06/12 13:05      
                           For Free :-)      Donagh Choghlan      01/09/12 09:05      

Back to Subject List