yes i have an advisor teacher but he does not say anything about how i can do it. i guess he just wonder how i find a solution for this project.
i have started usual basic loop without using tmr0, and for a signal it works well but generating second one with different frequencies causes timing problem. i also tried to implement assembler codes in order to have more time space however it did not help me.
at least i want to find a method so as to generate these signals having pulse witdh x8 ( 8,16,..320 mic. sec ). in this program i am trying to use basic timing by using tmr0 and interrupt. i guess i need a 8 micro seconds time period which constant?
thanks a lot
define OSC 10
timer0 var word
timer1 var word
A0 VAR PORTA.0
A1 VAR PORTA.1
on interrupt goto int_timer
OPTION_REG=%00000000
TMR0=255
INTCON=%10100000
TRISA=0
LOW PORTA
timer1=0
timer0=0
enable
main:
goto main
disable
int_timer:
timer0=timer0+1
if timer0=>3 then ' 3 is a random number
timer0=0
toggle a0
else
endif
timer1=timer1+1
if timer1=>10 then ' 10 is a random number
timer1=0
toggle a1
else
endif
INTCON.2=0
TMR0 = 255
resume
end
Bookmarks