Santhosh Gowda

changing in global variable value -  MC9S08GB60

Discussion created by Santhosh Gowda on Jul 21, 2008
Latest reply on Jul 21, 2008 by Eckhard Gosch
hi,
 
I'm using HCS08 family controller(MC9S08GB60).In the code i'm using some global variables like x,y,z.The values of global variable changes as required.But while executing following statement (mathematical) the values of global variable changes to unknown value.The statement is as below
 
 a=(unsigned long int)((vtg_r_max1 * vtg_r_max1)+(vtg_y_max1 * vtg_y_max1)+(vtg_r_max1 * vtg_y_max1));
              
 b=(unsigned long int)((vtg_y_max1 * vtg_y_max1)+(vtg_b_max1 * vtg_b_max1)+(vtg_y_max1 * vtg_b_max1));
              
 c=(unsigned long int)((vtg_b_max1 * vtg_b_max1)+(vtg_r_max1 * vtg_r_max1)+(vtg_b_max1 * vtg_r_max1));
              
The above statement is just in the form of (a2+b2+ab).And the global variable x,y,z have no relationship with this expression.
 
Can you suggest me the sollution for changes in global variable value upon executing each expression.
 
With regards
        santhu
 
 
Added p/n to subject.
 


Message Edited by NLFSJ on 2008-07-24 07:28 AM

Outcomes