Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
unsigned int MSR=COM2+0x06;
unsigned int MCR=COM2+0x04;
int delay(int delayTime);
yousafzai82 said:Thank you both..
Now the error is
outportb"(MCR,DTR)";
The error is statement missing..
Also let me know about the address of COM1..
Zahoor
void outportb( int port, unsigned char byte )
yousafzai82 said:I am very bad at programming. Can you tell me exactly what should i do?
your code her
yousafzai82 said:The c codes are as folllows:
#include<dos.h>
#include<stdio.h>
#define COM1 0x3F8;
#define DTR 0x01;
#define RTS 0x02;
main()
{
unsigned char status;
unsigned int value, bit;
unsigned int MSR=COM2+0x06;
unsigned int MCR=COM2+0x04;
outportb(MCR,DTR);
delay(10);
outportb(MCR,DTR+RTS);
do{
status=inportb(MSR) & 0x20;
}while(status);
value=0;
for(i=0;i<12;i++){
value=value<<1;
delay(1);
outportb(MCR,RTS);
delay(1);
ourportb(MCR,DTR+RTS);
delay(1);
if (inportb(MSR) & 0x20)==0) bit=1;else bit=0;
value=value+bit;
}
ourportb(MCR,0x00);
printf("%d\n",value);
}
#include<dos.h>
#include<stdio.h>
#define COM1 0x3F8;
#define COM2 0x2F8;
#define DTR 0x01;
#define RTS 0x02;
main()
{
unsigned char status;
unsigned int value, bit;
int MSR, MCR, i; // =COM2;//+0x06;
//unsigned int MCR=COM2;//+0x04;
MSR = COM2+0x06;
MCR = COM2+0x04;
//outportb(MCR,DTR);
outportb(MCR,chr(0x01));
delay(10);
//outportb(MCR,DTR+RTS);
outportb(MCR,chr(0x01+0x02));
do{
status=inportb(MSR) & 0x20;
}while(status);
value=0;
for(i=0;i<12;i++){
value=value<<1;
delay(1);
//outportb(MCR,RTS);
outportb(MCR,chr(0x02));
delay(1);
//ourportb(MCR,DTR+RTS);
ourportb(MCR,chr(0x01+0x02));
delay(1);
if ((inportb(MSR) & 0x20)==0) bit=1;else bit=0;
value=value+bit;
}
ourportb(MCR,0x00);
printf("%d\n",value);
return 0;
}
yousafzai82 said:Thanks bassa for your time..
Now i am getting one error
outportb(MCR,chr(0x01));
Error function 'chr' should have a prototype..