Hi,
I am trying to modify our exsisting program which takes a square wave at 15.723kHz as input and generates a pulse train of 1024 pulses at 20MHz in each timeperiod of the square wave, which looks like-
__|||||...1024..|||____^|||||...1024..|||____^||||...1024..|||____^ (The [^] represents the starting of next time priod of input signal).
For this generation, since the maximum internal timebase for 6602 is 80MHz, I am using COUNT_1 as 2 and COUNT_2 as 2, so that the final output frequency is 20MHz (80/4).
Now I need to modify this to generate a 16MHz output frequency which is (80/5) COUNT_1 is 2 and COUNT_2 is 3 and to generate 1024 pulse I need to use 5120 as COUNT_2 in pulse train generation code. While using this value I am missing a time period of the input signal as the pulse train goes into the next time priod. To demonstrate here is how it looks-
__||||...1024..|||||||||||||||^||_____________^||||...1024..||||||||||||^||_____________ (The [^] represents the starting of next time priod of input signal)
The code goes like this -
GPCTR_Control(deviceNumber, gpctrNum0, ND_RESET);
GPCTR_Set_Application(deviceNumber, gpctrNum0, ND_PULSE_TRAIN_GNR);
GPCTR_Change_Parameter(deviceNumber, gpctrNum0,ND_SOURCE,ND_INTERNAL_MAX_TIMEBASE);
GPCTR_Change_Parameter(deviceNumber, gpctrNum0, ND_COUNT_1, 2);
GPCTR_Change_Parameter(deviceNumber, gpctrNum0, ND_COUNT_2, 2); <----- changed to '3' in case of 16MHz Select_Signal(deviceNumber, ND_GPCTR0_OUTPUT, ND_GPCTR0_OUTPUT,ND_LOW_TO_HIGH);
GPCTR_Change_Parameter(deviceNumber, gpctrNum0, ND_OUTPUT_POLARITY, ND_LOW_TO_HIGH);
GPCTR_Change_Parameter(deviceNumber, gpctrNum0,ND_GATE,ND_OTHER_GPCTR_OUTPUT);
GPCTR_Control(deviceNumber, gpctrNum0, ND_PROGRAM);
GPCTR_Control(deviceNumber, gpctrNum, ND_RESET);
GPCTR_Set_Application(deviceNumber, gpctrNum, ND_RETRIG_PULSE_GNR);
GPCTR_Change_Parameter(deviceNumber, gpctrNum,ND_SOURCE,ND_INTERNAL_MAX_TIMEBASE);
GPCTR_Change_Parameter(deviceNumber, gpctrNum, ND_COUNT_1,0);
GPCTR_Change_Parameter(deviceNumber, gpctrNum, ND_COUNT_2,4096); <----- changed to 5120 in case of 16MHz GPCTR_Control(deviceNumber, gpctrNum, ND_PROGRAM);
It would be great if someone can help me out in generating a 1024 pulse train at 16MHz on PCI-6602.
thanks,
-Pav.