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

Doubt about OCx

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



Joined: 08 Oct 2003
Posts: 11
Location: BRAZIL

View user's profile Send private message

Doubt about OCx
PostPosted: Mon Jun 27, 2011 6:43 am     Reply with quote

Hello Guys, I have an application that works sometimes.. Crying or Very sad ... I need to reset the microcontroller to the application to get to work.
The compiler version is 4.114.

Code:

#include <30F3012.h>

#FUSES NOWDT                   
#FUSES HS2_PLL16             
#FUSES NOCKSFSM                 
#FUSES NOPUT
#FUSES NOBROWNOUT               
#FUSES NOMCLR                     
#FUSES NOWRT                   
#FUSES NOPROTECT               
#FUSES ICSP1                   
#FUSES NODEBUG                 

#use delay(clock=20000000)

void main()
{   
  setup_compare(1,COMPARE_OFF);
  setup_timer2(TMR_INTERNAL | TMR_DIV_BY_1,24);  //800 KHz - HS2_PLL16

  enable_interrupts(INTR_GLOBAL);
   
  delay_ms(800); //100ms
 
  while (true) {
   
    setup_compare(1,COMPARE_CONT_PULSE | COMPARE_TIMER2 );
    delay_ms(800); //100ms
 
    setup_compare(1,COMPARE_OFF);
    delay_ms(800); //100ms
  }
}



Regards...

Leandro
mutthunaveen



Joined: 08 Apr 2009
Posts: 100
Location: Chennai, India

View user's profile Send private message

use WDT
PostPosted: Mon Jun 27, 2011 9:47 pm     Reply with quote

You can use WDT in your code to reset the program all the time..... Smile
pitufos



Joined: 08 Oct 2003
Posts: 11
Location: BRAZIL

View user's profile Send private message

PostPosted: Tue Jun 28, 2011 5:46 am     Reply with quote

Hi,

I need to generate a 800Khz square wave on OC1 and to be able to set turn on and turn off the square wave.

Using this code, when i turn on the power source, sometimes just generate 6.6Hz and sometimes OK... Crying or Very sad

Thanks...
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