⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dcanrx.c

📁 CSD卡的dos驱动程序源码
💻 C
字号:
#include<dos.h>
#include<stdio.h>
#include<stdlib.h>
#include"csdcan.h"

CAN_SPACKET can_txmsg;
CAN_PORTSTRUCT ptrStruct;
CAN_RPACKET  can_rxmsg;

int line,irqflag=0;

void far CallBackCan1Fun(int cbCmd)        
{

		switch(cbCmd)
		{
		 case 1:
			 CSD_CanRcvMsg(1,&can_rxmsg);   
			 irqflag=1;
			  break;
		
		}
}

void main()
{
	 
        clrscr();
        ptrStruct.filter=SINGLE;
        ptrStruct.lis_on=LOFF;
        ptrStruct.test=TOFF;
        ptrStruct.sleep=SOFF;
        ptrStruct.baud_rate=B1000;
        ptrStruct.code1=0;
        ptrStruct.code2=0;
        ptrStruct.code3=0;
        ptrStruct.code4=0;
        ptrStruct.mask1=0xff;
        ptrStruct.mask2=0xff;
        ptrStruct.mask3=0xff;
        ptrStruct.mask4=0xff;

        CSD_Open(0x140);
        CSD_CanConfig(0xd000,0xd400,7,11,1);

	CSD_Install(1,0xd000,IRQ7,CallBackCan1Fun);

        CSD_CanConfigPort(1,&ptrStruct);        

	CSD_CanEnableIntRcv(1);

        CSD_CanClearRxBuffer(1);

       printf("csd can demo program\n");
       cprintf("Press any key to continue...");
       getch();
       clrscr();
       line=wherey()+5;

       while(TRUE)
       {
	   if(irqflag == 1)       /*  display the interrupt receiving  message  */
	   {
		  irqflag=0;
		  gotoxy(2,line);  cprintf("Receive(Int)");
		  gotoxy(15,line);  cprintf("%x ",(can_rxmsg).id1);
		  gotoxy(20,line);  cprintf("%x ",(can_rxmsg).id2);
		  gotoxy(25,line);  cprintf("%x ",(can_rxmsg).id3);
		  gotoxy(30,line);  cprintf("%x ",(can_rxmsg).id4);
		  gotoxy(35,line);  cprintf("%x ",(can_rxmsg).data[0]);
		  gotoxy(40,line);  cprintf("%x ",(can_rxmsg).data[1]);
		  gotoxy(45,line);  cprintf("%x ",(can_rxmsg).data[2]);
		  gotoxy(50,line);  cprintf("%x ",(can_rxmsg).data[3]);
		  gotoxy(55,line);  cprintf("%x ",(can_rxmsg).data[4]);
		  gotoxy(60,line);  cprintf("%x ",(can_rxmsg).data[5]);
		  gotoxy(65,line);  cprintf("%x ",(can_rxmsg).data[6]);
		  gotoxy(70,line);  cprintf("%x ",(can_rxmsg).data[7]);
	   }
	   if(kbhit()) break;
	   delay(600);
  }
  CSD_Close();
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -