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

what's wrong ? why?

#include "reg51.h"
main()
{
bit k;
k = ACC^7; //this instruction is right .
ACC^7 = 1; // this instruction is wrong! why?
}


thank you !

Parents
  • Note: ACC^7 is an expression (its meaning already explained), it is not "left_value" (it has no address => no write is possible), therefore you can't write :

    ACC^7 = 1;
    

    Perhaps it should be like this:

    #include "reg51.h"
    
    sbit ACC7 = ACC^7; // first define bit of a bitaddressable base
    
    main()
    {
      bit k;
    
      k = ACC7;  // I think this was your
      ACC7 = 1;  // primary intention ?
    }
    

Reply
  • Note: ACC^7 is an expression (its meaning already explained), it is not "left_value" (it has no address => no write is possible), therefore you can't write :

    ACC^7 = 1;
    

    Perhaps it should be like this:

    #include "reg51.h"
    
    sbit ACC7 = ACC^7; // first define bit of a bitaddressable base
    
    main()
    {
      bit k;
    
      k = ACC7;  // I think this was your
      ACC7 = 1;  // primary intention ?
    }
    

Children
No data