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 support@ccsinfo.com

Can't make pulse with timer0 pic12f508 [Solved]

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



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

Can't make pulse with timer0 pic12f508 [Solved]
PostPosted: Wed May 23, 2018 9:33 am     Reply with quote

Hi, I am trying to toggle led using the only timer that this micro has: timer0.

Here is the code:

Code:

#include <12F508.H>
#fuses INTRC, NOWDT, NOPROTECT, NOMCLR

void main() {
setup_timer_0(T0_INTERNAL|T0_DIV_128);
set_timer0(0);
   while(1) {
      if(get_timer0() > 254) {
         output_toggle(PIN_B5); 
         set_timer0(0);
      }
   }
}



On the output pinB5 I have attached LED. I see that the led is blinking asynchronously. I have a scope to but no need to scope it. It is obvious that there is no pulse with duty 50% as I expect.
_________________
A person who never made a mistake never tried anything new.
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

PostPosted: Wed May 23, 2018 9:54 am     Reply with quote

Sorry It was a hardware problem
_________________
A person who never made a mistake never tried anything new.
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