请教下大家,上电后延时5S(防swim脚锁死),再把SWIM脚设成输出脚,让它能输出高低电平。但实测,这脚一直是高电平。是否我下面的设置,不足以让SWIM脚成功设成输出? /* 定义TXenable IO PORT与PIN SWIM */ #define TXenable_GPIO_PORT (GPIOD) #define TXenable_GPIO_PINS (GPIO_PIN_5) void SWIMset_IO(void) { /* 配置TXenable IO 为输出模式 */ GPIO_Init(TXenable_GPIO_PORT, (GPIO_Pin_TypeDef)TXenable_GPIO_PINS, GPIO_MODE_OUT_PP_HIGH_SLOW);//上电时不发射 } /** * @函数名 AutoCHK * @功 能 * @参 数 无 * @返回值 无 */ void AutoCHK(void) { GPIO_WriteLow(TXenable_GPIO_PORT,(GPIO_Pin_TypeDef)TXenable_GPIO_PINS); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); GPIO_WriteHigh(TXenable_GPIO_PORT,(GPIO_Pin_TypeDef)TXenable_GPIO_PINS); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); GPIO_WriteLow(TXenable_GPIO_PORT,(GPIO_Pin_TypeDef)TXenable_GPIO_PINS); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); GPIO_WriteHigh(TXenable_GPIO_PORT,(GPIO_Pin_TypeDef)TXenable_GPIO_PINS); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); } void main(void) { IoSetUp_Init(); /* LED初始化 */ LED_Init(); GPIO_WriteLow(LED_GPIO_PORT,LED_GPIO_PINS); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); GPIO_WriteHigh(LED_GPIO_PORT,LED_GPIO_PINS); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); Delay(0xFFFF); if(!GPIO_ReadInputPin(OUTPUTselect_GPIO_PORT, (GPIO_Pin_TypeDef)OUTPUTselect_GPIO_PINS)) OUTPUTmode=RESET;//RESET:有物高 else OUTPUTmode=SET; // SET: if ((GPIO_ReadInputData(EXTI_GPIO_PORT) & EXTI_GPIO_PINS) == 0x00)//无物 { GPIO_WriteHigh(LED_GPIO_PORT, LED_GPIO_PINS); if(OUTPUTmode==RESET) GPIO_WriteLow(OUTPUT_GPIO_PORT,OUTPUT_GPIO_PINS); else GPIO_WriteHigh(OUTPUT_GPIO_PORT,OUTPUT_GPIO_PINS); } else //有物 { GPIO_WriteLow(LED_GPIO_PORT, LED_GPIO_PINS); if(OUTPUTmode==RESET) GPIO_WriteHigh(OUTPUT_GPIO_PORT,OUTPUT_GPIO_PINS); else GPIO_WriteLow(OUTPUT_GPIO_PORT,OUTPUT_GPIO_PINS); } /* 外部中断初始化 */ EXTI_Init(); /* 使能总中断 */ enableInterrupts(); SWIMset_IO(); AutoCHK(); while (1) { ; } } |
STMS005K6T6 如何采集内部参考电压。
stm8s003 adc中断和通道切换的问题
adc施密特触发器stm8
stm8l051f3 TSSOP20 封装,待机模式下,2天后,电流突然增加到140UA
STM8S用STVP烧录怎么加密?
如何使用ST官网例程_LIN总线通讯_STM8AF
STM8 LIN
IAR代码编辑太费劲了,想问一下有没有好的方法,试了VScode但是头文件老是报错,调了很久也没调好,想换个方法了。
想问一下各位大佬,IAR下载调试代码时出现 warning: is an illegal data sample expression IAR是什么意思啊?
STM8S标准库TIM1编码器功能不计数,请大师帮我看看
评分
查看全部评分