描述
本文来源电子发烧友社区,作者:mameng, 帖子地址:
https://bbs.elecfans.com/jishu_2297540_1_1.html收到有一家国产32位单片机开发板: 开发板做工不错哦,全部引脚引出:
-
3 颗 LED: - 电源指示灯(LED3),用户指示灯(LED1,LED2)
-
三个轻触开关: - 复位轻触开关(S3),用户轻触开关(S1,S2)
-
USB 转串口芯片(CH340N)
-
FLASH 芯片(W25Q64JVSSIQ)
-
EEPROM 芯片(CW24C02AD)
芯片特性:MCU可以接收4 ~ 32MHz 晶体振荡器,相对比STM32f1不能超过16M,芯片超频看来可以的。SDK 工程案例demo丰富,容易上手,SDKIdeSupportMDK有WHXY.CW32F030_DFP.1.0.3.pack也有IAR配置文件。支持IAR MDK。完美!点灯程序
-
void Delay(uint16_t nCount);
-
/**
-
******************************************************************************
-
** brief Main function of project
-
**
-
** return uint32_t return value, if needed
-
**
-
** LED1, LED2闪烁
-
**
-
******************************************************************************/
-
int32_t main(void)
-
{
-
GPIO_InitTypeDef GPIO_InitStruct;
-
-
RCC_HSI_Enable(RCC_HSIOSC_DIV6);
-
__RCC_GPIOB_CLK_ENABLE();
-
-
GPIO_InitStruct.IT = GPIO_IT_NONE;
-
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
-
GPIO_InitStruct.Pins = LED_GPIO_PINS;
-
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-
-
GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct);
-
-
while (1)
-
{
-
GPIO_TogglePin(LED_GPIO_PORT, LED_GPIO_PINS);
-
Delay(0xFFFF);
-
}
-
}
-
-
/**
-
* [url=home.php?mod=space&uid=2666770]@Brief[/url] 循环延时
-
*
-
* [url=home.php?mod=space&uid=3142012]@param[/url] nCount
-
*/
-
void Delay(__IO uint16_t nCount)
-
{
-
/* Decrement nCount value */
-
while (nCount != 0)
-
{
-
nCount--;
-
}
-
}
-
-
/******************************************************************************
-
* EOF (not truncated)
-
******************************************************************************/
-
#ifdef USE_FULL_ASSERT
-
/**
-
* [url=home.php?mod=space&uid=2666770]@Brief[/url] Reports the name of the source file and the source line number
-
* where the assert_param error has occurred.
-
* [url=home.php?mod=space&uid=3142012]@param[/url] file: pointer to the source file name
-
* @param line: assert_param error line source number
-
* [url=home.php?mod=space&uid=1141835]@Return[/url] None
-
*/
-
void assert_failed(uint8_t *file, uint32_t line)
-
{
-
/* USER CODE BEGIN 6 */
-
/* User can add his own implementation to report the file name and line number,
-
tex: printf("Wrong parameters value: file %s on line %drn", file, line) */
-
/* USER CODE END 6 */
-
}
-
#endif /* USE_FULL_ASSERT */
-
复制代码
总结:SDK官方写的比较全面,代码规整。芯片功能齐全,性能稳定,可以取代国外同类IC。点灯视频:体验视频详见作者原文章内容。
打开APP阅读更多精彩内容