Hi Everyone!
I wanna make siren sound with 16f628a and timer0.
I find on the web and found the tmr0 solution. I did make program, but can't take good result.
Do you have sample program for me with tmr0 interrupt.
Thank you.
Hi Everyone!
I wanna make siren sound with 16f628a and timer0.
I find on the web and found the tmr0 solution. I did make program, but can't take good result.
Do you have sample program for me with tmr0 interrupt.
Thank you.
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;
anyone can help me for this?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
well this may be one reason... it's looping but doing nothing in-betweenCode:a=0:a1=55:t=0:x=0 tmr0=55 wail: goto wail VAIL: disable
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.
Bookmarks