Weak Data Transfer From Ph Meter To Daq Factory


izumi1

Recommended Posts

Posted

After a while, the pH from the pH meter stops transferring to Daq Factory. Could you please help with a line of code that re-initializes the data transfer in the case that it stops? 

 

Thank you!

 

Here is the sequence:

 

device.phmeter.Purge()
private string datain
while(1)
   try
      datain = device.phmeter.ReadUntil(13)
      if (left(dataIn,2) == "pH")
         ph.AddValue(strToDouble(mid(datain,3,1000)))
      endif
   catch()
//      ? strLastError
      device.phmeter.Purge()
   endcatch
   delay(0.1)
endwhile
 
 
Posted

You can do this two ways.  First, you can try just adding:

 

device.phmeter.initcomm() inside your catch():

 

catch()
//      ? strLastError
      device.phmeter.initcomm()
      device.phmeter.Purge()
   endcatch
 
Second, you can create a secondary thread that checks the timestamp of ph and reinits the comm port:
 
while(1)
   if (ph.time[0] < systime() - 30)
      device.phmeter.initcomm()
   endif
   delay(10)
endwhile
 
Third, you should consider replacing your USB to serial converter, as that is what is causing the disconnect.  Get a different brand and one rated for industrial use, not a cheap $20 one off a random site on the Internet.  I always recommend the ones from SeaLevel.com.
Posted

When I inserted device.phmeter.initcomm() inside the catch(): 

- I got ALERTS from Daq Factory 

 

Then I used the secondary thread and the pH still stopped logging in my ph channel. 

 

I am not using a USB to serial converter, I am plugging in the USB cord (from the pH meter) directly into COM 6 of the PC.

 

Do you have any other suggestions to fix this problem? Sorry, thanks for all of your help so far! 

Posted

Can you tell me what the alerts are?

 

Alas, you are using a USB to serial converter, its just buried in the pH meter which is too bad because you are subject to their whims.  Just for future reference, if you can, buy devices with serial or ethernet connections instead of USB, then if you have to go USB, you can get a converter.

Posted

Yeah, when I inserted device.phmeter.initcomm() inside the catch(): the "Alert" on the bottom right corner of Daq Factory would keep lighting up every time it would log the pH. 

Posted

It keeps saying unable to initialize COM6;can't access port,probably in use by another app.

 

but nothing else is using COM6, I even switched to COM7 and I'm getting the same error.

Posted

You can't just randomly pick comm port numbers.  You should go into the windows Device Manager, find the comm ports listed there and figure out exactly which one the device is showing up on.  I know you have no choice, but this yet another reason I dislike USB->serial converters.  They move around on their comm #'s, especially if you plug them into a different USB port.

Posted

Just to be sure: you didn't just rename the port, you actually changed the port number to 7?  Also try rebooting to be sure no other software is claiming that port.  And try reiniting the port in daqfactory:

 

device.ph.initComm() 

 

and make sure you get the in use error every time.

Posted

When I go to Device Configuration and click on phmeter, COM6 and COM7 are both options. I clicked on COM6 to delete it but it won't delete. I have phmeter running with COM7 but since COM6 is still there, could that be what is causing the problem? 

Posted

1) Go into Device configuration

2) click on Com6, then click on Configure.  It probably won't do anything.  If it does, set the Port to 0 and hit OK

3) click on Com7 then click on Configre.  Make sure the port says 7, hit OK.

 

If all else fails, email us the .ctl doc.

Posted

I did both of those things, COM6 didn't do anything when I clicked delete and nothing happened when I clicked configure.

COM7 is set to port 7. 

I'll e-mail you the file. Thank you!

Posted

Are you sure you want Xon/Xoff flow control?  I rarely ever see any device that requires any sort of flowcontrol nowadays, and would especially not expect it with something that supplies its own USB port and virtual comm port driver, since the driver itself could handle the flow control.  It may be as simple as that being set to None.

 

Don't worry about the COM6 port.  Even though it shows up in the list, it doesn't actually exist.  

Posted

The manual for the pH meter says to set the flow to Xon/Xoff.

 

Do you have any other suggestions?

 

I am now using a USB to serial converter and I'm still getting the same Alert and the pH stops logging after a certain period of time. 

I used the device manager and made sure I am using the right COM port, could it be something in the sequence? 

Archived

This topic is now archived and is closed to further replies.