摘要
针对一线总线读写时序过多占用微控制器(MCU)运算资源的问题,对一线总线器件异步读写方法进行了研究。以MCU作为一线总线器件的主控器,通过一个定时器的四个中断实现一线总线器件的读写时序。在进行一线总线数据读写前,MCU程序将读写内容译成相应的时序信息后以指令队列的形式存储。在一线总线读写过程中,定时器中断程序按事先存储于指令队列中的时序信息顺序修改定时器的计数器值,从而完成一线总线的异步读写。该方法将主要的延时工作交由定时器实现,最大程度地减少了CPU的占用率。
Aiming at the problem of read/write timing of 1-wire bus excessively occupies operational resources of microcontroller; the asynchronous read-write method of the 1-wire bus devices is researched. With MCU as the main controller of the 1-wire bus device, the read/ write time sequence of 1-wire bus device is implemented through four interrupts of one timer. Before performing data read/write of 1-wire bus, the contents of read/write are translated into corresponding timing information, and stored as instruction queue form by MCU program. During the read/write process of 1 -wire bus, the timing information sequence pre-stored in instruction queue is modified into counting value of the timer by the interrupt program in timer, thus the asynchronous read-write of 1-wire bus is completed. With this method, the major time delay is implemented by the timer, so the occupation rate of the CPU is minimized.
出处
《自动化仪表》
CAS
北大核心
2014年第1期88-91,共4页
Process Automation Instrumentation
基金
山东省科技发展计划基金资助项目(编号:2012GSF11606)
山东省教育厅课题基金资助项目(编号:J10LG17)
青岛市关键技术攻关计划基金资助项目(编号:12-4-1-31-gx)
关键词
一线总线
定时器中断
异步读写
指令队列
CPU占用率
1-wire bus Timer interrupt Asynchronous read-write Instruction queue Occupation rate of CPU