View Single Post
  #6   Spotlight this post!  
Unread 29-01-2004, 10:26
Larry Barello Larry Barello is offline
http://www.barello.net
#0492 (Titan Robotics Club)
Team Role: Mentor
 
Join Date: Jan 2002
Location: Bellevue, WA
Posts: 85
Larry Barello has a spectacular aura aboutLarry Barello has a spectacular aura about
Re: help! Am really stuck!!!!

Quote:
Originally Posted by pagemauck
Have been trying for a week to get digital input while in autonomous mode. After the Getdata line in void User_autonomous_Code we have

if (rc_dig_in06 == 0) pwm01=255: else pwm01=127;

We have the light sensor hooked up to digital input #6. It appears to be working and we have adjusted sensitivity on it. We have also swapped out the sensor. Simple lines like pwm01=255; work fine in our program. I have tried moving this line in all places in the program but it doesn't help.
Your code looks fine (except for the ":" but I assume that is a typo)

Digital inputs are "IN" by default. Is there any chance you initialized that bit for output and forgot it? That is PORTB6, which is one of the "change of state" interrupt inputs.

Does your light sensor have active outputs? I.e. is it a banner sensor? If you are using analog output device (e.g. an off-the-shelf photo-reflex sensor) you need to be aware of the type of input you are driving. It turns out the PIC processor has a variety of input types that depend upon which input pin you are using. In particular, port B pins are TTL and not suitable for analog inputs. Other bits are "Schottky" and *are* suitable for direct drive by an analog input. Anyway, that is a minor issue to be addressed *after* you figure out the basic code.

Last edited by Larry Barello : 29-01-2004 at 10:30.