Andrei Boeru

JM Badge Board Applications - small mistake

Discussion created by Andrei Boeru on Dec 27, 2008
I found a little mistake in the demo Applications. In the file accelerometer.c starting from line 486, the original code is:
switch(sensitivity)
  {
    case Range15g:
      PTCD_PTCD4 = 0; 
      PTCD_PTCD5 = 0;
      break;
    case Range2g:
      PTCD_PTCD4 = 0; 
      PTCD_PTCD5 = 1;
      break;
    case Range4g:
      PTCD_PTCD4 = 1; 
      PTCD_PTCD5 = 0;
      break;
    case Range6g:
      PTCD_PTCD4 = 1; 
      PTCD_PTCD5 = 1;
      break;
    default:
      PTCD_PTCD4 = 0; 
      PTCD_PTCD5 = 0;
      break;                 
  }

The problem is that Range2g and Range4g are misplaced. So the correct code would be
switch(sensitivity)
  {
    case Range15g:
      PTCD_PTCD4 = 0; 
      PTCD_PTCD5 = 0;
      break;
    case Range4g:
      PTCD_PTCD4 = 0; 
      PTCD_PTCD5 = 1;
      break;
    case Range2g:
      PTCD_PTCD4 = 1; 
      PTCD_PTCD5 = 0;
      break;
    case Range6g:
      PTCD_PTCD4 = 1; 
      PTCD_PTCD5 = 1;
      break;
    default:
      PTCD_PTCD4 = 0; 
      PTCD_PTCD5 = 0;
      break;                 
  }

Happy coding!


Message Edited by Andrei Boeru on 2008-12-27 01:00 AM

Outcomes