Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

PulseCount does not return an integer


XavierP Apr 30, 2014 03:17 PM

Hello,

First, I am sorry for my very bad English :/

My issue is similar to XxVashxX's one in https://www.campbellsci.fr/forum/messages.cfm?threadid=78A3FF02-E100-4934-95D2118E6679771A.

I am using a tipping bucket wired to pulse port n°2 on a CR800 datalogger.

I use the following code to count, store and treat the number of pulses measured:

DataTable(MyTics,NbOfTics>0,-1)
DataInterval(0,15,Sec,10)
Totalize(1,NbOfTics,FP2,False)
Sample(1,TicsTreatments,IEEE4)
EndTable

....and in my 15s scan :

PulseCount(NbOfTics,1,2,2,0,1,0)
TicsTreatments = TicsTreatments + NbOfTics

My issue is: sometimes, NbOfTics is equal to 0.9999999 or to 1.000001 in the real time monitoring BUT when I collect MyTics, NbOfTics are always integers (that is the good thing), but TicsTreatments sometimes has decimals (that is the bad thing).

I would like to :
- never have a 0.000001 decimal in NbOfTics or in TicsTreaments
- not define NbOfTics as an integer (because I want to be able to add fake "half tics" by doing NbOfTics = NbOfTics +0.5 in some conditions)

Any idea to fix this problem ?

* Last updated by: XavierP on 4/30/2014 @ 9:17 AM *


EarlyBird May 2, 2014 07:34 AM

Declare your integer variables as LONG which will then be treated as integers. Make table TicsTreatmens in the DataTable FP2.

When you add "half tics" NbOfTics will be automatically converted to FP2.

Let me know if this works.

Log in or register to post/reply in the forum.