AnsweredAssumed Answered

problem with 7 segment on stm32

Question asked by kazi.adeem on Oct 16, 2015
i am workin on diplaying no"s on 7 segment via stm32f072b
the problem is that the o/p is not appearing on the 7 segment
ive connected pins of 7 seg to gpioA and gpioC via a 3.3k resistor

the follwing is the code



#include "main.h"
//------------------------------------------------------------------------------
// Function Name : Init _GPIO pins
// Description : pins ,port clock & mode initialization.
//------------------------------------------------------------------------------
void Init_GPIO(void)
{
/* GPIO config */
GPIO_InitTypeDef GPIO_InitStructure;
/* GPIOA GPIOB clock enable */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOC, ENABLE);

/* Configure 8 ,9 PINS as input floating */
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 ;
/* Configure PORT clock speed */
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
/* Configure PORT mode as input */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
/*configure PINS to output pushpull mode*/
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
/* Above all GPIO instructions apply to port "C"*/
GPIO_Init(GPIOC, &GPIO_InitStructure);

/* Configure 8,9,10,11,12,13 pins as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 ;
;
/* Configure PORT clock speed */
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
/* Configure PORT mode as input */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
/*configure PINS to output pushpull mode*/
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
/* Above all GPIO instructions apply to port "B"*/
GPIO_Init(GPIOA, &GPIO_InitStructure);
}

/*******************************************************************************
* Function Name : main
* Description : Main program.
*******************************************************************************/
int main(void)
{
Init_GPIO(); //calling a function
while(1)//infinite loop
{
/*ODR bits can be individually set and reset */
//for displaying 0
GPIOA->ODR = 0x0007;
GPIOC->ODR = 0x0007;
}
}

 

Outcomes