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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/29/07 23:54
Read: times


 
#141356 - ram in 8051
Responding to: ???'s previous message
One of the differences in embedded programming is that not all memory is created equal. In this case, you are trying to mix two different types of memory. Adding a simple "DB' to define a data bytes typically adds it to the code memory, stored in eprom, mask rom or flash, and by implication it is a constant which can not be changed by the program. In most 8051s anything in code memory is read only.

You need to define a location in data memory, which can vary by type of 8051. The simplest form of RAM is the 128 bytes of scratchpad at data locations 0x00 to 0x7f. These locations can be directly addressed by 8051 assembly instructions. How to enter this in the assembler varies by which tool you use.

For a generic version which works with most assemblers, define a symbol for each RAM position. For example:
x1 equ 0x40
x2 equ ox41
then you can enter "MOV x1, A" to write to the location, or "MOV A,x1" to read.
Jack Peacock

List of 13 messages in thread
TopicAuthorDate
assembly help, please.            01/01/70 00:00      
   Confusion            01/01/70 00:00      
   use DB            01/01/70 00:00      
      i know            01/01/70 00:00      
         It is ASM            01/01/70 00:00      
         ram in 8051            01/01/70 00:00      
            SEG            01/01/70 00:00      
            query            01/01/70 00:00      
               Yes            01/01/70 00:00      
                  Protection??            01/01/70 00:00      
                     A bit unclear...            01/01/70 00:00      
                        tricky...            01/01/70 00:00      
                           Indeed...            01/01/70 00:00      

Back to Subject List