the program i posted in that thread uses 1 timer. That timer is used to generate a time base to drive 4 software counters. these counters become my timers.
the program i posted in that thread uses 1 timer. That timer is used to generate a time base to drive 4 software counters. these counters become my timers.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
hi cncmachineguy
yes i recognized it but pic16f84 drived by max 10 mhz and we need so precision time period , max +-2 micro second precision, when we use instructions like if ,else we have problem.
when we are asked to generate two signals 630 micro seconds and 453 micro second by porta.0 and porta.1, for example, 633 micro seconds is not acceptable.
well how about you post what you have so far, and maybe we can help you to get it done. Did you teacher have any suggestions how he thinks you will do it? I am sure there are several ways to get it done, but you must understand how and why it works. We will help you, but we won't do it for you (not saying you asked us to). So show us what you have and we can go from there.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
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
i have tried to obtain accurate time by changing tmr0 and prescaler, but still no answer![]()
You have a lot of stuff in the ISR. Take the IF_THEN_ELSE out of the ISR.
Dave
Always wear safety glasses while programming.
yes, i have tried it also, i put them in main loop but i could not obtain time accuracy.
Bookmarks