Discussion in 'Programming' started by bizzare_blue, Oct 1, 2005.
How can I program the serial port?? I m well versed with C/C++....
Actually, I want to get a signal from the port where a device may b attatched.....How can I do this?
Also, I wanted 2 know bt Remote Interfacing....
This is absolutely possible....
I have done it....
but currently , I dont remember anything, will let u know in a few days....
quoting directly from my c++ compiler.....
Ã¾ inport reads a word from a hardware port
Ã¾ inportb reads a byte from a hardware port
Ã¾ outport outputs a word to a hardware port
Ã¾ outportb outputs a byte to a hardware port
Ã¾ int inport(int portid);
Ã¾ unsigned char inportb(int portid);
Ã¾ void outport(int portid, int value);
Ã¾ void outportb(int portid, unsigned char value);
Ã¾ inport works just like the 80x86 instruction IN. It reads the low
byte of a word from portid, the high byte from portid + 2.
Ã¾ inportb is a macro that reads a byte
Ã¾ outport works just like the 80x86 instruction OUT. It writes the
low byte of value to portid, the high byte to portid + 1.
Ã¾ outportb is a macro that writes value
ArgumentÂ³ What It Is
portid Â³ Inport port that inport and inportb read from;
Â³ outport port that outport and outportb write to
value Â³ Word that outport writes to portid;
Â³ byte that outportb writes to portid.
If you call inportb or outportb when DOS.H has been included, they are
treated as macros that expand to inline code.
If you don't include DOS.H, or if you do include DOS.H and #undef the
macro(s), you get the function(s) of the same name.
Ã¾ inport and inportb return the value read
Ã¾ outport and outportb do not return
Name Address IRQ
COM 1 3F8 4
COM 2 2F8 3
COM 3 3E8 4
COM 4 2E8 3
does this help you?
I heard (but i am not sure) that in Windows u can treat ports as files and write and read data from them. Try to open it in binary mode.
dheeraj_kumar is right...
For more examples check the Help in Turbo C
Separate names with a comma.