Hi Everybody,
I am writing application using VC++ for enabling internal loopback mode
on serial port. I have been using DeviceIOCtl code
IOCTL_SERIAL_SET_MODEM_CONTROL to set Modem Control Register so that
Loopback bit is enabled.
Here is the call made:
DeviceIoControl(m_hCom,
// handle to device obtained using CreateFile
IOCTL_SERIAL_SET_MODEM_CONTROL,
&dwRegVal, // input buffer
sizeof(DWORD), // size of input buffer
NULL, // lpOutBuffer
0, // nOutBufferSize
(LPDWORD) &dwBytesReturned, // number of bytes returned
NULL // OVERLAPPED structure
);
First I read it using IOCTL_SERIAL_GET_MODEM_CONTROL and then OR the
content with 0x10 (SERIAL_IOC_MCR_LOOP) and then set it.
I am not getting back the content of MCR(Modem Control Register) same
as I have written.
Before writing to MCR, its value read is 0x0b. After writing
SERIAL_IOC_MCR_LOOP, when I read back MCR, it returns 0x08.
And also it is not enabling internal loopback mode.
Can anybody help me by pointing out where I am making mistake or point
me to some resource where I can get help.
Regards
Bhagwandas