#include "stm32f10x.h"
void main(void)
{
// GPIO구조체 선언
GPIO_InitTypeDef GPIO_InitStructure;
// APB2_GPIOF를 ENABLE
참고 http://munshark.tistory.com/100
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE);
/* GPIOF포트의 6번핀과 7번핀을
50MHz의 속도와 push-pull로 설정 후 초기화 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOF, &GPIO_InitStructure);
while(1)
{
// GPIOF포트의 6번핀과 7번핀을 셋
GPIO_WriteBit(GPIOF, GPIO_Pin_6 | GPIO_Pin_7 , Bit_SET);
for(uint32_t i = 0 ; i < 72000000/16 ; i++)
{
__NOP();
}
// GPIOF포트의 6번핀과 7번핀을 리셋
GPIO_WriteBit(GPIOF, GPIO_Pin_6 | GPIO_Pin_7, Bit_RESET);
for(uint32_t i = 0 ; i < 72000000/16 ; i++)
{
__NOP();
}
}
}
'프로그래밍' 카테고리의 다른 글
ARM데이터시트_SysTick Timer 레지스터(STK_CTRL/STK_LOAD/STK_VAL) (0) | 2016.12.18 |
---|---|
ARM데이터시트_Systick 우선순위 및 발생 시점 (0) | 2016.12.18 |
ARM데이터시트_GPIOx_IDR 입력(input)제어 (0) | 2016.12.11 |
ARM실습_GPIOx_IDR 레지스터를 이용한 스위치 입력 (0) | 2016.12.11 |
ARM데이터시트_GPIOx_BSRR/GPIOx_BRR (0) | 2016.12.08 |
댓글