The invention discloses a method for using the hardware watchdog monitoring channel inspection and CAN communication, which comprises the following steps: collecting the speed signal system turns channel input, realizing channel inspection, data exchange, judging every channel inspection and CAN communication is successful, if the channel switching and CAN communication are also successful with the computer CAN communication mode, the program to feed the dog once, if the channel switching or CAN communication is not successful, it will cease to feed the dog, the dog when the stop time exceeds the set, the hardware watchdog will automatically reset signal, the MCU receives the reset signal will reset to restart the system. The invention can not affect the software system, even if the software crash is still able to achieve the function, not by the interference of external factors, automatically generates a reset signal hardware, so that the device has good self repairing ability. It ensures the stability and high reliability of the multi-channel speed monitoring system.
【技术实现步骤摘要】
一种利用硬件看门狗监控通道巡检和CAN通信的方法
本专利技术属于一种数字监控方法,具体涉及一种利用硬件看门狗监控通道巡检和CAN通信的方法。
技术介绍
目前看门狗这项技术已经在控制系统中有广泛应用,其原理就是系统在正常运行时,能定期的对看门狗输出清零命令,此过程称之为喂狗,若系统出现故障,超过设定时间没有对看门狗输出清零命令,则看门狗会超时溢出,此时它会发出一个低电平复位信号,使单片机复位重启,从而起到恢复系统运行的作用。看门狗又分为硬件看门狗和软件看门狗,硬件看门狗是利用一个独立的定时器电路,应用程序在执行过程中,每隔一定的时间需要通过中央处理器对定时器进行清零,使看门狗电路不溢出。因此程序在正常工作时,可以及时对定时器清零,保证看门狗电路不溢出;如果程序出现故障,就不能及时对定时器清零,这将导致看门狗电路溢出,产生复位信号,使单片机复位。一般硬件看门狗(Watchdog)包括喂狗输入引脚(WDI,WatchDogInput)和看门狗输出引脚(WDO,WatchDogOutput),单片机一般会定期向看门狗输入引脚WDI输入喂狗信号,相应的看门狗输出引脚WDO会输出高电平,如果看门狗输入引脚WDI没有定期收到喂狗信号,看门狗输出引脚WDO会输出低电平,而WDO引脚单片机的手动复位引脚(MR,ManualReset)相连,此时单片机就会被复位。软件看门狗,是以中央处理器的内部时钟取代采用硬件实现的定时器来定期执行喂狗操作,简化硬件电路设计,当系统故障,没有执行喂狗,看门狗发生溢出时,也能输出低电平复位信号给手动复位引脚(MR,ManualReset),使单 ...
【技术保护点】
一种利用硬件看门狗监控通道巡检和CAN通信的方法,其特征在于:包括以下步骤:(ⅰ)监控装置运行期间,系统轮流采集各通道输入的转速信号,实现通道巡检,同时也与计算机通过CAN通信的方式进行数据交流(S1);(ⅱ)判定每次通道巡检和CAN通信是否成功(S2);(ⅲ)如果通道切换和CAN通信都成功,程序就喂狗一次(S3);(ⅳ)如果通道切换或者CAN通信没有成功,程序就停止喂狗(S4);(ⅴ)当停止喂狗超过设定时间,硬件看门狗(2)就自动发出复位信号(S5);(ⅵ)单片机接收到复位信号就会复位重启系统(S6)。
【技术特征摘要】
1.一种利用硬件看门狗监控通道巡检和CAN通信的方法,其特征在于:包括以下步骤:(ⅰ)监控装置运行期间,系统轮流采集各通道输入的转速信号,实现通道巡检,同时也与计算机通过CAN通信的方式进行数据交流(S1);(ⅱ)判定每次通道巡检和CAN通信是否成功(S2);(ⅲ)如果通道切换和CAN通信都成功,程序就喂狗一次(S3)...
【专利技术属性】
技术研发人员:史晓清,孙富志,宋涛,
申请(专利权)人:核工业理化工程研究院,
类型:发明
国别省市:天津,12
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。