恒美微站
首页
关于我们
建站服务
主题模板
案例展示
资讯中心
联系我们
STM32F108C8T6小白入门特训营__1.18 KEIL 软件 .C .H 程序格式编写
首页
资讯中心
/
STM32F108C8T6小白入门特训营__1.18 KEIL 软件 .C .H 程序格式编写
STM32F108C8T6小白入门特训营__1.18 KEIL 软件 .C .H 程序格式编写
发布时间:2026/8/18 14:39:08
/** **************************************************************************************************** * file plc.c * author Y_G * version V1.0 * date 2026-6-13 * brief 注意事项 .H 里面对应写 extern * license **************************************************************************************************** * attention *1. **************************************************************************************************** */ #include plc.h uint16_t X00, Y00 ; /** * brief Y_OUTPUT * retval None */ void Y_OUTPUT (void) { if(Y0) //读取PA0引脚是否为高电平 { HAL_GPIO_WritePin(Y0_GPIO_Port, Y0_Pin, GPIO_PIN_RESET);//把Y0引脚电平置底 led点 } else { HAL_GPIO_WritePin(Y0_GPIO_Port, Y0_Pin, GPIO_PIN_SET);//把Y0引脚电平置搞 led关闭 } } /** * brief X_INPUT * retval None */ void X_INPUT (void) { if (HAL_GPIO_ReadPin(X0_GPIO_Port,X0_Pin)SET) { X01; } else { X00; } }/** **************************************************************************************************** * file plc.h * author Y_G * version V1.0 * date 2024-11-19 * brief * license **************************************************************************************************** * attention 1..H 里面对应写 extern **************************************************************************************************** */ #ifndef __plc_H #define __plc_H /* -----------------------------------包含头文件----------------------------------------------- */ //cubemx 自动生成的头文件 #include main.h extern uint16_t X0,Y0; /******************** 外部接口函数*******************/ void Y_OUTPUT (void); void X_INPUT (void); #endifB站对应视频https://www.bilibili.com/video/BV16bu16WEYP?spm_id_from333.788.videopod.sectionsvd_source5e9f4d511896df920a31ed33c6d61570