迅维网

查看: 1695|回复: 1
打印 上一主题 下一主题

STM8S学习之PD口流水灯GPIO库函数熟悉

[复制链接]
跳转到指定楼层
1#
发表于 2016-3-21 09:58:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式 来自: 山东青岛 来自 山东青岛

马上注册,获取阅读精华内容及下载权限

您需要 登录 才可以下载或查看,没有帐号?注册

x
/**

  ******************************************************************************
  * @file    Project/main.c
  * @author  MCD Application Team
  * @version V2.1.0
  * @date    18-November-2011
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */


/* Includes ------------------------------------------------------------------*/

#include "stm8s.h"

/* Private defines -----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
#define LED_GPIO_PORT  (GPIOE)
#define LED_GPIO_PINS  (GPIO_PIN_5)
void Delay(uint16_t nCount)
{
  /* Decrement nCount value */
  while (nCount != 0)
  {   
    nCount--;
  }
}
void main(void)
{
  /* Initialize I/Os in Output Mode */
  //GPIO_Init(LED_GPIO_PORT, (GPIO_Pin_TypeDef)LED_GPIO_PINS, GPIO_MODE_OUT_PP_LOW_FAST);

  GPIO_Init(GPIOE, GPIO_PIN_5, GPIO_MODE_OUT_PP_HIGH_FAST);
  GPIO_Init(GPIOD, GPIO_PIN_ALL, GPIO_MODE_OUT_OD_LOW_FAST);
  while (1)
  {
    /* Toggles LEDs */
    //GPIO_WriteReverse(LED_GPIO_PORT, (GPIO_Pin_TypeDef)LED_GPIO_PINS);
    //GPIO_WriteReverse(GPIOE, GPIO_PIN_5);
    GPIO_Write(GPIOE, 0x20);
    GPIO_Write(GPIOD, 0xFE);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0xFD);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0xFB);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0xF7);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0xEF);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0xDF);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0xBF);
    Delay(0xFFFF);
    GPIO_Write(GPIOD, 0x7F);
    Delay(0xFFFF);
    GPIO_Write(GPIOE, 0x00);
    Delay(0xFFFF);
    Delay(0xFFFF);
    Delay(0xFFFF);
  }

}

#ifdef USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *   where the assert_param error has occurred.
  * @param file: pointer to the source file name
  * @param line: assert_param error line source number
  * @retval : None
  */
void assert_failed(u8* file, u32 line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/





2#
发表于 2016-7-13 14:34:23 | 只看该作者 来自: 海南五指山 来自 海南五指山
这流水灯好非常复杂 !!!

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表
附近
店铺
微信扫码查看附近店铺
维修
报价
扫码查看手机版报价
信号元
件查询
点位图 AI维修
助手



芯片搜索

快速回复