Question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question

1,434 Views
michaelrush
Contributor I

Hi,

I recently purchased a FRDM-KL05Z and am using Codewarrior 10.4 with Processor Expert to do my developing. I would like to develop a guitar tuner and am familiar with creating a Processor Expert project and adding/editing components. I have worked through the sample programs provided through Freescale and Codewarrior that involve the ADC and have had great success. Can anyone tell me what PE components I would need to receive an external analog signal (GPIO?), convert that signal to digital (ADC?), and if I need a clock input or is that already taken care of by the ADC?

Thanks in advance,

Michael

Tags (3)
0 Kudos
Reply
6 Replies

1,210 Views
Petr_H
NXP Employee
NXP Employee

Hi,

An analog input can be read using ADC_LDD component.

It supports also triggering from various timer or external sources. The timing for the trigger can be configured by TimerUnit component.

Is periodic sampling what do you want to achieve?

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
Reply

1,210 Views
michaelrush
Contributor I

Thanks for your reply, Petr. At this point I am able to sample/convert the analog signal. For testing GPIO, I have used the ADC results to illuminate one of three external LEDs. What I would like to do now is process the ADC results in real-time (I'm thinking of using a Continuous Fourier Transform). Are there components to help with this? 

0 Kudos
Reply

1,210 Views
Petr_H
NXP Employee
NXP Employee

In general, you need to put the a block of signal samples into a buffer and then process it.

Unfortunatelly, I'm not aware of any component for FFT, however there might be some sample code on the internet in C for this, try using search engines. 

Anyway, If I think about the the guitar tuner application you mentioned, maybe the FFT would be too complex and unnecessary, maybe there would help some simple approach - using a simple filter cutting off high frequencies and then measure period of the resulting sine wave (count number of samples between crossing the average value).

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
Reply

1,210 Views
michaelrush
Contributor I

Thanks again, Petr. I had actually read something similar to your suggestion of counting the period while doing some research on determining signal frequency. Is this something I could use PWM for or would there be a more efficient component?

 

Michael

0 Kudos
Reply

1,210 Views
Petr_H
NXP Employee
NXP Employee

You are welcome. If you would use a ADC sampling then you would search the "zero" crossing in the values in a software loop and counting number of samples between the crossings. This value can be then converted to the frequency because you know the sampling interval.

Another option - If you make the filter and threshold circuit off-chip then then just connect resulting digital signal to a pin with a timer input (something like TPM0_CH0), you can use Capture_LDD that can handle measurement of the digital signal frequency/period for you.


best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
Reply

1,210 Views
michaelrush
Contributor I

I will work on those suggestions.

 

Thank you,

Michael

0 Kudos
Reply