Sep 2, 2013 #1 Raady Here Full Member level 5 Joined Jun 8, 2013 Messages 242 Helped 26 Reputation 52 Reaction score 26 Trophy points 28 Location India Activity points 1,571 Hi , I am trying to update variables based on scanned letters from a function which scans the keypad. Code: // code for Keypad.c extern Xaxis,Yaxis,Zaxis; const unsigned char character[] = {'M' ,'1' ,'2' ,'3' ,'U' ,'4' ,'5' ,'6' ,'D' ,'7' ,'8' ,'9' ,'E' ,'S' ,'0' ,'C'}; Keypadscan() { { // ... cKeyPad = character[ii]; // ... } if(cKeyPad == 'M') Xaxis = 1; if(cKeyPad == 'C') Xaxis = 0; if(cKeyPad == 'U') { if(Yaxis > 0 ) Yaxis++; } cKeyPad = 0; } If I press M & C xaxis is getting updated. And If I press U I get a link error Link Error: Cannot access symbol (_Yaxis) at an odd address. I tried interchanging values of M to U but still the error persists. Where could I be wrong ? dspic30f5011/MPLAB 8.8v Regards, Raady.
Hi , I am trying to update variables based on scanned letters from a function which scans the keypad. Code: // code for Keypad.c extern Xaxis,Yaxis,Zaxis; const unsigned char character[] = {'M' ,'1' ,'2' ,'3' ,'U' ,'4' ,'5' ,'6' ,'D' ,'7' ,'8' ,'9' ,'E' ,'S' ,'0' ,'C'}; Keypadscan() { { // ... cKeyPad = character[ii]; // ... } if(cKeyPad == 'M') Xaxis = 1; if(cKeyPad == 'C') Xaxis = 0; if(cKeyPad == 'U') { if(Yaxis > 0 ) Yaxis++; } cKeyPad = 0; } If I press M & C xaxis is getting updated. And If I press U I get a link error Link Error: Cannot access symbol (_Yaxis) at an odd address. I tried interchanging values of M to U but still the error persists. Where could I be wrong ? dspic30f5011/MPLAB 8.8v Regards, Raady.
Sep 2, 2013 #2 M MKVRAJU Junior Member level 2 Joined Jun 14, 2013 Messages 20 Helped 1 Reputation 2 Reaction score 1 Trophy points 3 Activity points 160 hii. You aren't declaring a type for the extern variables, the compiler probably assumes they are 16 bit However, if they are actually bytes then they can be at an odd address which then fails in your function.
hii. You aren't declaring a type for the extern variables, the compiler probably assumes they are 16 bit However, if they are actually bytes then they can be at an odd address which then fails in your function.