Home > other >  Rookie question main. New c (18) : error: # 44: expression must have pointer type
Rookie question main. New c (18) : error: # 44: expression must have pointer type

Time:12-06

Want to learn to use the register output light emitting tube, in the final four tips to the main function pointer, where adjustment


# include "stm32f10x_gpio. H"
//# include "stm32f10x. H"

Int main ()
{
RCC_APB2ENR |=(1 & lt; <5);
GPIOD_CRL & amp;=~ (0 x0f & lt; <4 * 6);
GPIOD_CRL |=(1 & lt; <24);
GPIOD_ODR |=(1 & lt; <6);

//RCC_APB2ENR |=(1 & lt; <4);
//GPIOC_CRL & amp;=~ (0 x0f & lt; <4 * 6);
//GPIOC_CRL |=(1 & lt; <4 * 6);
//GPIOC_ODR |=(1 & lt; <6);
RCC - & gt; APB2ENR |=(1 & lt; <4);
GPIOC - & gt; CR & amp;=~ (0 x0f & lt; <4 * 6);
GPIOC - & gt; CR |=(1 & lt; <4 * 6);
GPIOC - & gt; The ODR |=(1 & lt; <6);

}




# define RCC_APB2ENR * (unsigned int *) 0 x40021018
# define GPIOD_CRL * (unsigned int *) 0 x40011400
# define GPIOD_ODR * (unsigned int *) 0 x4001140c//PD6 lights


//# define GPIOC_CRL * (unsigned int *) 0 x40011000
//# define GPIOC_ODR * (unsigned int *) 0 x4001100c

Typedef unsigned int uint32_t;

# define PERIPH_BASE 0 x40000000
# define APB2PERIPH_BASE (PERIPH_BASE + 0 x10000)
# define AHBPERIPH_BASE (PERIPH_BASE + 0 x20000)//bus address variable definition


# define GPIOC_BASE APB2PERIPH_BASE + 0 x1000
# define GPIOC_CRL * (unsigned int *) (GPIOC_BASE + 0 x00)
# define GPIOC_ODR * (unsigned int *) (x0c GPIOC_BASE + 0)/address/port C variable definition

Typedef struct
{
Uint32_t CRL.
Uint32_t CRH.
Uint32_t ODR;
} GPIO_TypeDef;


# define RCC_BASE (AHBPERIPH_BASE + 0 x1000)
# define RCC_AHBENR * (unsigned int *) (RCC_BASE + 0 x18)

Typedef struct
{
Uint32_t CR;
Uint32_t APB2ENR;
} RCC_TypeDef;


# define RCC ((GPIO_TypeDef *) RCC_BASE)
# define GPIOC GPIOC_BASE GPIO_TypeDef (*)

CodePudding user response:

Which passes by brother to look at the bai

CodePudding user response:

Didn't see what problem, the include files is wrong

CodePudding user response:

Int main ( void

Keil arm programming is the virtue

CodePudding user response:

At present situation, the useless structure devices for compilation can be normal output light,
Change into the following four last sentence, the compiler will not complain, but no result
RCC (*). APB2ENR |=(1 & lt; <4);
(* GPIOC). The CRL & amp;=~ (0 x0f & lt; <4 * 6);
(* GPIOC). The CRL |=(1 & lt; <4 * 6);
(* GPIOC). The ODR |=(1 & lt; <6);

CodePudding user response:

Places they found the problem, the # define GPIOC (GPIO_TypeDef *) GPIOC_BASE without parentheses, and there will be no requirement pointer errors, there is no output for structure members in accordance with the manual in order to add, make the address of the structure is not enough, call address corresponding to the error, according to the order, after add compiled output is normal,
  • Related