Sorry folks for posting a new thread. My earlier thread (posted two days ago) was unanswered and since the thread was big, I createda new thread and rephrase my question.
I am doing a serial communication with a device connected to a EURYSIS frame grabber card. ...
My API reads and writes values to the device ....
For instance, when I start, my API will display the stored values in the device. I have also provided a read button for this. .... that will load these values again .. there is a write button to write values to the device ..
My API is working perfectly fine .. It is displaying the values initially,and hte read function is also working fine ..

The problem is with the initial display.
When I start my API, I get the correct values displayed ..... but then I just switch off (power off) my device and press the read button, the value (say ET) is displayed zero. .. that is alright ..
PROBLEM -1
After this, I power on the device, press the read the GUI displays the value 69 that is stored value for ET in the device ....that is also good .
But the second time I press the read button the value displayed is 30. and again when I press the read button It comes back to 89.. after that How many times I press the read button It remains 69. ...
Q. Why is it going to 30 in the second read process after displaying correctly int the first instance and then and then coming back to the correct value after that ?
In other words, in my initial step while loading my API I am performing two read operations ... hence when I first start my API after powering up my device, the value of ET is displayed wrongly as 30.
But one press of read, displays it back to 69 ...

Folks.... now a bit of my coding ..
I am using serial communication commands ..
Creating object like
DCB PortDCB ...... then ..
Opening Driver's
Detecting boards etc etc .
then a ....CreateFile command with the correct parameters .. .. then, Setting the following timeout values to the DCB object ..

PortDCB.DCBlength = sizeof(PortDCB);
PortDCB.BaudRate = 9600;
PortDCB.ByteSize = 8;
PortDCB.Parity = NOPARITY;
PortDCB.StopBits = ONESTOPBIT;
PortDCB.EvtChar ='\0';
PortDCB.fNull=FALSE;
PortDCB.fBinary=TRUE;
PortDCB.fDtrControl = DTR_CONTROL_ENABLE;
PortDCB.fRtsControl = DTR_CONTROL_ENABLE;
PortDCB.fOutxCtsFlow = FALSE;
PortDCB.fOutxDsrFlow = FALSE;
PortDCB.fDsrSensitivity = FALSE;
PortDCB.fOutX = FALSE;
PortDCB.fInX = FALSE;
PortDCB.fTXContinueOnXoff = FALSE;
PortDCB.fParity = FALSE;
// getting and setting COMSTATE
COMMTIMEOUTS cto;
cto.ReadIntervalTimeout=MAXDWORD;
cto.ReadTotalTimeoutMultiplier= 0;
cto.ReadTotalTimeoutConstant=300;
cto.WriteTotalTimeoutMultiplier=(20000 / PortDCB.BaudRate) ? (20000 / PortDCB.BaudRate) : 1;
cto.WriteTotalTimeoutConstant=300;

Then let me give one example of one value sat ET. how I read it ...while pressing the read Button ..

unsigned long *RxIntegration;
OVERLAPPED oswriter1;
int nWriteHexValueEt;

nWriteHexValueEt=0xFF000207;

WriteFinalValue(nWriteHexValueEt,m_hCommPort[gPortNum]); // My function to write values

*(RxIntegration)=0;
memset(&oswriter1,0,sizeof(oswriter1));
bResult2=ReadFile(m_hCommPort[gPortNum],RxIntegration,sizeof(RxIntegration),&BytesRead,&oswriter1);

PLEASE NOTE...I have only copied necessary code.. I have all the commands like for instance in my function of WriteFinalValue .. I have used the
CreateEvent
GetLastError
ClearCommError
and then the WriteFile

Similarly after the ReadFile also ...

Any helps please ..... I am a newbe in VC++ so please elaborate your replies ...
My OS is Windows XP Pro with SP 2..