I want to fix a period of 100us (T=100us),which i use in my calculation.I have a problem to find it.
i look for your help.
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
Posted: Thu Apr 27, 2006 6:26 am
We have a problem understanding what you want to do! Are you wanting a timer to give an int every 100us? That is pretty fast if your pic is running slow. What pic and freq do you have?
aymen Guest
Posted: Thu Apr 27, 2006 7:16 am
pic is 18f442 with freq of 40MHZ.
i want to introduce a value of 100 us .
this solution is possible?
set_timer1(65411); // 65536-65411=125 coresspond for T= 100 us /// (100/0.8)=125
setup_timer_1(T1_internal| T1_div_by_8); // th timer overflow every 0.8 us
}}
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
Posted: Thu Apr 27, 2006 9:01 am
I am using a 18F6720 @ 40MHz to sample a DALI bus every 104us. So the answer is yes. I use a CCP interrupt however. I set the CCP to reset the timer so that I do not have problems with latency "adding up".
Note that you have noclear flag and are not clearing the int. Not a good thing. Also, get_timer1 should return a 16 bit int and not a float.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum