shawty / sn76489arduino

Project and Supporting files to turn an arduino into a BBC Micro music player.
MIT License
23 stars 3 forks source link

test_other_timers_sn76489 #1

Closed dima-78 closed 2 years ago

dima-78 commented 2 years ago

The clock signal source for the timer/counter TCNT1 can be the clock signal used for the entire microcontroller using a pre-divider. If the division factor is not selected, the timer/counter stops. The operation mode of the timer/counter T1 is set by the registers TCCR1A and TCCR1B similarly to the timer/counter T0.

shawty commented 2 years ago

@dima-78 thanks for that, not 100% sure what your referring too... I suspect your on about the point in the Arduino code where I left a note that I didn't know how the function I call worked, to produce a 4Mhz square wave out, allowing the Arduino to drive the sound chip without using an external oscillator.

To be fair, I only used that because I didn't have any 4Mhz oscillator's at the time (I was waiting for some being delivered).

In my final code/design I actually don't use this, as by the time I got to the final version that I uploaded here, I'd got my 4Mhz oscillator's and was using one of them.

I'll accept the PR though, in so much that it might be useful for someone wanting to clock the sound chip from the Arduino too.

If I have things wrong, please do let me know :-) I'm no expert on timers in the Arduino.

dima-78 commented 2 years ago

Yes always please. I already did a similar project on an old iron chip :) ay8910 + arduino + sdcard and I know the situation with the generation of a 4 MHz meander for a three-voice sound generator not by hearsay and I sometimes encountered the fact that the sound from the generator floats (then I used a frequency of 3.5 MHz like on the original zx spectrum (speccy) and started experimenting with arduino timers and experimentally determined that for tolerable operation of the sound generator, the optimal frequency should be 4 MHz. I already ordered some sn76489an sound chips from the ket and I want to try to integrate them into arduboy. in general I'm waiting. thank you for the project. I've set up the visual studio c# environment. I'll try to do the same trick with direct transmission to uart for ay8910. You're interested, my project player ay8910+arduino+sdcard in instagram #kidscience_

shawty commented 2 years ago

Absolutely interested, I have an AY8910 (Actually 2 of them, and an AY8912) in my box of parts. Also got some OPL2 & OPL3 chips that I salvaged out of an old MS-Dos sound card somewhere.

For me messing about with the SN76489 is going back to my teenager years :-) and my beloved BBC Model B micro, I started with computers back in 1979, and in the mid 80's I was one of 3 people (I was about 15 then) that discovered a bug in the SN76489 chip, that allowed the BBC Model B Micro to play sampled sound at 8Khz sampling rate :-)

Back then we did such silly things and pushed the hardware in our computers to do things it was not supposed to, but then along came windows and said... NO YOU CANNOT TALK TO HARDWARE anymore, and so in time things like my trick where lost.

Today I do similar silly things just using Arduino/rPI/Microchip PIC and ESP/STM 32, sometimes it's serious work, most times it's just because I can and it's fun.

Your project will let me play with the AY chips.

If you look at the C# code, you'll find it's actually a mini VGM file parser. It only pays attention to the SN76489 parts, but if you look up the file spec VGM files can hold music for all kinds of files, including the AY chips, so it could easily be adapted to send commands to AY synths quite easily.

dima-78 commented 2 years ago

Yep..i understand you. when i built this player i listened to those fine old chipmods almost every day and was nostalgic for the days when i had my first speccy in 90’s yr. those were the happiest years of my life, when I first started programming in a BASIC interpreter, when I wrote my first programs, those were unforgettable years that will stay with me for the rest of my life. when Clive Marles Sinclair passed away, I cried. this is a link to the exchanger with the player project https://disk.yandex.ru/d/V08sUIqVlxoMYQ

shawty commented 2 years ago

Thanks, have got them will take a look at the weekend.

Have a look on my You-Tube page, you'll find a couple of BBC Model B related demos on there, and a demo of my Arduino/SN76489 playing the music file from the same demo on my desk. :-)