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

LED not blinking....

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



Joined: 23 Oct 2008
Posts: 38

View user's profile Send private message

LED not blinking....
PostPosted: Mon Jul 20, 2009 8:43 am     Reply with quote

Code:
#include <16F877.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
//#FUSES XT
#FUSES HS
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES NOLVP                      //Low Voltage Programming on B3(PIC16) or B5(PIC18)
//#FUSES NOCPD                    //No EE protection
//#FUSES NOWRT                    //Program memory not write protected
//#FUSES NODEBUG                  //No Debug mode for ICD

#use fast_io(A)
#use delay(clock=11000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)

/****************************************************************************/
/***        Macro Definitions                                             ***/
/****************************************************************************/
// Standard definitions
#define RED_LED         PIN_A0    // (output) Red LED (low true)

// Macros to simplify I/O operations
#define RED_LED_ON      output_low(RED_LED)
#define RED_LED_OFF     output_high(RED_LED)

void main()
{

   RED_LED_ON;
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);

  while(1)
  {
     RED_LED_ON;
     delay_us(500);
     RED_LED_OFF;
     delay_us(500);
 
  }

}


I am using 11.0592 Mhz crystal....

don't know whats wrong with the following code...
qseeker



Joined: 25 Jun 2009
Posts: 7

View user's profile Send private message

PostPosted: Mon Jul 20, 2009 8:52 am     Reply with quote

Delete #use fast_io(A) or use set_tris_a()
Ttelmah
Guest







PostPosted: Mon Jul 20, 2009 8:53 am     Reply with quote

#use fast_io(a).....

I you select this, it becomes _your_ responsibility to set TRIS. You are not doing this.

Either remove this line, or set the TRIS register for port A.

Best Wishes
sanddune008



Joined: 23 Oct 2008
Posts: 38

View user's profile Send private message

PostPosted: Mon Jul 20, 2009 9:22 am     Reply with quote

i removed fast_io().....now the LED has come up.....but its steady and not blinking....

I am using 11.05932Mhz......
qseeker



Joined: 25 Jun 2009
Posts: 7

View user's profile Send private message

PostPosted: Mon Jul 20, 2009 9:34 am     Reply with quote

delay_us(500) is too fast.... try delay_ms(500)
sanddune008



Joined: 23 Oct 2008
Posts: 38

View user's profile Send private message

PostPosted: Mon Jul 20, 2009 9:42 am     Reply with quote

thanks.....i didn't notice the micro second thing....
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