Monday, January 16, 2006

Monday's Happenings

The first thing we did today was to compile the 2006 default code so that we could run it on the 2005 RC. Thanks to Emily for her copius instructions! We also looked through interupts.c and the autonomous code that was already in user_routines_fast.c so we (Shirin and Sophia) fully understand the lovely timer mechinism. We did a little poking around to look at sensors that we could potentially use for distance. It appears that they gave you hook-ups for a gear-tooth sensor (gts) but not the actual sensor. We looked at the sensor that sees if light can get through (the name eludes me at the moment), but were a tad perplexed and had trouble finding any detailed documentation. Also, we bought a potentiometer (two, actually) so that we could play around with analog sensors. Neither Shirin nor I had brought our programming booklet, so our attempt to hook it up / program it properly was not successful. It did, however, change the value from what we initialized it as. It just would not continually returned 255. We hope to have it up and running tomorrow with help from our handy guide created by Emily.

1 Comments:

Blogger HomogeneousTransform said...

Good work today guys! You made some serious headway into understanding all the sensors and code! Totally impressive you started thinking about the GTS (gear-tooth sensor). I was going to suggest that as a next step since that's the most likely sensor we'll set up in order to track our yaw (i.e. the angle at which the turret is at).

The light sensor is an infrared source and receiver I believe.

On the potentiometer - sounds like you're getting there. Remember that for INPUTS, you don't actually need to intialize its value. Because an INPUT GIVES YOU ITS VALUE ;) I'm not sure what you would do if it was trying to give you information and you tried to make it do something. In contrast, it's OUTPUTS that you need to initialize to a certain value.

Let's take a look at user_routines.c. If you look under the function User_Initialization(void), you'll find that all the analog channels (to which you plug in something like a potentiometer) are already initialized! Yay, nothing to do.

As to analog inputs, here's a hint: Look in your 2004 Programming Reference Guide pg. 16 bottom of the page (it's the fifth section of the stuff I printed out for you).

A heads up. With analog values, you need to call the Get_Analog_Value(int analogchannel) function every time you want to read from that ADC channel. Unlike the digital inputs, you can't just say, what's that rc_dig_in01 value right now? That makes it a bit of a pain. Anyhow, you should be able to print the value of the potentiometer to the screen with three lines of code within the default_routine.

1. Create a local variable

2. Set the local variable to the value of the ADC channel.

3. Write a printf statement to read out the value of the local variable to your terminal.

Yeah? Can we tackle that? I think we can!!

10:49 PM

 

Post a Comment

<< Home