mitxela.com forum
Welcome. Please log in or register.

polyphonic synth cable at 16mhz
DAVID Posted: 26 Apr 2018, 10:51 PM
Avatar
I love mcus

Member
Posts: 237
Joined: 10-September 17
hi i have an attiny4313 and like to do your synth cable but the problem is that i only have 16 mhz crystals and i will like to know if is possible to run it at 16mhz and how?

-------------
[top]
mit Posted: 30 Apr 2018, 12:25 AM
Avatar
yeah whatever

Admin
Posts: 538
Joined: 4-May 16
Yes, it should run, the only part that will need changing is the bit that sets the UART baud rate.

In the datasheet there are equations for calculating the UBRR register to match the baud rate to the crystal:

(User posted image)


It's using asynchronous normal mode, the top line.

UBRR is set on lines 137 to 141 in the source code, currently it's set to 39.

MIDI baud rate is 31250bps.

At 16MHz UBRR = 16000000/(16*31250) -1 == 31

So you just need to change line 140 to

ldi r16,31


and it should work.

Of course all the notes will be 20% lower in pitch too.

-------------
[top]
DAVID Posted: 30 Apr 2018, 12:39 AM
Avatar
I love mcus

Member
Posts: 237
Joined: 10-September 17
thanks

-------------
[top]

Sign in to post a reply.