problem with wif.

void States(char CS)
{
  switch(CS)
  {
  case 0:  
    break;
  case 1:

It is highly unlikely that you are sending 0, 1, 2, etc. It is far more likely that you are sending '0', '1', '2', etc.