This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

about structs

Hi,
I am new to C and Keil, However I wish to know more about the c programming in keil especially developing programs for STM32. My question is about USART1. I see that in file named stm32f10x_map.h definition for USART is given like:

typedef struct
{
  vu16 SR;
  u16  RESERVED0;
  vu16 DR;
  u16  RESERVED1;
  vu16 BRR;
  u16  RESERVED2;
  vu16 CR1;
  u16  RESERVED3;
  vu16 CR2;
  u16  RESERVED4;
  vu16 CR3;
  u16  RESERVED5;
  vu16 GTPR;
  u16  RESERVED6;
  vu16 hamed;
} USART_TypeDef;


and also USART1 is defined as a pointer to this struct like:

#ifdef _USART1
  EXT USART_TypeDef           *USART1;
#endif /*_USART1 */


but later I see in file USART.c a command like:

USART1->SR &= ~USART_FLAG_RXNE


My question is that where does SR defined for the compiler? as I see it is only defined as a vu16 type in USART_TypeDef. Does compiler differ between SR and DR or BRR ,etc.? How?