Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Includes
- #include <stdint.h> //system header
- #include "stm32f407xx.h" // Non system headers use quotes
- //main
- int main(void)
- {
- ADC_TypeDef *pADC; //set the Type as a pointer
- RCC_TypeDef *pRCC;
- pADC = ADC1; //make the pointer address the same as ADC1
- pRCC = RCC;
- //enable clock
- pRCC->APB2ENR = pRCC->APB2ENR | (1 << 8); //set the 9th bit (bit8) to 1
- //or '1 shifted by 8' (starting from bit position 0)
- //access the peripheral register
- pADC->CR1 = 0x55; // -> is 'Member Access' and is used to access the members of pADC(ADC1)
- //CR! is the 'Control Register 1'
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement