Society of Robots - Robot Forum

Software => Software => Topic started by: necroq on March 28, 2012, 09:41:27 AM

Title: output not function..????
Post by: necroq on March 28, 2012, 09:41:27 AM
 :'( :'( :'(hello guys..am a electrical student being forced by lecturers to design a stairs climbing robot as my final year project...i need some help on my c program (am using pic16f877). this is how my robot will operate:
 1)swicth on the robot
2)motors(3 motors) run and IR(active low) sensor also switched on
 3)robot climbs the stairs 
4)IR sense a line(active high) to stop the robot i dont know why this code cannot be build...REALLY NEED UR HELP.. above is my c program: 
Quote
#include <pic.h>
#include <htc.h>
__CONFIG(0x3F32);
#define LED PORTB                                                                                                                     
#define _XTAL_FREQ 20000000
#define INPUT PORTA

void pic_init();
main()
{
int RA;
pic_init();//initialize PIC
for(;;)//loop forever

{
if(PORTA==0b000001)
{LED=0b10101010;}
else
{LED=0b01010101;}


}
}
void pic_init(){
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;
ADCON1=0b00000110;
PORTA=0b00000000;
PORTB=0b00000000;
PORTC=0b00000000;
PORTD=0b00000000;
PORTE=0b00000000;}

Title: Re: output not function..????
Post by: joe61 on March 28, 2012, 10:24:27 AM
What error messages do you get? Please copy and paste them (also, please use the CODE tags so it will be more readable). If you check the "Don't use smileys" checkbox when posting it won't mangle for loops and such.

Joe
Title: Re: output not function..????
Post by: adanvasco on March 31, 2012, 08:54:36 PM
Errors? IDE? We need more details to be able to help.