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.

Measuring suqare waves with CR1000


AlexChao Mar 22, 2011 04:22 PM

Which datalogger do you use?
CR1000

Please list the sensors you are using:
function generator make 1kHz square wave

Please list anything else connected to the datalogger:
function generator output signal

How can we help you?
We use "periodavg" and "pulsecount" to measure function generator output signal by CR1000,but loggernet result is NAN.Please help it.

Best Regards


IslandMan Mar 24, 2011 10:28 AM

Do you have the generator connected to P1 or P2?
Please post the PulseCount instruction you are using.
What is the amplitude of your 1 kHz pulse?


AlexChao Mar 25, 2011 12:26 PM

1.Yes,I have it with PulseCount instruction.
PulseCount (Dest,1,1 ,0,1,1.0,0)
2.400mv
3.PeriodAvg instruction
PeriodAvg (Dest,1,mV2500,1,0,1,10,10,1.0,0)
We connected SE1 channel

Best Regards


IslandMan Mar 26, 2011 09:51 AM

Here is a simple program to measure frequency on P1 of your CR1000 and call a table to do a 15 second average of the frequency. You had the PulseCount instruction but you cannot connect the SE1 which is for analog voltage measurement. Modify the DataInterval if you want a longer average.

'CR1000 Series Datalogger

'Declare Public Variables
Public Freq

'Define Data Tables
DataTable (Test,1,1000)
DataInterval (0,15,Sec,10)
Average (1,Freq,FP2,False)
FieldNames ("Avg_Freq")
EndTable

'Main Program
BeginProg
Scan (1,Sec,0,0)
'meausure frequency of pulse on P1
PulseCount (Freq,1,1 ,0,1,1.0,0)
CallTable Test
NextScan
EndProg

Hope this helps


AlexChao Mar 29, 2011 10:36 AM

I have ±400mv of 1kHz squre waves and use your sample program,but I have zero value in Freq and Avg_Freq that output signal cable connect P1 and G.Please help me .Thanks


aps Mar 29, 2011 12:45 PM

If the signals are only +/-400 mV then you either need to try using the AC low-level input option on the pulse counter channel, with this instruction and parameters:

PulseCount (Freq,1,1 ,1,1,1.0,0)

Because of the decoupling and filtering on the low level AC measurements you may find the input will stop measuring +/-400 mV signals around about 1 kHz.


Or use the period average instruction on one of the analogue inputs. Using the period average instruction:

PeriodAvg (Freqread,1,mV250,1,0,1,100,1000,1.0,0)

Note I have set this to measure the frequency over 100 cycles which will take 100 ms approx.


AlexChao Apr 13, 2011 01:03 AM

I have used the period average instruction
PeriodAvg (Freqread,1,mV250,1,0,1,100,1000,1.0,0)
that signal cable connect 1H and G to measure but value of freqread is still NAN.Please help . Thanks


aps Apr 13, 2011 09:07 AM

Are you sure the signal is +/-400 mV relative to the datalogger ground? If you find it is not then you can change the threshold parameter, e.g. to 400 if signal is ranging 0-800 mV relative to the ground wire.

One other thing to realise is that for the period measuring instruction you specify the number of cycles to time and a maximum timeout. You have specified 100 cycles with a timeout of 1000 ms which is fine if you signal ranges from about 100 Hz up to 10000+ Hz. However if you are using a function generator and start off at a lower frequency the logger won't be able to time 100 cycles in the timeout period so gives NaN. You can overcome this by measuring less cycles at some risk of increased noise (better to average as many as possible), however, the period average instruction cannot be used to measure very low frequencies as it has a maximum timeout of 1000 ms. If the output can stop and cannot cope with NaN in the data, you can trap this by adding a statement such as IF freqofsignal = NaN THEN freqofsignal = 0 (where freqofsignal is the variable holding the frequency returned by the instruction).

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