Jump to content

Interupt timing with the PIT (68k)


LinkoVitch

Recommended Posts

I am experimenting with some sound stuff, and to help with my sanity I am prototyping it on the 68K first.

 

First off I have sample playback working fine, noises come out and all sounds as it should...

 

Now, I need to have my 68K routine in these experiments fire off at my desired sample rate. I can achieve 8kHz no probs, I can it seems attain 11-12kHz no probs, but that seems to be the limit!

 

Regardless how I set PIT0 and PIT1, I cannot seem to get it beyond around 12kHz tops!

 

The way I am calculating the frequency is my PIT interrupt simply adds 1 to a variable, then every VBI the buffer is echo'd to the console and cleared. So I have a 60Hz sample of the count, get the count, multiply by 60 and bingo, interrupt frequency.

 

Can someone tell me what I am doing wrong?

 

I am computing PIT0 and PIT1 by diving 25,000,000 by say 100 to give 250,000Hz, then setting PIT1 to something like 11 which should result in an interupt of around 22kHz (I know PIT is n+1, and the clock isn't 25,000,000 but these are just rough figures :) )

 

Hope someone out there can help me with this.

 

Cheers

Link to comment
Share on other sites

I have just added a similar routine (counter wise) within the DSP and using the JPIT timers, it gets exactly the figures I am expecting. Am I just trying to interrupt the 68K too much? It feels wrong that this should be the case given there were a variety of sample playback routines on the ST which could manage more than 20kHz playback (I think 32kHz was the top I saw) and that was a ~9MHz 68K

Link to comment
Share on other sites

I have just added a similar routine (counter wise) within the DSP and using the JPIT timers, it gets exactly the figures I am expecting. Am I just trying to interrupt the 68K too much? It feels wrong that this should be the case given there were a variety of sample playback routines on the ST which could manage more than 20kHz playback (I think 32kHz was the top I saw) and that was a ~9MHz 68K

 

Just to make it worse, recently there has been released a 50khz soundtracker for a plain 8mhz st :)

 

Anyway, maybe a method of checking would be to output the value to BG and see the color changes?

Link to comment
Share on other sites

Are you sure you aren't just running into trouble with the speed of printing?

 

I would first try measuring for a full second before output (or even just half a second), and see whether that makes any difference.

Link to comment
Share on other sites

Are you sure you aren't just running into trouble with the speed of printing?

 

I would first try measuring for a full second before output (or even just half a second), and see whether that makes any difference.

 

Don't think that is the issue, I only started doing that once I noticed the sample playback rate wasn't changing how it should, I then started counting and found out why it never sounded like 16kHz or higher.

 

(this is all prototype code so I am not too fussed about my sample routine being on the 68K right now :D )

 

 

Link to comment
Share on other sites

Actually, I take that back, Tursi, you may be onto something.. I'll test once I have completed my current round of fiddling :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...