首页 一个c语言的串口通信程序范例

一个c语言的串口通信程序范例

举报
开通vip

一个c语言的串口通信程序范例TheStandardizationOfficewasrevisedontheafternoonofDecember13,2020一个c语言的串口通信程序范例#include<>#include<>#include<>#include<>#defineCOM232 0x2f8#defineCOMINT 0x0b#defineMaxBufLen     500#definePort8259      0x20#defineEofInt       0x20staticint comportaddr;staticcha...

一个c语言的串口通信程序范例
TheStandardizationOfficewasrevisedontheafternoonofDecember13,2020一个c语言的串口通信程序范例#include<>#include<>#include<>#include<>#defineCOM232 0x2f8#defineCOMINT 0x0b#defineMaxBufLen     500#definePort8259      0x20#defineEofInt       0x20staticint comportaddr;staticcharintvectnum;staticunsignedcharmaskb;staticunsignedcharBuffer[MaxBufLen];staticint CharsInBuf,CircIn,CircOut;staticvoid(interruptfar*OldAsyncInt)();staticvoidinterruptfarAsyncInt(void);voidInit_COM(intComPortAddr,unsignedcharIntVectNum,intBaud,      unsignedcharData,unsignedcharStop,unsignedcharParity){ unsignedcharHigh,Low; intf; comportaddr=ComPortAddr; intvectnum=IntVectNum; CharsInBuf=0;CircIn=0;CircOut=0;  f=(Baud/100); f=1152/f;High=f/256; Low=f-High*256; outp(ComPortAddr+3,0x80); outp(ComPortAddr,Low); outp(ComPortAddr+1,High);  Data=(Data-5)|((Stop-1)*4); if(Parity==2)Data=Data|0x18; elseif(Parity==1)Data=Data|0x8; outp(ComPortAddr+3,Data);  outp(ComPortAddr+4,0x0a);  outp(ComPortAddr+1,0x01);  disable(); OldAsyncInt=getvect(IntVectNum); setvect(IntVectNum,AsyncInt); enable();  maskb=inp(Port8259+1); if(IntVectNum==0x0c)outp(Port8259+1,maskb&0xef); elseoutp(Port8259+1,maskb&0xf7);              }staticvoidinterruptfarAsyncInt(void){ disable(); if(CharsInBuf0) {  (*Char)=Buffer[CircOut];  if(CircOut
本文档为【一个c语言的串口通信程序范例】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
个人认证用户
雪儿
教师
格式:doc
大小:1MB
软件:Word
页数:0
分类:企业经营
上传时间:2021-09-09
浏览量:1