main loop and real time task
2015-07-23 14:28:50 2 举报
在计算机编程中,主循环(main loop)和实时任务(real-time task)是两个重要的概念。主循环是一个持续运行的程序结构,用于不断检查并响应外部事件或内部条件变化。它使程序能够持续运行,直到满足特定的退出条件。实时任务则是指需要在特定时间内完成的任务,通常与现实世界的事件或时间有关。这些任务需要及时响应和处理,以确保系统的正常运行和性能。在实际应用中,主循环和实时任务常常相互关联,通过合理的调度和管理,实现对系统资源的高效利用和实时响应能力的提升。
作者其他创作
大纲/内容
PWM output based on trigger level
PWM output is set from 20% to 100%
user control function
Main Led control
calibration pin input 1
user control
12V low voltage protection
Trigger level = 1600have not pressed trigger
trigger is pressed in 5% range
timer 2 interrupt execute
trigger is pressed in75% to 100% range
cpu enter low power mode
black box
trigger is pressed in 20% to 75% range
Datalog engine
means: system have execute user control function 5 times.Leave this 5 ms for driver charging
Clutuch level detection
PWM output = 75%
mosfet over temp protection
Real time task
Torque control function
update adc port value
Background task
speed switch voltagenot larger than 7V
5ms have passed after mcu start workand speed switch voltage larger than 7V
Protection process
speed switch error
PWM out put = 100%
trigger is pressed in 75% to 100% rangeand elcutch level = level 3
Set hardware current limit based on clutch level (except hammer mode and drill mode)
short protection
speed wake up function
Main Loop
out put control process (based on trigger level
Calibration
Timer 2 interrupt Real time task loop (every 1ms execute one time)
trigger is pressed in 5% to 20% range
Turn off work LED
Trigger level 1600(pressed trigger)
over current protection
Detect fwd/rev pin decide motor run forward or reverse
PWM output = 20%
5ms have not passed after mcu start work
Real time task
User control initialization
Clutch setting process
clutch memory function
elcutch level level 3
stall protection
Cablibration pin not input 1
PWM output = 0%
1ms passed
0 条评论
下一页