Carl Norman

Bit compare using PTXD_PTAXX

Discussion created by Carl Norman on Jun 10, 2008
Latest reply on Jun 11, 2008 by Carl Norman
Sorry if this is very obvious, but why cant I do this

Please note, this is just illistrating the exor compare, nothing more. Using S08 processors, 5.9.0 codewarrior.

Code:
if(PTAD_PTAD1 ^ PTAD_PTAD2) dothis();  //If both the same dothis()else dothis1();          //If one bit is different dothis1()

 
If i do somthing like this, it works (dont use the predefined PTAD_PTAD1 directly):

Code:
uchar Temp1, Temp2;if(PTAD_PTAD1) Temp1 = 1;else Temp1 = 0if(PTAD_PTAD2) Temp2 = 1;else Temp2 = 0if(Temp1 ^ Temp2) dothis();else dothis1();

 
I am guessing its due to the way the PTAD_PTAD1 is setup in the header files? Whats the best way to do this without it getting so ugly?

Again, sorry if this is a simple lesson that I should already know.

Thanks,
Carl



Message Edited by CarlFST60L_3rd on 2008-06-10 11:38 AM

Outcomes