本文介绍了使用C对多线程PIC18的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎样才能创建并行运行的线程编程时的,因为没有操作系统?

How does one create threads that run in parallel while programming PIC18, since there is no OS?

推荐答案

不要使用线程,使用一个事件循环。

Don't use threads, use an event loop.

在PIC18是一个小的处理器和事件循环风格为主意味着你不必让许多深栈游逛。你需要写你的code。在事件循环的方面,而且这可能是合理的。

The PIC18 is a small processor and an event loop based style means you don't have to keep many deep stacks hanging around. You need to write your code in terms of the event loop, but that is probably reasonable.

如果你确实有一些长期运行的任务,使用计时器都不同中断优先级,允许高优先级事件循环,以preempt优先级较低的事件循环,并提出适当的工种到相应的事件队列。

If you do have some long running tasks, use timers are different interrupt priority levels to allow higher priority event loops to preempt lower priority event loops, and put appropriate types of work into the appropriate event queue.

这篇关于使用C对多线程PIC18的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 20:09