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 Reply Children

  • sorry sir. i had concentrate in some other work. so i had using new thread list.then coming to my point. i want a data for ex 0x55 is data. i want to get the data from particular memory location. so i have using XBYTE. But ur ans coding is the data is transfer through acc. it is corect. but i want

    addend is store in the particular memory address &

    augend is store in the another memory address and

    result sum is stored in some other memory location

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

  • Why not describing the problem you are trying to solve, instead of telling us details such that you want the data transfered through the accumulator?

    If you give the picture, people can help solving the problem.

  • "addend is store in the particular memory address"

    Is this really important to your application?

    Of course, in practice, the data has to be physically stored in some specific location - but this is almost always entirely irrelevant to the program!
    Common exceptions would be shared memory, and memory-mapped IO - is this what you're doing? If not, why does the address matter to you?

    If the address really does matter to you, I have already told you the keyword to use, and given you the relevan reference in the Manual - but you are going to have to read it for yourself!

  • 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


  • sir

    i want some details about Serial COM port. how the data get it from the Serial port. So what is the procedure for that type of program

  • Have you looked for manuals and sample programs for the processor of choice?

    There are huge amounts of information available!