码迷,mamicode.com
首页 > 其他好文 > 详细

STM8 亮灯程序

时间:2017-08-08 00:24:06      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:color   nbsp   in out   scl   pre   file   nic   pull   out   

 

/* MAIN.C file
 *
 * Copyright (c) 2002-2005 STMicroelectronics
 */

#include <stm8s.h>
#include <stm8s_clk.h>
#include <stm8s_gpio.h>

void Init_GPIO(void)
{
    /*** Initialize I/Os in Output Mode Push-Pull ***/
    /* LEDs 2, 3, 4 */
   // GPIO_Init(GPIOB, (GPIO_PIN_4 | GPIO_PIN_5), GPIO_MODE_OUT_PP_LOW_FAST);
    GPIO_Init(GPIOC, GPIO_PIN_4, GPIO_MODE_OUT_PP_LOW_FAST);

    //GPIO_WriteHigh(GPIOB, (GPIO_PIN_4 | GPIO_PIN_5));
    GPIO_WriteHigh(GPIOC, GPIO_PIN_4);
}

void Init_Clock(void)
{

    /* Select fCPU = 16MHz */
    CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV1);

    /* For test purpose output Fcpu on MCO pin */
    //CLK_CCOConfig(CLK_OUTPUT_CPU);

}

void Delay(vu16 nCount)
{
    /* Decrement nCount value */
    while (nCount != 0)
    {
        nCount--;
    }
}

main()
{
    //Init_Clock();
    Init_GPIO();

    while (1) {
        GPIO_WriteReverse(GPIOC,GPIO_PIN_4);

        Delay(0xFFFF);
    }
}

 

STM8 亮灯程序

标签:color   nbsp   in out   scl   pre   file   nic   pull   out   

原文地址:http://www.cnblogs.com/icoolno1/p/7302332.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!