Author Topic: Problems with my LFR robot.  (Read 1248 times)

0 Members and 1 Guest are viewing this topic.

Offline ubaid88Topic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Problems with my LFR robot.
« on: October 02, 2011, 10:43:59 AM »
This is my first post in forum. I was trying to take part in LFR competition but I was unable to complete the robot. I was trying use to RC car as robot. I used IR led and photo-diodes for input, l293d h-bridge IC for steering the front dc motor of RC car, PWM for speed controller of back DC motor, PIC18f2550 as microcontoller and C18 compiler.
The problem I faced is that My pic doesn't show any voltage output as input changes.
Here is my program for steering to h-bridge. If that would have worked then I have gone for speed control on turning.
#pragma FOSC = HSPLL_HS

# define STRA PORTBbits.RB0

# define STRB PORTBbits.RB1



TRISB = 0X00;
void main()


   if(PORTA == 0x00)  
   {STRA = 0; STRB=0;}
   else if(PORTA == 0x01)
   {STRA = 1; STRB=0;}
   else if(PORTA == 0x03)
   {STRA = 1; STRB=0;}
   else if(PORTA == 0x02)
   {STRA = 0; STRB=0;}
   else if(PORTA == 0x06)
   {STRA = 0; STRB=1;}
   else if(PORTA == 0x04)
   {STRA = 0; STRB=1;}
   else if(PORTA == 0x07)
   {STRA = 0; STRB=0;}
« Last Edit: October 02, 2011, 10:47:06 AM by ubaid88 »

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Problems with my LFR robot.
« Reply #1 on: October 03, 2011, 09:30:05 PM »
Do you have the proper HS XTAL and caps on the PIC?
Do you have 0.1uF de-coupler caps across each pair of Vdd-Vss pins?

Which compiler are you using? C18?

You should specify every Configuration setting in you code.

What hardware programming tool are you using?

Have you just tried to turn an output on and off? Get this to work before inputs then only with a simple input (one pin).
Does ADCON1 = 0xff disable all analog features on PORTA?
Have you run/stepped your code in the MPLAB Simulator with a stimulus on PORTA?

On PIC18F's always use the LATx registers for output not the PORTx register. Look in the PIC reference manuals for the R-M-W issue. So write to LATx, read from PORTx.


Get Your Ad Here