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

Possible compilator bug???

Hi,
i need to XOR couple of bytes. Im try to do it by this way:

	 	pozice =0;
  		adresa = 0x0A;
		data = 0x3F;
		data2 = 0x10;
		xdat =adresa ^ data ^ data2;
		//xdat = 0x25;

but the output is not XOR of this data.
I also find another interest thing:
	 	pozice =0;
  		adresa = 0x0A;
		data = 0x3F;
		data2 = 0x10;
		xdat = adresa;
		xdat ^= data ;
		xdat ^= data2;//adresa ^ data ^ data2;
		xdat = 0x25;
In xdat isnt 0x25. I currently havent JTAG and RS232 working, so i dont know the value of xdat, but im %100 sure that is not 0x25. If I commented xdat = adresa, xdat ^= data(2).... its working. Otherwise this way of xoring data its not working also.

Jirka

Parents
  • OK I made copule other test and diasslembly ferquency output and i find this:

    xdat = (data2 ^ data ^ adresa);
    

    deletes values in data2, data, adresa
    ( this values are in output zeros ) and xor is OK . If i use this:

      		adresa = 0x0A;
    		data = 0x3F;
    		data2 = 0x90;
    
    		xdat = (data2 ^ data ^ adresa);
    		adresa = 0x0A;
    		data = 0x3F;
    		data2 = 0x90;
    
    

    its working. So whats wrong?

Reply
  • OK I made copule other test and diasslembly ferquency output and i find this:

    xdat = (data2 ^ data ^ adresa);
    

    deletes values in data2, data, adresa
    ( this values are in output zeros ) and xor is OK . If i use this:

      		adresa = 0x0A;
    		data = 0x3F;
    		data2 = 0x90;
    
    		xdat = (data2 ^ data ^ adresa);
    		adresa = 0x0A;
    		data = 0x3F;
    		data2 = 0x90;
    
    

    its working. So whats wrong?

Children