piyushpandey
Member level 4
hello guys
I have connected two LEDS one to RC3 and another to RC2 of the pic16f688 and have written this code to check the blinking of the LED's
In this code I have disabled the watchdog timer but I am getting the following result:
1. the LED connected to the RC3 is only blinking and not the LED connected to the RC2 , it is not blinking at all.
2. rather than blinking for 6 times the led connected to RC3 is blinking continuously.
I am not able to get the logic working behind this , SO please help me guys.
Thanks
I have connected two LEDS one to RC3 and another to RC2 of the pic16f688 and have written this code to check the blinking of the LED's
Code:
#include <stdio.h>
#include <stdlib.h>
#include <pic.h>
__CONFIG(WDTE_OFF);
#define _XTAL_FREQ 4000000 // Define the frequency of the clock
int main (void) {
// Defining the pins direction as output
//#define one
//#ifdef one
TRISCbits.TRISC2 = 0;
TRISCbits.TRISC3 = 0;
//#endif
// TRISC = 0x00;
// Disabling the analog condition of the pins
//#define two
//#ifdef two
ANSELbits.ANS2 = 0;
ANSELbits.ANS3 = 0;
//endif
// ANSEL = 0x00;
// CMCON0 = 0x07;
for (int i=0;i<=5;i++)
//while(1)
{
__delay_ms(100);
PORTCbits.RC2 = 0;
PORTCbits.RC3 = 1;
__delay_ms(100);
PORTCbits.RC2 =1;
PORTCbits.RC3 =0;
}
//while(1);
return (EXIT_SUCCESS);
}
In this code I have disabled the watchdog timer but I am getting the following result:
1. the LED connected to the RC3 is only blinking and not the LED connected to the RC2 , it is not blinking at all.
2. rather than blinking for 6 times the led connected to RC3 is blinking continuously.
I am not able to get the logic working behind this , SO please help me guys.
Thanks