Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC programming help needed

Status
Not open for further replies.

LoyC

Junior Member level 1
Joined
Mar 1, 2011
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,410
//on/off funcion

#include <pic.h>
#include <htc.h>

__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT & BORDIS);

unsigned int RA0,RA1,RA2,RA3,RB0,RB1,RB2,RB3,RB5;
void main(void)
{
ANSEL = 0x00; //select POTA & PORTB as digital i/o
TRISA = 0xFF; //select PORTA as input
TRISB = 0x00; //select PORTB as output

while(1)

{
if(RA0==1){ //switch on S1

RB0=1; //set RB0 as high
RB5=0; //enable TE
}
else{ //switch off S1
RB0=0; //set RB0 as low
RB5=0; //enable TE
}

if(RA1==1){

RB1=1; //set RB1 as high
RB5=0; //enable TE
}
else{
RB1=0; //set RB1 as low
RB5=0; //enable TE
}

if(RA2==1){

RB2=1; //set RB2 as high
RB5=0; //enable TE
}
else{
RB2=0; //set RB2 as low
RB5=0; //enable TE
}

if(RA3==1){

RB3=1; //set RB3 as high
RB5=0; //enable TE
}
else{
RB3=1; //set RB3 as low
RB5=0; //enable TE
}
}
return 0;
}

i've wrote a program here. Can any1 tell me what's wrong with it because error message keep poops up everytime i try to build it.
 

What kind of errors?????
Also specify the ucontroller you are using.


return 0;????
Also check this again.
Does not necessary here.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top