This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to add the two numbers in this controller

sir ,

i want to add to data from the external memory. so i need correct format for this controller


XBYTE[0x1234] = 0x55;
XBYTE[0x1245] = 0x11;

how to add this data and save it to another memory

Parents
  • Pointers

    #include<stdio.h>
    #include<reg51.h>
    #include<intrins.h>
    
    
    unsigned char xdata *addend;
    unsigned char xdata *augend;
    unsigned int  xdata sum;
    void main()
    {
       addend = 0x1234;
       augend = 0x1235;
    
       sum = *addend + *augend;
    }
    

    _at_

    #include<stdio.h>
    #include<reg51.h>
    #include<intrins.h>
    
    
    unsigned char xdata addend _at_ 0x1234;
    unsigned char xdata augend _at_ 0x1235;
    unsigned int  xdata sum;
    void main()
    {
       sum = addend + augend;
    }
    

    XBYTE

    #include<stdio.h>
    #include<reg51.h>
    #include<intrins.h>
    
    
    unsigned int  xdata sum;
    void main()
    {
       sum = XBYTE[0x1234] + XBYTE[0x1235];
    }
    

    The Manual is your Friend

Reply
  • Pointers

    #include<stdio.h>
    #include<reg51.h>
    #include<intrins.h>
    
    
    unsigned char xdata *addend;
    unsigned char xdata *augend;
    unsigned int  xdata sum;
    void main()
    {
       addend = 0x1234;
       augend = 0x1235;
    
       sum = *addend + *augend;
    }
    

    _at_

    #include<stdio.h>
    #include<reg51.h>
    #include<intrins.h>
    
    
    unsigned char xdata addend _at_ 0x1234;
    unsigned char xdata augend _at_ 0x1235;
    unsigned int  xdata sum;
    void main()
    {
       sum = addend + augend;
    }
    

    XBYTE

    #include<stdio.h>
    #include<reg51.h>
    #include<intrins.h>
    
    
    unsigned int  xdata sum;
    void main()
    {
       sum = XBYTE[0x1234] + XBYTE[0x1235];
    }
    

    The Manual is your Friend

Children