Hello freands...
I build a circuit with PIC16F876A, and i just what to power a led 3 colors (4 pin) in RB0, RB1, RB2.
My circuit is energized with a 9V batery and reguled to 5v with LM78L05. (pin 8 ) (pin 1 MCLR)
I have a external crystal 20MHz with capacitor ceramic 33pf (pin 9, 10 ).
My code is build with CCSC, ( language C ). I just what to power the led 1 (RB0) for x seconds and power off and power de other led (RB1) for x seconds, then power off and power on the last led (RB2). Very simple... but not run.
The problem is my code or my circuit ?
The Code:
__________
#FUSES NOWDT //Watch Dog Timer desabilitado
#FUSES HS //oscilador cristal <= 20mhz
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //sem proteção para leitura da eprom
#FUSES BROWNOUT //Resetar quando detectar brownout
//#FUSES MCLR // error in Build
#FUSES NOLVP // prog. baixa voltagem desabilitado
#FUSES NOCPD //
#use delay(clock=20000000)
#use fast_io(a)
#use fast_io(b)
#define trisa 0b00000000 // 0 output, 1 input
#define trisb 0b00000111 // or #define trisb 0x00
void main()
{
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);
// TODO: USER CODE!!
while(true)
{
output_high(PIN_B0);
output_low(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_high(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_low(PIN_B1);
output_high(PIN_B2);
delay_ms( 1000 );
};
}
I build a circuit with PIC16F876A, and i just what to power a led 3 colors (4 pin) in RB0, RB1, RB2.
My circuit is energized with a 9V batery and reguled to 5v with LM78L05. (pin 8 ) (pin 1 MCLR)
I have a external crystal 20MHz with capacitor ceramic 33pf (pin 9, 10 ).
My code is build with CCSC, ( language C ). I just what to power the led 1 (RB0) for x seconds and power off and power de other led (RB1) for x seconds, then power off and power on the last led (RB2). Very simple... but not run.
The problem is my code or my circuit ?
The Code:
__________
#FUSES NOWDT //Watch Dog Timer desabilitado
#FUSES HS //oscilador cristal <= 20mhz
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //sem proteção para leitura da eprom
#FUSES BROWNOUT //Resetar quando detectar brownout
//#FUSES MCLR // error in Build
#FUSES NOLVP // prog. baixa voltagem desabilitado
#FUSES NOCPD //
#use delay(clock=20000000)
#use fast_io(a)
#use fast_io(b)
#define trisa 0b00000000 // 0 output, 1 input
#define trisb 0b00000111 // or #define trisb 0x00
void main()
{
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);
// TODO: USER CODE!!
while(true)
{
output_high(PIN_B0);
output_low(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_high(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_low(PIN_B1);
output_high(PIN_B2);
delay_ms( 1000 );
};
}
Last edited: