View previous topic :: View next topic |
Author |
Message |
zack
Joined: 30 Jan 2010 Posts: 4
|
Can anybody help me with LEDs ..thanx.. |
Posted: Sat Jan 30, 2010 6:47 am |
|
|
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
|
|
Posted: Sun Jan 31, 2010 12:21 am |
|
|
Always post your PIC, and the #fuses, #use delay(), and your compiler
version. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Jan 31, 2010 6:01 am |
|
|
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: |
|
|
zack
Joined: 30 Jan 2010 Posts: 4
|
|
Posted: Tue Feb 02, 2010 7:41 pm |
|
|
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. |
|
|
|