Darrels interrupts and multiple SOUND statements, will it work?


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,124

    Default Darrels interrupts and multiple SOUND statements, will it work?

    As it's known, you can have several interrupts with Darrels interrupts. What if I use say 4 interrupts, and use SOUND statement in each to output sound on separate pin, then connect the pins via resistors to same speaker, so I can get polyphonic music, or say music and drumkit line? will it work? are there any limits for specific statements vs interrupts?

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    a sound command will lock the interrupt that its in until it completes . interrupts aren't interruptible (except on pic18 hi/lo priority) . sound commands will be sequential no matter how you go about it
    you would need a pic multi tasking os like RTOS to get anywhere close to that

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    The processor can only do one thing at the time. It can't exectute two SOUND commands simultanously no matter where you place them.
    If you put a SOUND command in ONE interrupt handler that SOUND command will block all other interrupts while executing unless one of the other interrupts have a higher priority* than the one currently executing, in which case the one currently executing will be "halted" untill the ISR with higher priority is finished.

    * PIC18 have two interrupt priorities.

    You could use a PIC with multiple PWM modules and something like a 1ms background tick to turn them on/off.

    EDIT: Richard beat me to it....

  4. #4
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    Yes I already use 16F876's PWM channels to have 2 note polyphony, but I'd like to have more on simpler chips (say 12F683).

    Here's 16F628A doing not only stereo polyphony, but color graphics too:

    http://www.quinapalus.com/picsi.html

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    Out of curiosity, how many channels do you need?
    8 channels for 4 * 2 note polyphony? Highest/lowest output frequency?
    What frequency resolution would be considered good enough?

  6. #6
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    Actually, capabilities of AY-3-8910 will be enough (3 channels). Since I want to incorporate famous NES game tunes into my project as easter egg. If it was dedicated project, I can use that chip, which I have used on ZX Spectrum quite long time ago, but I'm space and hardware resources limited, so this is why I'm asking for software solution.

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    Hi,
    I fooled around with this a bit yesterday. I've got a software solution for generating three tones but there is (and won't be) any noise, mixer, envelope, shape and whatever else the AY-3-8910 can do - just three tone generators. I have no idea if it'll work in practice or how good it'll "sound" but scope and frequency counter shows correct values for, at this point, three octaves.

    With 3 channels it will NOT work at 4MHz, it MIGHT just work at 8MHz but there won't be much left do anything else. I'm currently running it on a 18F25K20 @64MHz so I need to breadboard something with a less capable chip and see what gives. Obviously the lower the maximum output frequency needs to be the more can be achieved with a low clock frequency so I'll ask again: What's the maximum output frequency you NEED?

    Is the 12F683 the desried target chip and will you able to run it with external clock (to get 16MHz or 20MHz)? As it's written it relies on the prescense of a TMR2 module and uses interrupts at the ASM level, though the actual ISR is written in PBP with manual system register save/restore.

    Are you aiming to do other things as well with this same chip?

    It's not ready for public viewing yet, I'll post it when it is (or not if the answers to the above questions shows it's a dead end....)

    /Henrik.

  8. #8
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    here is somthing i was impressed with for sound from apic
    http://www.pic24.ru/doku.php/en/osa/.../pk2_osa_piano

  9. #9
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    also has interesting approch to matrix touch sensor array , and 8ch polymorphic generation using 1 pwm pin

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Darrels interrupts and multiple SOUND statements, will it work?

    I saw this before and was very impressed by the speed of touch sensors, sound quality and simplicity of the design. Great job.

    Ioannis

Similar Threads

  1. Multiple IF THEN Statements: PIC16F84A
    By bob425 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th August 2012, 06:01
  2. Problem with multiple interrupts
    By aratti in forum General
    Replies: 7
    Last Post: - 2nd June 2009, 08:18
  3. Multiple IF-THEN statements
    By DavidK in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th June 2007, 18:28
  4. Handeling multiple Interrupts
    By BobSpencerr in forum General
    Replies: 15
    Last Post: - 1st March 2007, 01:12
  5. Multiple HW Interrupts
    By Radiance in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th August 2003, 22:35

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts