Click to See Complete Forum and Search --> : Problem with ReadFIle


m_nekkanti
February 20th, 2003, 12:32 AM
I have RS232/485 converter and three meters connected to it.
I am writing commands and reading data from the meters using writefile and readfile. Normally it is working fine. But one of the meter is not connected(offline) then it is giving problem. It is coming out of loop with out continuing reading from other meters.
ReadFIle function is not returning.
WHen all the meters are connected, it is fine. ANy help will be apreciated.
Thank you.

KingTermite
February 20th, 2003, 08:01 AM
I guess you would have to give more info to go on. What loop? What is the nature of what is going on? Is there data there for it to read? If not, it "should" return a -1.

Is it perhaps getting stuck not in the "Readfile", but maybe a "dataready" type routine inside the function you are calling "Readfile" with?

ejj
February 20th, 2003, 08:28 AM
If you want to know if a serial device is connected, you can call GetCommModemStatus and check if the MS_RLSD_ON bit is on. If not, there is no device present, and you don't have to read from it.