STM3210B 보드에 있는 LED 점멸하기(GPIO)
/***************************************
STM3210B LED blinky
LED : PC6~PC9
Author : 손창한.
*****************************************/
#include <stm32f10x.h>
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure; //구조체 변수 선언
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); //클럭 연결
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //출력설정
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; //클럭속도
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIOC->ODR &= ~(GPIO_Pin_6|GPIO_Pin_7); //LED 6,7 off
GPIOC->ODR |= GPIO_Pin_8|GPIO_Pin_9; //LED 8,9 on
while(1){
GPIOC->ODR ^= GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9; //반전
for(vu32 t=0;t<2000000;t++); //delay
}
}