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 anybody help me with LEDs ..thanx..

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



Joined: 30 Jan 2010
Posts: 4

View user's profile Send private message

Can anybody help me with LEDs ..thanx..
PostPosted: Sat Jan 30, 2010 6:47 am     Reply with quote

Code:

#define suis PIN_D0
#define buzzer PIN_B0
#define buzzer2 PIN_D1

void main()
//void delay 20s ()
{
   //int i;
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   while(1)
   {
  //if (input(suis))
   {
   output_b(0b00000001);
   delay_ms(1000);
   output_b(0b00000010);
   delay_ms(1000);
   output_b(0b00000100);
   delay_ms(1000);
   output_b(0b00001000);
   delay_ms(1000);
   output_b(0b00010000);
   delay_ms(1000);
   output_b(0b00100000);
   delay_ms(1000);
   output_b(0b00000000);
   output_b(0b01000000);
   delay_ms(1000);
 
   output_d(0b00000010);
   delay_ms(1000);
   output_d(0b00000100);
   delay_ms(1000);
   output_d(0b00001000);
   delay_ms(1000);
   output_d(0b00010000);
   delay_ms(1000);
   output_d(0b00100000);
   delay_ms(1000);
   output_d(0b01000000);
   delay_ms(1000);
   }
   
   }
 
//void delay==20s()
//{
//for(i=0;i<=20;i++)
//delay_ms(1000);}

}

I want to make an LED running which consist of three different colours of LED. I have a problem for last LED which is connected to Port D. It cannot turn ON. And also I want my LED at port b to turn on for 20s before another LED continues flashing. Please help me.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 31, 2010 12:21 am     Reply with quote

Always post your PIC, and the #fuses, #use delay(), and your compiler
version.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Jan 31, 2010 6:01 am     Reply with quote

Code:
setup_spi(SPI_SS_DISABLED);
This is an (old) error in the CCS setup wizard and creates an invalid hardware configuration with undefined behaviour. Change to:
Code:
setup_spi(FALSE);
zack



Joined: 30 Jan 2010
Posts: 4

View user's profile Send private message

PostPosted: Tue Feb 02, 2010 7:41 pm     Reply with quote

PCM programmer wrote:
Always post your PIC, and the #fuses, #use delay(), and your compiler
version.

Thank you. I use PIC16f877A and I use PIC compiler software. I'm a beginner in PIC and I do it for my final project so I actually am not an expert with the software. Hope that you will guide me. Thank you.
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