lpcware

URGENT HELP with code on 1769

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by pindonga123 on Sun Nov 03 03:40:07 MST 2013
Hello. I did this code but something is wrong. I dont know where it's. I send a number of 1 to 6 digit and i wanna shows them in the 6 seven segment display. But when i send for example 2 all is ok, 24 too, 243 too, 2438 too, 24387 too. But the problem is that when i send the 6 digit sometime only show me 5 or sometime nothing. For example if i send 243879, only show me 43879 or something nothing. Here is the code. The problem is not in the display refresh, I did something probes more and it's ok, Is not in the display neither.

void mostrar_dig (unsigned long num)
{
unsigned long i=0, vect[5];
while (num > 0)
{
vect=num%10;
num=num/10;
i++;
}
i--;
while (i>=0)
{
switch (i)
{
case 0:
GPIO_ClearValue (0, clear);
GPIO_SetValue (0, vector_b0[vect]);
i--;
Delay (1);
break;
case 1:
GPIO_ClearValue (0, clear);
GPIO_SetValue (0, vector_b1[vect]);
i--;
Delay (1);
break;
case 2:
GPIO_ClearValue (0, clear);
GPIO_SetValue (0, vector_b2[vect]);
Delay (1);
i--;
break;
case 3:
GPIO_ClearValue (0, clear);
GPIO_SetValue (0, vector_b3[vect]);
i--;
Delay (1);
break;
case 4:
GPIO_ClearValue (0, clear);
GPIO_SetValue (0, vector_b4[vect]);
i--;
Delay (1);
break;
case 5:
GPIO_ClearValue (0, clear);
GPIO_SetValue (0, vector_b5[vect]);
Delay (1);
i--;
break;
default:
break;
}
}
}

Outcomes