Electrix
Member
I have written the foll code for transmitting data to the PC from a microcontroller..I ran the program in Turbo C 3.0, works fine. Now i want to run the same code in VC++. VC does not seem to recogonize 'bios.h'..what is the alternative to this ?
Code:
#include <stdio.h>
#include <conio.h>
#include <[color=red]bios.h[/color]>
#define SETTINGS (_COM_9600 | _COM_CHR8 | _COM_NOPARITY | _COM_STOP1)
/*BAUD RATE=9600, 8 BITS, NO PARITY, 1 STOP BIT */
void main(void)
{
unsigned in,out,status;
int port;
clrscr();
printf("Select Port(Enter '0' for COM1 and '1' for COM2):");
scanf("%d",&port);
printf("Press ESC to exit");
textcolor(YELLOW);
cprintf("\nData Received:");
_bios_serialcom(_COM_INIT,port,SETTINGS);
for(;;)
{
status=_bios_serialcom(_COM_STATUS,port,0);
if(status&256) /*if data ready */
{
if(((out=_bios_serialcom(_COM_RECEIVE,port,0))&127)!=0)
putch(out);
}
if(kbhit()) /*if a keystroke is currently available*/
{
in=getch(); /*get a character without echoing onto the screen*/
if(in==27)/*ESC*/
break;
_bios_serialcom(_COM_SEND,port,in);
}
}
}