# HELP with seven segment refresh

Discussion created by lpcware on Jun 15, 2016
Content originally posted in LPCWare by pindonga123 on Sun Nov 03 05:35:47 MST 2013
Hello. I have some problems and some doubt about seven segment refresh. I did two programs. One shows me the number 0 to 9 in the 6 digit that i have, it work very well. And other program that show me a numer for example 576837, it dont work very well because the digit are tenuous. When I execute the two programs only shows me the first. Theory says that in the second case, each digit have to turn on each 1/6=166 mseg, but it dont work. How is the correct sequence?. Clear the display---Turn the display---Pause?, Is it the general rule?
Here my code

int main(void)
{
set_pines();
Set_SysTick ();
while(1)
{
mostrar_dig (564738);
}
return 0 ;
}

void Set_SysTick (void)
{
SYSTICK_InternalInit (1);
SYSTICK_Cmd (ENABLE);
SYSTICK_IntCmd (ENABLE);
}

void SysTick_Handler (void)
{
SysTickCnt++;
}

void Delay (float tick)
{
unsigned long systickcnt;
systickcnt = SysTickCnt;
while ((SysTickCnt - systickcnt) < tick);
}

{
signed int i, j;
for (i=0; i<=9; i++)
{
for (j=0; j<=1; j++)
{
GPIO_ClearValue (0, clear);
Delay (200);
GPIO_SetValue (0, vector_b0);
GPIO_SetValue (0, vector_b1);
GPIO_SetValue (0, vector_b2);
GPIO_SetValue (0, vector_b3);
GPIO_SetValue (0, vector_b4);
GPIO_SetValue (0, vector_b5);
Delay (200);
}
}
}

void mostrar_dig (unsigned long num)
{
int i=0, vect; /*vect  lo declaraba como unsigned long y no funcionaba el programa. Porque?*/
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;
}
}
}
{"ft_lang_label":"__label__en","ft_lang_prob":0.5190401,"math_prob":0.92584217,"size":4223,"snap":"2019-35-2019-39","text_gpt3_token_len":1327,"char_repetition_ratio":0.20905428,"word_repetition_ratio":0.9721362,"special_character_ratio":0.35661852,"punctuation_ratio":0.25526932,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96477807,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-15T18:42:46Z\",\"WARC-Record-ID\":\"<urn:uuid:69d9dbd4-0802-481c-b341-fdd24d704613>\",\"Content-Length\":\"82401\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f7b4b665-724c-4336-ba91-0febbf8f9d1c>\",\"WARC-Concurrent-To\":\"<urn:uuid:4e9229bc-847f-4546-854a-7973a43b4f5f>\",\"WARC-IP-Address\":\"104.119.26.39\",\"WARC-Target-URI\":\"https://community.nxp.com/thread/417735\",\"WARC-Payload-Digest\":\"sha1:P2WAEKZQAT7AAH6XUJZKPZA2WVH5EAMT\",\"WARC-Block-Digest\":\"sha1:3G5DRYBRURZHHNJ2XQUXNKNBKKIZSMHX\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514572235.63_warc_CC-MAIN-20190915175150-20190915201150-00425.warc.gz\"}"}