AN2025 - CTCSS Carrier Generation With A PSoC Microcontroller
AN2025 - CTCSS Carrier Generation With A PSoC Microcontroller
Summary
This Application Note demonstrates how to implement a Continuous Tone Coded Squelch System (CTCSS)
carrier generator using a 256-byte sine wave look up table in ROM, and a DAC6 User Module. The basic
routine for generating the sine wave is not application specific and can be used to generate other waveforms
and other frequencies.
Frequency Selection
In this project a function is provided that sets the
index increment value for the desired frequency.
This function, SetCTCSSFreq(), is passed a 1-
byte argument that is the CTCSS tone number.
The tone number is manipulated (subtract 1 and
multiply by 2) to convert it into an index for a 38
entry 16-bit LUT which contains index increment
values.
In this project a 6-bit DAC was selected over an The waveform distortions for selected CTCSS
8-bit DAC. The 8-bit DAC would result in more tones (1, 7, 13, 19, 26, 32, and 38) were
precise steps, but would use more analog SoC calculated based on measurements taken with a
blocks. Through experimentation it was found Hewlett-Packard 3585A Spectrum Analyzer. The
that the number of steps per waveform had a measurements were taken directly from the
much greater impact on the accuracy of the output of the PSoC microcontroller with no
output waveform than the DAC resolution. reconstruction filter. The results are graphed in
Figure 2. The maximum distortion, 3.8%,
Performance occurred at the highest output frequency, as
With the timers configured as described in the would be expected.
previous sections of this Application Note and
using an external crystal, data was collected to
% D is t o rt io n v s . F re que nc y
determine the frequency accuracy and the
waveform distortion of the output. 5.00%
4.00%
The output frequencies were measured for all 48
CTCSS tones using a Fluke 87 Digital 3.00%