CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

period of 100 us

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
aymen
Guest







period of 100 us
PostPosted: Thu Apr 27, 2006 6:10 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Apr 27, 2006 6:26 am     Reply with quote

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







PostPosted: Thu Apr 27, 2006 7:16 am     Reply with quote

pic is 18f442 with freq of 40MHZ.
i want to introduce a value of 100 us .
this solution is possible?

float T
#int_timer1 noclear
clock_isr(){
T=get_timer1();
}
main()
{
for(;;)
{
enable_interrupts(global);
enable_interrupts(INT_TIMER1);

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

View user's profile Send private message Send e-mail

PostPosted: Thu Apr 27, 2006 9:01 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group