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

Question about get_timer1() ...

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



Joined: 09 Dec 2008
Posts: 4

View user's profile Send private message

Question about get_timer1() ...
PostPosted: Mon Dec 15, 2008 8:55 am     Reply with quote

Hi there.

See the following codes:

Code 1:
Code:

set_timer1(0);
output_high(PIN_A0);
while(get_timer1()<250){
    //wait
}
output_low(PIN_A0);

while(get_timer()<5000){
     //wait again
}


Code 2:
Code:

set_timer1(0);
output_high(PIN_A0);
while(get_timer1()<250){
    //wait
}
output_low(PIN_A0);

delay_us(5000);
}


Code 2 works well (I'm seeing the output in a oscilloscope). Code 1 don't work at all.

In the second code the while(get_timer1()<250) works. In Code 1, both of them don't work.

I'm using a PIC16F877A (Timer1 - 16 bits), My system clock is 1MHz (4Mhz crystal), and my compiler is: PCWHD 4.057
dr_delphi
Guest







PostPosted: Mon Dec 15, 2008 9:01 am     Reply with quote

In the first example, the second while, you wave get_timer instead of get_timer1
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