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

adding carry(cy) to an integer variable.

i had a problem in adding the carry to the integer variable.i want to add carry to integer variable.if anyone knows please help me out.

Parents
  • Precisely what problems are you having?

    CY should be in the standard Keil header file.

    Even if it isn't, you can easily create your own sbit definition.

    int my_var;
    
    my_var += CY;
    


    But how do you know what value will be in CY? How can you guarantee that it won't have been affected by some of the compiler's "internal" operations? You can't! Therefore, if you really need direct access to CPU registers like this, you are going to have to write in assembler.

Reply
  • Precisely what problems are you having?

    CY should be in the standard Keil header file.

    Even if it isn't, you can easily create your own sbit definition.

    int my_var;
    
    my_var += CY;
    


    But how do you know what value will be in CY? How can you guarantee that it won't have been affected by some of the compiler's "internal" operations? You can't! Therefore, if you really need direct access to CPU registers like this, you are going to have to write in assembler.

Children
No data