Go to Post It is probable that you will find mroe than a few spotlight worthy phrases or sentences in the following. ;) - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-03-2006, 00:44
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Odd Problem With Old EDU Bot

Hey,
I'm having a really strange problem with the old EDU controller (I think two years ago -- the first one to use a PIC processor and it needed an external RC controller). I've pulled it out to use on an un-related project, but the digital inputs don't seem to be working.
I've initialized them properly:
IO1 = IO2 ... IO8 = INPUT;
I've turned off analog:
Set_Number_Of_Analog_Channels(NO_ANALOG);
I've set the rest of the pins to output:
IO9 = IO10 ... IO16 = OUTPUT;
rc_dig_out09 ... rc_dig_out16 = 0;

Then when I check the values of the pins:
printf("rc_dig_in01: %d ... rc_dig_in08: %d\n", rc_dig_in01 ... rc_dig_in08);
I get:
257 257 257 257 0 0 0 0

Things get stranger. If I ground input 1, the output becomes:
1 257 257 257 0 0 0 0

And grounding other pins change random values (pin 4 changes value 2 from 257 to 256, etc).

EDIT:
I've figured out the pattern:
Grounding input 1 will cause the value of input 1 to be 1
Grounding input 2 will cause the value of input 1 to be 256
Grounding input 3 will cause the value of input 2 to be 1
Grounding input 4 will cause the value of input 2 to be 256
And so on...
If 16 is set as an input, it will cause the value of 8 to change from 1 to 0
Every input after 8 (9 and up) are 0 and I can't get 'em to change.

It dosen't seem to make any difference if I define none of the inputs as analog or all the inputs as analog (NO_ANALOG or EIGHT_ANALOG).

I'm using the default code from http://www.ifirobotics.com/edu-rc.shtml with the most recent firmware.

I have tried simple modifications to the default code (just printf("%d\n",rc_dig_in06); (where in06 defaults to an input) and similarly strange results have occurred.

Any advice would be greatly appreciated!
Thanks,
David
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one

Last edited by wun : 06-03-2006 at 01:09.
  #2   Spotlight this post!  
Unread 06-03-2006, 07:32
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Odd Problem With Old EDU Bot

The %d format specifier wants to see an integer. The rc_dig_in## values are being passed to printf as chars. What you're seeing is the eight char values being printed as four int values.

To fix it, cast the switch values as ints.
Code:
rintf("rc_dig_in01: %d ... rc_dig_in08: %d\n", (int)rc_dig_in01 ... (int)rc_dig_in08);
  #3   Spotlight this post!  
Unread 06-03-2006, 12:44
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Re: Odd Problem With Old EDU Bot

Quote:
Originally Posted by Alan Anderson
The %d format specifier wants to see an integer. The rc_dig_in## values are being passed to printf as chars. What you're seeing is the eight char values being printed as four int values.
To fix it, cast the switch values as ints.
Ah, of course! How could I forget. Actually, I suppose I forgot because I haven't programmed one of these things in years and my brain isn't at it's peak mental capacity at 1 am. Anyway, thanks for the help.
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Labview CMUcam demo problem Windward LabView and Data Acquisition 19 11-08-2007 02:33
The best thing you can do when reporting a problem .. Brandon Martus CD Forum Support 1 08-02-2006 07:46
Need a realistic Statics Problem sanddrag Technical Discussion 10 05-12-2005 15:07
Getting A Bot To Turn Andrew Blair Technical Discussion 20 16-10-2005 23:49
serious problem found - robot controller resets when jarred! KenWittlief Electrical 23 19-03-2003 13:30


All times are GMT -5. The time now is 03:14.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi