|
|||||||||||
|
Technical Support On-Line Manuals µVision4 User's Guide (Japanese) |
ソースファイルの新規作成
/*----------------------------------------------------------------------------
* Name: Blinky.c
* Purpose: LED Flasher for STM32
*---------------------------------------------------------------------------*/
#include <stm32f10x_lib.h> // STM32F10x Library Definitions
/*----------------------------------------------------------------------------
Wait function - delay flashing
*---------------------------------------------------------------------------*/
void wait (void) {
unsigned int countDown = 300000; // arbitrary int to count down
while(countDown--); // count down
}
/*----------------------------------------------------------------------------
MAIN function
*---------------------------------------------------------------------------*/
int main (void) {
unsigned int leds = 0x01; // declare and init LEDs
while (1) { // Loop forever
if (leds > 0x8000) (leds = 0x01); // check for max value
GPIOB->ODR = leds; // defined in library
leds <<= 0x1; // shift
wait(); // delay flashing
}
}
| ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.