- 1、本文档共10页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
stm32编程须知(国外英文资料)
stm32编程须知(国外英文资料)
Stm32 programming:
Number one: engineering templates are right
Second: the program should configure the system clock first
Configure the external clock
And then were going to start out
Third: start coding and loop
The declaration of the variable cannot be placed behind the executable, and must be declared in the beginning.
For example, to move GPIO_InitTypeDef GPIO_InitStructure to SystemInit ().
* * * * * * * * *
* * * * * * * * * * * * * * * * * * * * *
/ / configure system clock and peripherals
Void RCC_Configuration (void)
{
SystemInit (); / / system clock configuration
The rcc_apb2periph-clockcmd (RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA)
| RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC
| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE
| RCC_APB2Periph_ADC1 | RCC_APB2Periph_AFIO
| RCC_APB2Periph_SPI1, ENABLE);
/ / rcc_apb2periph.cmd (RCC_APB2Periph_ALL, ENABLE);
RCC_APB1PeriphClockCmd (RCC_APB1Periph_TIM4
| RCC_APB1Periph_USART3 | RCC_APB1Periph_TIM2
To ENABLE);
(RCC_AHBPeriph_DMA1, ENABLE);
}
* * * * * * * * *
In the PC tube feet, for example
An empty input gpio_in_float - an empty input that can be used for KEY recognition, RX1
Take the pull of the GPIO_Mode_IPU -- the input of the resistance inside the IO
Take the dropdown and enter GPIO_Mode_IPD -- the internal drop-down resistance input
Simulate the input GPIO_Mode_AIN - apply ADC to simulate input, or lower power consumption to save power
5, the output GPIO_Mode_OUT_OD -- IO output 0 to GND, IO output 1, overhang, need external pull resistance to achieve the output high level. When the output is 1, the state of the IO mouth pull up resistors by the higher level, but is open drain output mode, so IO mouth also can be changed by external circuit for low level or the same. You can read the IO input level changes and implement C51s IO bi-directional functions
Push pull output GPIO_Mode_OUT_PP - IO output 0 - GND, IO output 1 - VCC, read the input value is unknown
The push-pull output GPIO_Mode
文档评论(0)