In Turbo C , I am using bios.h to send and receive data on serial Port. I am using bios(2, 0, COM1) to receive data.... and
bios(1, in, COM1) to send data..where (let int in=65
I am receiveing data from Port but unable to send... I copied code from http://electrosofts.com/serial/

**********************************************************

#include <bios.h>
#include <conio.h>
#define COM1 0
#define DATA_READY 0x100
#define SETTINGS ( 0xE0 | 0x10 | 0x00 | 0x03) 

// 0xE0 = 9600, 0x10 = Even Parity, 0x00 = (stop bit =1), 0x03 = 8 bit

int main(void)
{
int in, out, status;
bioscom(0, SETTINGS, COM1); /*initialize the port*/
cprintf("Data sent to you: ");
while (1)
{
status = bioscom(3, 0, COM1); /*wait until get a data*/
if (status & DATA_READY)
if ((out = bioscom(2, 0, COM1) & 0x7F) != 0) /*input a data*/
putch(out);
if (kbhit())
{
if ((in = getch()) == 27) /* ASCII of Esc*/
break;
bioscom(1, in, COM1); /*output a data*/
}
}
return 0;
}

**********************************************************

please help me...if anybody is having any idea...

(no problem in my PC's Serial port.. )

Recommended Answers

All 7 Replies

>>please help me...if anybody is having any idea

Help you do what exactly? I didn't see a question in your post.

My guess is the host OS isn't DOS at all, but probably something like XP.

The answer is to get one of the many free compilers which are actually compatible with your host OS.

>>please help me...if anybody is having any idea

Help you do what exactly? I didn't see a question in your post.

My problem is.:
I am receiveing data from Port but unable to send.

My guess is the host OS isn't DOS at all, but probably something like XP.

The answer is to get one of the many free compilers which are actually compatible with your host OS.

thanks for replying..

Yes I am working On Windows Xp.. And when I am using HyperTerminal Tool of Windows Xp. it is working fine that means serial port as well as serial cable bothe are working good..

even i am receiveing data but cant send..

Hello Every Buddy.. My Problem is solved..

I was unable to send data from my C program for that I hav to make some small changes in My Serial cable.. I had make it NULL MODEM...

Just Short 4-6 and 7-6 pin

It will start sending as receiving...

Hello Every Buddy.. My Problem is solved..

I was unable to send data from my C program for that I hav to make some small changes in My Serial cable.. I had make it NULL MODEM...

Just Short 4-6 and 7-6 pin

It will start sending as receiving...

Hey can you please tell me how you figured it out...

Regards,
Ahamed.

Ahmed please send me your number buddy...i need to ask you about serial port which u have done 5years back

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.