RS485串口通信
void Send( char *buf, int count){
outportb(0x02FC,inportb(0x02FC)|0x02); /*Raise the RTS Signal */
while(count--)PutChar(*buf++);
while ( ( inportb ( 0x02Fd ) & 0x40 ) == 0 ); /*wait for all data to be sended!*/
outportb( 0x02FC,inportb(0x02FC)&0xfd); /*Drop the RTS Signal*/
}
void PutChar ( unsigned char c )
{
while ( ( inportb ( 0x02Fd ) & 0x20 ) == 0 );/* Wait til transmitter is ready */
outportb (0x02F8, c ); /* then send it */
}
void revice()
{
while(1){
cc=inportb(0x2FD)&0x01;
if(cc!=0){
cm=inportb(0x2F8);
break;
}
}
发送数据正常,怎么写接收数据?谢谢
[ 本帖最后由 zwc 于 2009-9-26 16:10 编辑 ]