View previous topic :: View next topic |
Author |
Message |
sanddune008
Joined: 23 Oct 2008 Posts: 38
|
LED not blinking.... |
Posted: Mon Jul 20, 2009 8:43 am |
|
|
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
|
|
Posted: Mon Jul 20, 2009 8:52 am |
|
|
Delete #use fast_io(A) or use set_tris_a() |
|
|
Ttelmah Guest
|
|
Posted: Mon Jul 20, 2009 8:53 am |
|
|
#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
|
|
Posted: Mon Jul 20, 2009 9:22 am |
|
|
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
|
|
Posted: Mon Jul 20, 2009 9:34 am |
|
|
delay_us(500) is too fast.... try delay_ms(500) |
|
|
sanddune008
Joined: 23 Oct 2008 Posts: 38
|
|
Posted: Mon Jul 20, 2009 9:42 am |
|
|
thanks.....i didn't notice the micro second thing.... |
|
|
|