Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
No, PIC16F877A...Are you still using pic16f676?
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_XT);
#define _XTAL_FREQ 4000000
void main (void)
{
TRISB=0b00000000;//all pins set as ouput
PORTB=0;
while (1)
{//endless loop
PORTB = !PORTB;
__delay_ms(1000);
}
}
hex code
:060000000A128A11DC2F38
:100FB80083010A128A11E02F831603138601831214
:100FC80003138601E72F83120313860800300319E1
:100FD800013086000630F2001330F100B130F00025
:100FE800F00BF42FF10BF42FF20BF42FFB2FE72F5C
:080FF800E72F0A128A110028FC
:02400E0031FF80
:00000001FF
There is nothing wrong with the code
:060000000A128A11DC2F38
:100FB80083010A128A11E02F831603138601831214
:100FC80003138601E72F83120313860800300319E1
:100FD800013086000630F2001330F100B130F00025
:100FE800F00BF42FF10BF42FF20BF42FFB2FE72F5C
:080FF800E72F0A128A110028FC
:02400E0031FF80
:00000001FF
where??The code works....
i have used multimeter also but nothing was there except zero...Have to tried testing the LED by shorting the resistor to ground ?
Have you got a scope?
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_XT);
#define _XTAL_FREQ 4000000
void main (void)
{
TRISB=0b00000000;//all pins set as ouput
PORTB=0;
while (1)
{//endless loop
PORTB = 0x1;
__delay_ms(1000);
PORTB = 0x2;
__delay_ms(1000);
PORTB = 0x4;
__delay_ms(1000);
PORTB = 0x8;
__delay_ms(1000);
PORTB = 0xff;
__delay_ms(1000);
}
}
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_XT);
#define _XTAL_FREQ 4000000
void main (void)
{
TRISB=0b00000000;//all pins set as ouput
PORTB=0;
while (1)
{//endless loop
PORTB = 0x1;
NOP(); //__delay_ms(1000);
PORTB = 0x2;
NOP(); //__delay_ms(1000);
PORTB = 0x4;
NOP(); //__delay_ms(1000);
PORTB = 0x8;
NOP(); //__delay_ms(1000);
PORTB = 0xff;
NOP(); //__delay_ms(1000);
}
}
NOP will also give delay of 1Sec??NOP(); //__delay_ms(1000);
how??And run it in the MPLAB sim.
Have you ever simulated the code in MPLAB? Goto the Debugger menu.. Select tool.. option 5 ... MPLAB SIM ..
and only arrow is following