I got this arduino shield with four 7 segment display what I'm trying to make work with STM32 nucleo. The displays are driven with two 74HC595 shift registers.
I wrote the following code to control it, but somehow it doesn't work, always shows the same pattern whatever I modify in the array.
int digits[16] = {1,1,1,1,1,0,1,0,1,0,1,1,0,1,1,0}; while (1) { HAL_GPIO_WritePin(STCP_GPIO_Port, STCP_Pin, GPIO_PIN_RESET); for(int i=0;i>=15;i--) { HAL_GPIO_WritePin(SHCP_GPIO_Port, SHCP_Pin, GPIO_PIN_RESET); if(digits[i]==1) { HAL_GPIO_WritePin(DS_GPIO_Port, DS_Pin, GPIO_PIN_SET); }else { HAL_GPIO_WritePin(DS_GPIO_Port, DS_Pin, GPIO_PIN_RESET); } HAL_GPIO_WritePin(SHCP_GPIO_Port, SHCP_Pin, GPIO_PIN_SET); } HAL_GPIO_WritePin(STCP_GPIO_Port, STCP_Pin, GPIO_PIN_SET); } SHCP: Shift register clock
STCP: Storage register Clock
DS: Data
What could be the problem?