You are on page 1of 1

/*Embeddedc Program to make the PortB(0 t0 7 bits) high and low in an infinite l oop*/ /*one end of LED's on the

board are connected to Vcc*/ #include"stm32f10x_lib.h" GPIO_InitTypeDef GPIO InitStructure; void delay(Vu32 ncount); int main(void) { //Pheripheral bus clock enable APB2 Rcc_APB2PeriphClockCmd(Rcc_APB2Periph_GPIOA/Rcc_APB2eriph_GPIOB/Rcc_APB2Periph_A FIO, ENABLE); GPIO_pinRemapConfig(GPIO_Remap_SWJ_Disable_ENABLE);// Functioning I/O GPIO_InitStructure.GPIO_pin=GPIO_pin_ALL;//select all feet GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_pp;//configured as a pushpull output GPIO_Initstructure.GPIO_Speed=GPIO_Speed_50MHZ;// outputmode, I/O output speed 5 0MHZ GPIO_Init(GPIOB, &GPIO_InitStructure);// PortB Initiolization GPIO_write(GPIOB, 0Xffff);//configure PortB as o/p port while(1) { GPIO_Write(GPIOB,0Xffff);//Write a word data(0Xff) to the PB port dlay(0X10000F); GPIO_Write(GPIOB,0X0000); //Write a word data(0x00) to the PB port delay(0X10000F); } } void dealy(Vu32 ncount) { for( ;ncount!=0;ncount--); }

You might also like