Switch not working!!
Posted: Thu Mar 06, 2014 1:58 pm
it a silly question and this is pretty annoying to me.i wish to light up led on SK28 using PIC182550 using button (RB0) on the board,however there didn't show any output.
the code:
the code:
- CODE: SELECT_ALL_CODE
//Turn on LED using button using PIC18f2550 using SK28
#include <p18f2550.h>
#pragma config FOSC=HS
#pragma config WDT=OFF
#pragma config MCLRE=ON
#pragma config BOR=OFF
#pragma config PWRT=ON
#pragma config LVP=OFF
#define LED RB1
#define SW RB0
void main (void)
{
PORTB=0;
TRISB=0x01;
if(SW==0) LED=1;
else LED=0;
}