|
楼主 |
发表于 2018-1-12 06:58:33
|
显示全部楼层
本帖最后由 pic_flash 于 2018-1-12 06:59 编辑
有内建RTOS
#use rtos 调出
下面是基本结构:
- // preprocessor directives
- #include <18F452.h>
- #use delay(clock=20000000)
- #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
- #use rtos(timer=0,minor_cycle=100ms)
- // function declarations
- #task(rate=1000ms,max=100ms)
- void The_first_rtos_task ( );
- #task(rate=500ms,max=100ms)
- void The_second_rtos_task ( );
- #task(rate=100ms,max=100ms)
- void The_third_rtos_task ( );
- // more function declarations
- // function implementations
- void The_first_rtos_task ( )
- {
- // task code
- }
- void The_second_rtos_task ( )
- {
- // task code
- }
- void The_third_rtos_task ( )
- {
- // task code
- }
- // more function implementations
- void main ( )
- {
- // initialization code for other resources
- rtos_run ( );
- }
复制代码 |
|