siren sound with tmr0


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    Post up the code you have (use the "code /code " tags) and state what the actual problem is and I'm sure someone will offer assistance

  2. #2
    Join Date
    Mar 2014
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    Quote Originally Posted by Scampy View Post
    Post up the code you have (use the "code /code " tags) and state what the actual problem is and I'm sure someone will offer assistance
    Hi I am using tmro interrupt.
    My program is;
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF &_BODEN_ON & _LVP_OFF & _DATA_CP_OFFON INTERRUPT GoTo VAIL  
    OPTION_REG=000001    
    define OSC 4
    CMCON=7
    INTCON=100000 
    trisa=0
    trisb=0
    porta=0
    portb=0
    SYMBOL SES=PORTA.1
    t var word
    a1 var byte
    a var byte
    x var byte
    
    
    a=0:a1=55:t=0:x=0
    tmr0=55
    
    
    wail:
    
    
    goto wail
    
    
    VAIL:
    disable
    
    
    TOGGLE SES
      t=t+1
            if t=20 and a=0 then
            t=0
            a1=a1+1
            if a1>242 then a=1
            endif
            
            if t=125 and a=1 then
            t=0
            a1=a1+1
            if a1>245 then a=2
            endif
            
            if t=125 and a=2 then
            t=0
            a1=a1-1
            if a1<242 then a=3
            endif
            
            if t=20 and a=3 then
            t=0
            a1=a1-1
            if a1=<55 then a=0
            endif
       
    tmr0=a1
    INTCON.2=0
    resume
    enable
    end
    anyone can help me for this?

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    Code:
    a=0:a1=55:t=0:x=0
    tmr0=55
    
    
    wail:
    
    
    goto wail
    
    
    VAIL:
    disable
    well this may be one reason... it's looping but doing nothing in-between

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    Quote Originally Posted by Scampy View Post
    Code:
    a=0:a1=55:t=0:x=0
    tmr0=55
    
    
    wail:
    
    
    goto wail
    
    
    VAIL:
    disable
    well this may be one reason... it's looping but doing nothing in-between
    I think that is ok, it loops until tmr0 interrupts on overflow.

    I have never used ON INTERRUPT, but I see some mistakes probably from cut and paste. ON INTERRUPT should be on a separate line, not in the configurations

    OPTION_REG and INTCON need % in front of the binary numbers

    enable at the end of the code will never happen, since resume returns us to the main program.

    What else?

    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF &_BODEN_ON & _LVP_OFF & _DATA_CP_OFFON INTERRUPT GoTo VAIL  
    OPTION_REG=000001    
    define OSC 4
    CMCON=7
    INTCON=100000 
    trisa=0
    trisb=0
    porta=0
    portb=0
    SYMBOL SES=PORTA.1
    t var word
    a1 var byte
    a var byte
    x var byte
    
    
    a=0:a1=55:t=0:x=0
    tmr0=55
    
    
    wail:
    
    
    goto wail
    
    
    VAIL:
    disable
    
    
    TOGGLE SES
      t=t+1
            if t=20 and a=0 then
            t=0
            a1=a1+1
            if a1>242 then a=1
            endif
            
            if t=125 and a=1 then
            t=0
            a1=a1+1
            if a1>245 then a=2
            endif
            
            if t=125 and a=2 then
            t=0
            a1=a1-1
            if a1<242 then a=3
            endif
            
            if t=20 and a=3 then
            t=0
            a1=a1-1
            if a1=<55 then a=0
            endif
       
    tmr0=a1
    INTCON.2=0
    resume
    enable
    end

  5. #5
    Join Date
    Mar 2014
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    Quote Originally Posted by mark_s View Post
    I think that is ok, it loops until tmr0 interrupts on overflow.

    I have never used ON INTERRUPT, but I see some mistakes probably from cut and paste. ON INTERRUPT should be on a separate line, not in the configurations

    OPTION_REG and INTCON need % in front of the binary numbers

    enable at the end of the code will never happen, since resume returns us to the main program.

    What else?

    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF &_BODEN_ON & _LVP_OFF & _DATA_CP_OFFON INTERRUPT GoTo VAIL  
    OPTION_REG=000001    
    define OSC 4
    CMCON=7
    INTCON=100000 
    trisa=0
    trisb=0
    porta=0
    portb=0
    SYMBOL SES=PORTA.1
    t var word
    a1 var byte
    a var byte
    x var byte
    
    
    a=0:a1=55:t=0:x=0
    tmr0=55
    
    
    wail:
    
    
    goto wail
    
    
    VAIL:
    disable
    
    
    TOGGLE SES
      t=t+1
            if t=20 and a=0 then
            t=0
            a1=a1+1
            if a1>242 then a=1
            endif
            
            if t=125 and a=1 then
            t=0
            a1=a1+1
            if a1>245 then a=2
            endif
            
            if t=125 and a=2 then
            t=0
            a1=a1-1
            if a1<242 then a=3
            endif
            
            if t=20 and a=3 then
            t=0
            a1=a1-1
            if a1=<55 then a=0
            endif
       
    tmr0=a1
    INTCON.2=0
    resume
    enable
    end
    Hi Marks
    You are right. İt is problem related to copy paste selection.
    I looked to my program on the editor mode, it is right.
    I am using this program on the isus simulation program.
    All commands is good, without one position.
    High frequency sound is very bad. I am trying to make good sound this frequency.
    I asked you , if you have sapmle code related this program pls share for me.
    Thank you for your interest.

  6. #6
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    I found this on the net, no idea if it works, but the code is very well commented and may help you with your project. Note the hardware too

    https://www.scribd.com/doc/103363423...icrocontroller

    And another project, but in mikroC which may be easier to convert to PBP http://www.electroschematics.com/873...ecurity-alarm/
    Last edited by Scampy; - 20th May 2016 at 09:07.

  7. #7
    Join Date
    Mar 2014
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: siren sound with tmr0

    Quote Originally Posted by Scampy View Post
    I found this on the net, no idea if it works, but the code is very well commented and may help you with your project. Note the hardware too

    https://www.scribd.com/doc/103363423...icrocontroller

    And another project, but in mikroC which may be easier to convert to PBP http://www.electroschematics.com/873...ecurity-alarm/
    Hi Scampy;

    Thank you for your solutions.
    I saw this project on the web, these are related , simple siren sound.
    I wanna professional siren sound. I saw more softwear on the web, all softwear writing asm language.
    Then I decide to learn asm.

    İt is mine solutions.
    Thank you

Similar Threads

  1. Police Siren like Barricade has?
    By DanPBP in forum Off Topic
    Replies: 3
    Last Post: - 4th June 2016, 20:28
  2. intervall timer siren
    By oeloeg in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th August 2011, 16:46
  3. TMR0 as counter
    By savnik in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 31st March 2009, 19:34
  4. Tmr0
    By laughing-gravy in forum mel PIC BASIC
    Replies: 6
    Last Post: - 19th February 2007, 19:51
  5. Sound and sound control with minimal parts
    By bartman in forum General
    Replies: 23
    Last Post: - 18th January 2005, 14:08

Members who have read this thread : 0

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