Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Square wave generation phase offset problems using PXI6602

Solved!
Go to solution

Hi,

 

I am generating 2 signals to use for simunlating an Incremental AB encoder using a PXI6602.

The signals need to be square wave, 34.133Khz, offset by 90degrees which I am setting by dividing (1/frequency) by 4 and putting the result into the DAQmx Create Channel (CO-Pulse Generation-Frequency).vi initial delay node.

The resulting signals phase difference however does not consistantly measure 90degrees. At least 1 in 5 runs of the vi has a phase angle issue resulting in a failed test.

 

Can anyone suggest a stable fix for this.

 

Thanks,

David

0 Kudos
Message 1 of 4
(4,664 Views)

You need to use a start trigger to ensure the counters start together.  Configure the start trigger on your counter tasks, start the tasks, then issue the start trigger once the tasks are started.  If you want to save I/O lines you can use the internal output of one counter to trigger the other (if you do this, only configure the start trigger on one counter and start that counter first).

 

Also the exact 34.133 kHz isn't achieveable unless you are using an external timebase.  The internal 80 MHz timebase does divide down to make ~34.130 kHz (80 MHz / 2344) though.

 

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 4
(4,635 Views)

Thanks John_P1,

 

that seems logical and as for the frequency, it's not really critical that it's exactly 34.133Khz as long as it's there abouts.

 

I've had a little play with the trigger suggestion using the examples in LabVIEW as reference (Hardware Input and Output>DAQmx>Counter Output) but I'm getting an error as seen in the attached image no matter what I select the trigger source as.

 

I am relatively new to LabVIEW program building and have had no formal training as yet so could you possibly look at the attached vi and suggest or impliment the required changes to get this vi working please.

 

Thanks.

David.

 

 

Download All
0 Kudos
Message 3 of 4
(4,616 Views)
Solution
Accepted by topic author Daveadz

John_P1,

 

after posting the previous comment I went back to play with it some more and it now runs and returns a positive result every time.

The change that had the desired effect was to the trigger type that I had selected (Advance Digital Edge). On changing this to Start Digital Edge with falling edge set, the error went away.

 

Please feel free to still critique the vi and suggest / edit it to enhance stability / efficiency.

All feedback is willfully accepted Robot Happy

 

Thanks,

David.

0 Kudos
Message 4 of 4
(4,612 Views)