delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/10/04/03:05:37

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <00a301c4a9e0$754ee650$0d01a8c0@josepmariaxp>
From: "JM Rams" <josepmaria AT turomas DOT com>
To: <djgpp AT delorie DOT com>
References: <BAY16-F38jlqzUrIz8U00003ed2 AT hotmail DOT com>
Subject: Re: how can i use importb && outportb to control the series port com 1 ?
Date: Mon, 4 Oct 2004 09:04:49 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2741.2600
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2742.200
X-MailScanner-Information: Please contact the ISP for more information
X-MailScanner: Found to be clean
Reply-To: djgpp AT delorie DOT com

----- Original Message -----
From: "MUSH ROOMS" <roomsmush AT hotmail DOT com>
To: <djgpp AT delorie DOT com>
Sent: Saturday, October 02, 2004 1:51 PM
Subject: how can i use importb && outportb to control the series port com 1
?


> i woul like to get and to send information by the port com 1, how can i do
?
>
> _________________________________________________________________
> MSN Search, le moteur de recherche qui pense comme vous !
> http://search.msn.fr
>
>

I use this two functions to initializing and to send a caracter by COM
ports. It works fine.

void inicialitza_port_serie(int com,float bauds,unsigned char bits,unsigned
char paritat,float stp)
{
long divisor;
unsigned char line_control=0;
unsigned char stop=0;
if(stp==1)stop=0;
if(stp==1.5)stop=0x4;
if(stp==2)stop=0x4;
line_control=(bits-5)|stop|((paritat/2)<<4)|(((paritat+1)/2)<<3);
divisor=(long)(max_baud/(long)bauds);
outportb(com+0x03,0x80|line_control);     /* Line Control Reg.
parritat(0x8), 0x0 1bit paro, 0x3 8 bits*/
outportb(com+0x02,0xC7);       /* Activa FIFO i netejo */
outportb(com+0x00,(divisor&0xFF));      /* Baudrate div. LSB */
outportb(com+0x01,(divisor<<8));        /* Baudrate div. MSB */
outportb(com+0x03,line_control);      /* Line Control Reg. 0x0f*/
outportb(com+0x01,0x00);       /* Interrupt Enable */
outportb(com+0x04,0x0);       /* Modem Control Reg. abans 0x3*/
outportb(com+0x06,0xFF);       /* Modem Status Reg.*/
inportb(com);
}

int e_caracter(int port,char c)
{
int error=0;
if(inportb(port+0x5)&0x1e)error=10;
else if((inport(port+0x5)&0x40)!=0)outportb(port,c);
else return(1);
return(error);
}



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019