I would like to generate some odd frequencies with my PYBOARD like:
Code: Select all
CTCSS_FREQS =[67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, 97.4, 100.0,
103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, 136.5, 141.3, 146.2, 151.4,
156.7, 162.2, 167.9, 173.8, 179.9, 186.2, 192.8, 203.5, 206.5, 210.7, 218.1, 225.7,
229.2, 233.6, 241.8, 250.3, 254.1]
So far I use a pyb.Timer(1) and have a clock of 168MHz, prescaler at 168 and using a value for the period that is based on essentially 20* the selected CTCSS frequency. The output on a Pin outputs a square wave of the desired CTCSS frequency.
Code: Select all
t = pyb.Timer(1)
t.period(int(1000000/(20*CTCSS_FREQS[1]))
t.prescaler(168)
Is there a better way?
Regards,
Roland