Hallo,
please help to find a solution - I didn't find it yet. I have a task with the
period_ns/f_rt and want to get out a rectangle wave with a frequency f_wave.
Using the rtfs I set period_ns und f_wave. The problem is the non-linear
dependence between f = 1/T. The frequency of the wave I pretend linear but the
result isn't it by this peace of code:
rtf_handler:
/* period_ns for the task is eq. to 1kHz */
waveform_freq = (unsigned int)rtf_msg.data2; /* Hz */
waveform_ticks = (unsigned int)(1/((double)waveform_freq)*1e3);
thread_code:
if(square_on) {
ao_data[AO_CURR1_CH] = ao_data_wavegen[AO_CURR1_CH];
ao_data[AO_CURR2_CH] = ao_data_wavegen[AO_CURR2_CH];
if( !(loop_index % waveform_ticks) )
square_on = 0; /* turn off */
} else { /* !square_on */
ao_data[AO_CURR1_CH] = (sampl_t)NI_PCI_MIO_XE10_MAXDATA -
ao_data_wavegen[AO_CURR1_CH];
ao_data[AO_CURR2_CH] = (sampl_t)NI_PCI_MIO_XE10_MAXDATA -
ao_data_wavegen[AO_CURR2_CH];
if( !(loop_index % waveform_ticks) )
square_on = 1; /* turn on */
}
The question is, how can calculate the waveform_ticks in that way, that the
output is proportional to the given waveform frequency regards to the realtime
module frequency?
Thanks Olaf
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/