2021-10-14 12:32 PM
Hi Experts,
I have a project like below. I am trying to send the data but the LEDS are not glowing in sending pattern.
I am new to STM32F207 Nucleo board. Could anyone please let me know if I am missing anything.
STM32f207 ======> CD4094(Q0) ==========> 74HC595 =====> LEDS (1 to 8)
(Q1) ==========> 74HC595 =====> LEDS (1 to 8)
(Q2) ==========> 74HC595 =====> LEDS (1 to 8)
Code Snippet::
===============
uint8_t test[8]= {1,1,1,0,1,0,1,1};
uint8_t output=0,count =0;
for(int row=0;row<8;row++)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);/*STROBE PIN */
count = 0;
for(int bit=0;bit<8;bit++)
{
if(count>6)/* TO DISPLAY FIRST 8 LEDS IN 74HC595(Q0)*/
{
output = test[row] & 0X1;
}
else
{
output = 0;
}
count = count+1;
if(output)
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_SET);/*DATA PIN */
}
else
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_RESET);
}
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_RESET);/*CLK PIN */
HAL_Delay(1);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET);
HAL_Delay(1);
}
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);
HAL_Delay(1);
}
WORKING SCNERAIO
=================
STM32f207 ======> CD4094(Q0-Q7) =====> LEDS (1 to 8)
uint8_t test[8]= {1,1,1,0,1,0,1,1};
uint8_t output=0,count =0;
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);/*STROBE PIN */
count = 0;
for(int bit=0;bit<8;bit++)
{
if(count>5)/* TO DISPLAY FIRST 2 LEDS IN 4094*/
{
output = test[row] & 0X1;
}
else
{
output = 0;
}
if(output)
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_SET);/*DATA PIN */
}
else
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_RESET);
}
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_RESET);/*CLK PIN */
HAL_Delay(1);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET);
HAL_Delay(1);
}
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);