Communicating Red Lion's Cub5V Meter With Pc Via Rs232


Minali

Recommended Posts

Hello guru, We have successfully completed the code we don't have above queries now, the code we made is below:

  1. private string data
  2. private string setpoint2
  3. while(1)
  4. try
  5. device.CUB5V.purge()
  6. device.CUB5V.Write("N0TA*")
  7. data = device.CUB5V.readUntil(10)
  8. device.CUB5V.Write("N0TE*")
  9. setpoint2 = device.CUB5V.read(12)
  10. private nData = strToDouble(mid(data,6,200))
  11. private nSP2 = strToDouble(mid(setpoint2,6,200))
  12. if(nData >= nSP2)
  13. Counter.AddValue(ndata)
  14. endif
  15. catch()
  16. ? strLastError
  17. endcatch
  18. delay(1)
  19. endwhile.

But we have one new query that the code gives us output in Channel Table continuously may be because there is a while loop and we are wishing to see only the maximum value in the Table for logging purpose means after satisfying the ">=" condition the all values comes in Table and we only want maximum one so Can you help me suggesting any Logic to do so ? Can creating Variable will help me? Help me regarding

Link to comment
Share on other sites

You can do this a couple ways:

1) put the data in the channel, then do:

max(counter)

to retrieve the maximum value

2) add the following if() around the counter.addvalue():

if (max(counter) < ndata)

counter.addValue(ndata)

endif

If you clear out counter at the beginning, you can change the if to just:

if (counter[0] < ndata)

counter.addValue(ndata)

endif

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Can we add or copy-pest any video in DAQ. We try it by assigning quick Seq to button like below :

strFName = File.FileOpenDialog("000397283-gears-in-motion-2.mp4","D:\My Documents\Downloads","*.mp4","Data Doc")

but file doesn't open in DAQ

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...

Hello Guru,

In our DAQ project besides the errors like C1136

one window comes named 'Microsoft Visual C++ Runtime Library'

and Shows Runtime Error and

This Application has requested the Runtime to terminate it in an unusual way.

Help me regarding.

Link to comment
Share on other sites

Hello sir,

I again attached here my project. In this project when nData is become greater than setpoint1 in water ,vanspatee,PFM,Sugar sequences at a same time then run time error comes. and when this condition is satisfy in single sequence that time error doesn't come.so please help me.

project.ctl

Link to comment
Share on other sites

Consider using an Export set instead of a Logging set to log one line of data. Doing this:

beginlogging(...)

delay(2.5)

endlogging(...)

doesn't really work reliably. It should cause a crash, but its definitely something I would change.

I would also uncheck AutoSplit files, and really, the align threshold shouldn't be much above 1. As I said, an export set, where each expression has [0] after it, is a better choice for what you are trying to do.

Link to comment
Share on other sites

  • 1 month later...

Hello sir,

This is nisha writing you from jhajjar power limited.As i go through the conversations,we are also facing the same issue like jyoti who was discussing about the C++ error & unusual termination.Kindly find the attached .ctl file.Requesting you to suggest areliable solution for the same

JPL.zip

Link to comment
Share on other sites

Archived

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