hassankhan
New Member
now can i power my circuit for blinking of led?? ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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.
winpic800, i fear, cant be accessed from mplab?
thanks Burt !I know that you use it to load the hex if he loads the project blink84 in MPLAB have a good look at it and rebuild it and then point winpic800 to where it complied the hex and load that
hex it will work fine
He been exporting a hex .
#include <htc.h>
__CONFIG (FOSC_HS & CP_OFF & WDTE_OFF & PWRTE_ON );
#ifndef _XTAL_FREQ
// Unless already defined assume 4MHz system frequency
// This definition is required to calibrate __delay_us() and __delay_ms()
#define _XTAL_FREQ 4000000
#endif
void init(void)
{
// port directions: 1=input, 0=output
TRISB = 0b00000100; //set's portb to outputs all but RB2 and it's a input
RB0 = 0; //starts RB0 off
}
void main(void) //main code atfer here
{
init(); //runs startup code
while (1){ //loop
if(RB2=0){ // check switch
__delay_ms(50); //delay to let switch debounce
if(RB2=0)
RB0 = 1; //If switch is Low led is on
else
RB0 =0; // Switch High led is off
}
}
}