2023-02-23 07:26 AM
//////////////////refresh pin
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_11,GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_11,GPIO_PIN_RESET);
HAL_Delay(10);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_12,GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_12,GPIO_PIN_RESET);
HAL_Delay(10);
/////////////////////out put
HAL_GPIO_WritePin(GPIOA,0x00ff,GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA,digit[i],GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA,digit[j]<<4,GPIO_PIN_SET);
HAL_Delay(1000);
////////////////////counter
i++;
if(i==10){
j++;
i=0;
if(j==10){
i=0;
j=0;
}
unsigned char digit[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
2023-02-23 07:46 AM
We don't know where you wrote wrong in your code, either, as we don't even see your code.
Anyway, debug as usually. And separate the problem to pieces: first, write a simple program which counts into a variable in memory; and then write a simple program which displays any chosen number to the 7-segments. Then put them together.
JW
2023-02-23 07:48 AM
this is my code but i don't find mistake.
//////////////////refresh pin
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_11,GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_11,GPIO_PIN_RESET);
HAL_Delay(10);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_12,GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_12,GPIO_PIN_RESET);
HAL_Delay(10);
/////////////////////out put
HAL_GPIO_WritePin(GPIOA,0x00ff,GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA,digit[i],GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA,digit[j]<<4,GPIO_PIN_SET);
HAL_Delay(1000);
////////////////////counter
i++;
if(i==10){
j++;
i=0;
if(j==10){
i=0;
j=0;
}
unsigned char digit[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
2023-02-23 05:27 PM
2023-02-23 07:12 PM
There are 7 segments, not 4
Identify exactly which pins connect to with elements, or which displays