can I straight plug supply 9V voltage to Vdd, MCLR pins and ground to ground pin?
anyone can help me with the coding?
i dunno y is it isn't working.
void main(void)
{
/////////////////////Main Program///////////////////////////////////
int time = 5000 ;
TRISB = 0xFF ;//define port B as input port
TRISC = 0xFF ;//define port C as input port
TRISD= 0xFF ;//define port D as output port
PORTD = 0;
if ( PORTB = 1 ) PORTD = 0b00000001 ; //push button1 on //motor go up
else if (PORTC = 0b00000001) //if limit lvl2 rch
if (PORTC = 0b00000100) //sensor rch grnd floor
PORTD=0b00000000 ; // motor stopped
else
PORTD = 0b00000010; //motor goes down
else
PORTD = 0b00000000; //stop motor
Vdelay_ms (time); //delay 5s
PORTD=0b00000010 ; //motor goes down