DOS系统下的实时多任务系统开发(RTKERNEL)

来源:互联网 发布:淘宝店封了支付宝封吗 编辑:程序博客网 时间:2024/05/16 19:56

DOS系统下的实时多任务系统开发(RTKENERL) 

RTOS-32, RTKernel. 用于32位x86结构,Win32/NT兼容的嵌入式系统实时多任务操作系统, 用于DOS系统的实时多任务内核. 用于x86兼容CPU的非专利保护嵌入式操作系统, RTKernel是一个功能强大的实时多任务系统,它是被设计用来提供给那些希望在DOS ...

/*串口设置和创建"线程"任务*/

#include <rtkernel.h>
#include <rtcom.h>
#include <stdio.h>
#include <rtkeybrd.h>
#include <cpumoni.h>
#include <timer.h>
#include <dos.h>

TaskHandle Com1Handle;
TaskHandle Com2Handle;
TaskHandle Com3Handle;
//TaskHandle Com4Handle;
TaskHandle Time1Handle;
TaskHandle Send1Handle;

Semaphore  Com1Sema;
Semaphore  Com2Sema;
Semaphore  Com3Sema;
Semaphore  Com4Sema;

void main()

{

 RTComInit();
 //---125--
  TimeSB=0;
 Comm2Done=1;
 TimeB=0;
 TimeEB=1;
 times=5;
 DataBe=0;
 ReadPara();
//-------125end----
  PortInstalled(COM1x);
  SetIOBase(COM1x,0x3F8);
  InitPort           ( COM1x, 9600, 2, 1, 8 );//端口1初始化,与计算机通讯
  EnableCOMInterrupt ( COM1x,  1024 );//设置端口中断缓冲区,存储中断向量

 {
  PortInstalled(COM2x);
  SetIOBase(COM2x,0x2F8);
  InitPort         ( COM2x,  9600, 0, 2, 8 );//端口2初始化,与A/D通讯
  }

  /*
  PortInstalled(COM3x);
  SetIOBase(COM3x,0x3E8);
  InitPort         ( COM3x,  9600, 2, 2, 8 );
  EnableCOMInterrupt ( COM3x,1024 );
  */

  PortInstalled(COM4x);
  SetIOBase(COM4x,0x2E8);
  InitPort         ( COM4x,  9600, 2, 1, 8 );
  EnableCOMInterrupt ( COM4x,1024  );

  Com1Sema = RTKCreateSema ( Binary, 1 );
  Com2Sema = RTKCreateSema ( Binary, 1 );
  Com3Sema = RTKCreateSema ( Binary, 1 );
  Com4Sema = RTKCreateSema ( Binary, 1 );
Com1Handle = RTKCreateTask   ( Receiver1, 8, 2*4096, "Receiver1" );
    if ( !NoWeighing )
    Com2Handle = RTKCreateTask ( Receiver2, 9, 2*4096, "Receiver2" );
    Com3Handle = RTKCreateTask ( Receiver3, 7, 2*4096, "Receiver3" );//?优先级9-》7/8
    //Com4Handle = RTKCreateTask ( Receiver4, 9, 2*4096, "Receiver4" );

while(1);

}

原创粉丝点击