delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/05/04/16:16:20

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "mohd hamizi ahmad" <M DOT H DOT Ahmad AT lboro DOT ac DOT uk>
To: <djgpp AT delorie DOT com>
Subject: help on DOS serial communication using DJGPP
Date: Tue, 4 May 2004 21:15:39 +0100
Message-ID: <000101c43214$9160c730$f088e783@emilda>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.2627
In-reply-to: <000001c43207$a920de80$f088e783@emilda>
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Scan-Signature: 8079af16f52acabe27afb3e53fe4978e
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

i've tried to communicate between embedded system to PC using serial
communication. my embedded system using DOS operating system. i've tried
to send a character to PC and should be display on hyperterminal. i've
tried but nothing happen. i've check my program, and i think there is no
problem. could anybody check my simple program down here? maybe i make a
mistake and you can tell me where my mistake. 

#include <stdio.h> 
#include <conio.h> 
#include <stdlib.h> 
#include <bios.h> 

int main() 
{ 

unsigned com1_send; 
unsigned com1_init; 


// open serial port at 9600 baud, 8 data bits, 
// No parity, 1 stop bit 
com1_init = _bios_serialcom(_COM_INIT, 1, 
_COM_CHR8 | _COM_NOPARITY | _COM_STOP1 | _COM_9600); 
printf("Init status: 0x%4.4X\n", com1_init); 

while(1) 
{ 
// send a push keyboard character to com2 
com1_send = _bios_serialcom(_COM_SEND, 1, (unsigned)getch()); 
printf("Send status: 0x%4.4X\n", com1_send); 
} 

return(1); 
}


- Raw text -


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